c# - MonoGame Maximize window event -


i have been having trouble trying implement event using monogame , c#. when window resized call event:

        this.window.clientsizechanged += new eventhandler<eventargs>(window_clientsizechanged);          void window_clientsizechanged(object sender, eventargs e)         {             int width = window.clientbounds.width;             int height = window.clientbounds.height;             if (width > 0 && height > 0)             {                 graphics.preferredbackbufferwidth = width;                 graphics.preferredbackbufferheight = height;                 graphics.applychanges();              }         } 

this fine , resizes window correctly , updates width/height. not triggered in event window resized via user clicking maximize/minimize button on window frame.

after spending time looking solutions suggestion implement maximize event here:

form form = (form)control.fromhandle(window.handle); form.windowstate = formwindowstate.maximized; 

however solution im not particularly fond of relies on inclusion of system.windows.forms , since may 1 day want build other platforms id rather not include specific windows libraries.

is there monogame functionality handles maximize/minimize event calls each platform or end user implement such functionality?

i've had issue , haven't found 'built in' solution in monogame api.

the solution came performing check @ start of each frame on whether width , height of window.clientbounds changed.
detects window resizes window.clientsizechanged event, detects resizes made maximizing/restoring window.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -