11using System ;
22using System . Collections . Generic ;
3+ using System . Diagnostics ;
34using EmptyKeys . UserInterface ;
45using EmptyKeys . UserInterface . Debug ;
56using EmptyKeys . UserInterface . Generated ;
@@ -34,8 +35,17 @@ public Game1()
3435 graphics = new GraphicsDeviceManager ( this ) ;
3536 Content . RootDirectory = "Content" ;
3637 graphics . PreparingDeviceSettings += graphics_PreparingDeviceSettings ;
37- graphics . DeviceCreated += graphics_DeviceCreated ;
38+ graphics . DeviceCreated += graphics_DeviceCreated ;
39+ Window . ClientSizeChanged += Window_ClientSizeChanged ;
40+ }
3841
42+ private void Window_ClientSizeChanged ( object sender , EventArgs e )
43+ {
44+ if ( basicUI != null )
45+ {
46+ Viewport viewPort = GraphicsDevice . Viewport ;
47+ basicUI . Resize ( viewPort . Width , viewPort . Height ) ;
48+ }
3949 }
4050
4151 void graphics_DeviceCreated ( object sender , EventArgs e )
@@ -53,7 +63,7 @@ private void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSett
5363 graphics . PreferMultiSampling = true ;
5464 graphics . GraphicsProfile = GraphicsProfile . HiDef ;
5565 graphics . SynchronizeWithVerticalRetrace = true ;
56- graphics . PreferredDepthStencilFormat = DepthFormat . Depth24Stencil8 ;
66+ graphics . PreferredDepthStencilFormat = DepthFormat . Depth24Stencil8 ;
5767 e . GraphicsDeviceInformation . PresentationParameters . MultiSampleCount = 16 ;
5868 }
5969
@@ -111,6 +121,17 @@ protected override void LoadContent()
111121 RelayCommand tetrisRotate = new RelayCommand ( new Action < object > ( OnRotate ) ) ;
112122 KeyBinding rotate = new KeyBinding ( tetrisRotate , KeyCode . W , ModifierKeys . None ) ;
113123 basicUI . InputBindings . Add ( rotate ) ;
124+
125+ RelayCommand resizeCommand = new RelayCommand ( new Action < object > ( OnResize ) ) ;
126+ KeyBinding resizeBinding = new KeyBinding ( resizeCommand , KeyCode . R , ModifierKeys . Control ) ;
127+ basicUI . InputBindings . Add ( resizeBinding ) ;
128+ }
129+
130+ private void OnResize ( object obj )
131+ {
132+ graphics . PreferredBackBufferWidth = 1920 ;
133+ graphics . PreferredBackBufferHeight = 1080 ;
134+ graphics . ApplyChanges ( ) ;
114135 }
115136
116137 private void OnRotate ( object obj )
@@ -161,6 +182,8 @@ protected override void Update(GameTime gameTime)
161182 basicUI . UpdateLayout ( gameTime . ElapsedGameTime . TotalMilliseconds ) ;
162183
163184 base . Update ( gameTime ) ;
185+
186+
164187 }
165188
166189 /// <summary>
0 commit comments