pub struct Point {
pub x: f64,
pub y: f64,
}
Fields§
§x: f64
§y: f64
Implementations§
Source§impl Point
impl Point
Sourcepub fn new(x: f64, y: f64) -> Point
pub fn new(x: f64, y: f64) -> Point
Examples found in repository?
examples/child_window.rs (line 98)
63fn main() {
64 let parent_event_loop = EventLoop::new().unwrap();
65
66 let parent_state = parent_event_loop.spawn(ParentState {
67 framebuffer: Vec::new(),
68 window: None,
69 });
70 let parent_window_raw = parent_state.with(|state, cx| {
71 let window = WindowOptions::new()
72 .title("parent window")
73 .size(Size::new(512.0, 512.0))
74 .open(cx, Key(0))
75 .unwrap();
76
77 window.show();
78
79 let parent_window_raw = window.as_raw().unwrap();
80 state.window = Some(window);
81
82 parent_window_raw
83 });
84
85 let child_event_loop = EventLoopOptions::new().mode(EventLoopMode::Guest).build().unwrap();
86
87 let child_state = child_event_loop.spawn(ChildState {
88 framebuffer: Vec::new(),
89 window: None,
90 });
91 child_state.with(|state, cx| {
92 let mut window_opts = WindowOptions::new();
93 unsafe {
94 window_opts.raw_parent(parent_window_raw);
95 }
96
97 let window = window_opts
98 .position(Point::new(128.0, 128.0))
99 .size(Size::new(256.0, 256.0))
100 .open(cx, Key(0))
101 .unwrap();
102
103 window.show();
104
105 state.window = Some(window);
106 });
107
108 parent_event_loop.run().unwrap();
109
110 child_state.with(|state, _| {
111 state.window = None;
112 });
113
114 parent_state.with(|state, _| {
115 state.window = None;
116 });
117}
pub fn scale(self, scale: f64) -> Point
Trait Implementations§
impl Copy for Point
impl StructuralPartialEq for Point
Auto Trait Implementations§
impl Freeze for Point
impl RefUnwindSafe for Point
impl Send for Point
impl Sync for Point
impl Unpin for Point
impl UnwindSafe for Point
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more