Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::sync::{Arc, Weak};
- #[derive(Debug)]
- struct WinitWindow {
- id: usize,
- }
- impl WinitWindow {
- pub fn size(&self) -> (usize, usize) {
- (1270, 720)
- }
- }
- impl Drop for WinitWindow {
- fn drop(&mut self) {
- println!("Dropping {:?}", self);
- }
- }
- enum Event {
- WindowCloseRequested,
- WindowDestroyed,
- }
- #[derive(Debug)]
- struct Window {
- inner: WinitWindow,
- }
- impl Window {
- pub fn size(&self) -> (usize, usize) {
- self.inner.size()
- }
- }
- #[derive(Debug)]
- struct Application {
- default_event_handler: bool,
- windows: Vec<Arc<Window>>,
- }
- impl Application {
- pub fn new() -> Self {
- Application {
- windows: Vec::new(),
- }
- }
- pub fn open_window(&mut self) -> Arc<Window> {
- let window = Arc::new(Window {});
- self.windows.push(window.clone());
- window
- }
- pub fn run(&mut self, f: impl FnMut(Vec<Event>)) {
- }
- }
- impl !Send for Application {}
- impl !Sync for Application {}
- fn main() {
- let mut app = Application::new();
- let window = app.open_window();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement