
Menus in GameWindow
Posted Wednesday, 13 February, 2008 - 12:16 by BlueMonkMN inAs I upgrade my project from DirectX to OpenGL using OpenTK, I am first trying out the possibility of deriving my window from GameWindow instead of embedding my converted display control in the main window. But that cuts out a number of things, the most important of which is menus. Is there any way to add menus to a GameWindow? Is the next best option to resort to using a GLControl on a form with menus? Will there be support for menus at some point if there isn't now?
I'm a little unclear on the portability of System.Windows.Forms; it appears that Mono has some form of System.Windows.Forms implementation for Win32 and X11. Does that mean GameForm could simply inherit from System.Windows.Forms.Form and retain its portability? If so, it seems like that would be the way to go to provide all the features one might expect from a "Form". I'd like to hear your comments on this and more specifically how I might best implement a menu on the main window.


Comments
Re: Menus in GameWindow
GameWindow cannot be used in Windows.Forms applications by design. Even if GameWindow had a Windows.Forms backend (relevant discussion), it still wouldn't be possible to embed a menu inside the GameWindow client area.
As you found out, the best option is to use GLControl. It is cross-platform (as of Mono 1.2.7 it will work on Windows, X11, but not yet OSX). The drawback is that:
To create a game loop you'll need to hook the
Application.Idleevent and loop inside that:Timing information can be gathered by using the
System.Diagnostics.Stopwatchclass. Last, to make the application go fullscreen you'll have to disable the borders and maximize the containing Form.