grafix_toolbox/kit/opengl/context/
window.rs1use super::*;
2
3use win_impl::CtxDrop;
4pub use win_impl::WindowImpl;
5
6pub fn Window(a: impl WINSize, t: &str) -> impl Window {
7 WindowImpl::get(a, t).fail()
8}
9
10pub trait Window: 'static {
11 fn info(&self) -> &FrameInfo;
12 fn clipboard(&self) -> String;
13 fn set_clipboard(&mut self, str: &str);
14 fn set_vsync(&mut self, enabled: bool);
15 fn resize(&mut self, size: uVec2);
16
17 fn gl_ctx_maker(&mut self) -> impl SendS + FnOnce() -> CtxDrop;
18 fn poll_events(&mut self) -> Vec<event::Event>;
19 fn swap(&mut self);
20}
21
22type WArgs = (i32, i32, u32, u32);
23pub trait WINSize {
24 fn get(self) -> WArgs;
25}
26impl<A, B, C, D> WINSize for (A, B, C, D)
27where
28 i32: Cast<A> + Cast<B>,
29 u32: Cast<C> + Cast<D>,
30{
31 fn get(self) -> WArgs {
32 WArgs::to(self)
33 }
34}
35impl<A, B> WINSize for (A, B)
36where
37 u32: Cast<A> + Cast<B>,
38{
39 fn get(self) -> WArgs {
40 (0, 0, u32(self.0), u32(self.1))
41 }
42}