@@ -13,7 +13,7 @@ const WIDTH: u32 = 256;
1313const HEIGHT : u32 = 256 ;
1414
1515fn main ( ) -> Result < ( ) , GlassError > {
16- Glass :: run ( GlassConfig :: windowless ( ) , |_| {
16+ Glass :: run ( GlassConfig :: default ( ) , |_| {
1717 Box :: new ( MultiWindowApp :: default ( ) )
1818 } )
1919}
@@ -28,29 +28,23 @@ const CLEAR_COLORS: [Color; 5] = [
2828
2929/// Example buffer data etc.
3030#[ derive( Default ) ]
31- struct MultiWindowApp {
32- pub window_ids : Vec < WindowId > ,
33- }
31+ struct MultiWindowApp ;
3432
3533impl GlassApp for MultiWindowApp {
36- fn start ( & mut self , event_loop : & ActiveEventLoop , context : & mut GlassContext ) {
34+ fn start ( & mut self , _event_loop : & ActiveEventLoop , context : & mut GlassContext ) {
3735 println ! ( "Press space to create windows, esc to close all but last" ) ;
38- self . window_ids . push (
39- context
40- . create_window ( event_loop, WindowConfig {
41- width : WIDTH ,
42- height : HEIGHT ,
43- exit_on_esc : true ,
44- ..WindowConfig :: default ( )
45- } )
46- . unwrap ( ) ,
47- ) ;
36+ context. create_window ( WindowConfig {
37+ width : WIDTH ,
38+ height : HEIGHT ,
39+ exit_on_esc : true ,
40+ ..WindowConfig :: default ( )
41+ } ) ;
4842 }
4943
5044 fn window_input (
5145 & mut self ,
5246 context : & mut GlassContext ,
53- event_loop : & ActiveEventLoop ,
47+ _event_loop : & ActiveEventLoop ,
5448 _window_id : WindowId ,
5549 event : & WindowEvent ,
5650 ) {
@@ -64,19 +58,15 @@ impl GlassApp for MultiWindowApp {
6458 {
6559 println ! ( "Key: {:?}" , event) ;
6660 if event. physical_key == PhysicalKey :: Code ( KeyCode :: Space )
67- && event. state == ElementState :: Pressed
61+ && event. state == ElementState :: Released
6862 {
6963 // Create window - this will work when your window has focus
70- self . window_ids . push (
71- context
72- . create_window ( event_loop, WindowConfig {
73- width : WIDTH ,
74- height : HEIGHT ,
75- exit_on_esc : true ,
76- ..WindowConfig :: default ( )
77- } )
78- . unwrap ( ) ,
79- ) ;
64+ context. create_window ( WindowConfig {
65+ width : WIDTH ,
66+ height : HEIGHT ,
67+ exit_on_esc : true ,
68+ ..WindowConfig :: default ( )
69+ } ) ;
8070 }
8171 }
8272 }
0 commit comments