About Monkey 2 › Forums › Monkey 2 Development › Maximised WindowFlag
This topic contains 5 replies, has 2 voices, and was last updated by
skn3 2 years, 5 months ago.
-
AuthorPosts
-
November 14, 2016 at 5:58 pm #5028
Could we get a maximised window flag, to create the main app window maximised?
November 14, 2016 at 9:50 pm #5037Added WindowFlags.Maximized and WindowFlags.Minimzed to develop branch.
Note: Works best when combined with WindowFlags.Resizable!
November 14, 2016 at 10:32 pm #5038winner thanks
November 15, 2016 at 2:02 pm #5069Given a quick test, seems like it doesn’t redraw properly on startup when the flag is set. I have just a black screen. I have to manually find a gadget in the dark (mojox) that will trigger the redraw. It looks like if you set a smaller window size then the actual maximised sized, then this is where it does not redraw properly.
Also noticed there is no way to capture when the maximised state in the Window class. Would be nice to get a .Maximized and .Minimized Property on Window.
This works:
[/crayon]Monkey123[crayon-5cba8202cde9e857541096 inline="true" ]Cast<SDL_WindowFlags>(SDL_GetWindowFlags(window.SDLWindow)) & SDL_WINDOW_MAXIMIZEDCould we have new events to wrap the SDL ones too:
[/crayon]Monkey12345[crayon-5cba8202cdea7357705616 inline="true" ]SDL_WINDOWEVENT_MAXIMIZEDSDL_WINDOWEVENT_MINIMIZEDSDL_WINDOWEVENT_RESTOREDThere doesn’t seem to be a way to capture these without modifying mojo. Would it be possible to add a RawEvent:Void() callback to the app class? So we can hook into all SDL events, even ones not captured into mojo?
November 17, 2016 at 12:18 am #5124I’ve had a go at fixing some of these issues.
The ‘wont draw after creating a maximized window’ issue is weird, I’ve hacked around it for now by forcing 3 App.RequestRender’s after opening such a window which works here. There’s no reason it shouldn’t be drawing, I’m guessing the SwapBuffers isn’t working but you can’t check that for failure!
Added some new event types: WindowMaximized, WindowMinimized and WindowRestored, some properties: Maximized:Bool and Minimized:Bool and some methods: Maximize(), Minimize(), Restore().
The new event types are always preceded by a WindowResized, so you can generally ignore them.
There seems to be a bug in SDL on linux where maximized, minimzed etc. events are only generated when the user interacts with the window – not when you can Maximize() programmatically. May fake around this later…
I also began work on a better fullscreen system. The Fullscreen property is now read-only, and you need to use BeginFullscren()/EndFullscreen() to go into/out of fullscreen. I’ve done it this way because there are several ways you go can into fullscreen, eg: BeginFullscreen() to go into ‘desktop size’ fake fullscreen mode, BeginFullscreen( w,h,r ) to actually change resolution – and there are likely to be more once you can enum display modes. A simple bool just isn’t enough to enable fullscreen. Plus, I’d also like to add some methods for changing res while in fullscreen…
There also appears to be another bug in SDL where you can’t go from a maximized window into ‘real’ fullscreen (on windows anyway) so be aware of that for now.
November 17, 2016 at 12:26 pm #5144Crikey, one simple request opens up a massive can of worms! Cheers for the continued effort
-
AuthorPosts
You must be logged in to reply to this topic.