Martin's picture

Frames and rounded corners on window used for rendering

Hi

I have two questions regarding customization of the window in which I do my rendering.

1) I am currently using a GameWindow (not fullscreen) and I would like to hide the title/caption bar of the window, but still
have its frame/border, so it can be resized using the mouse. The options for NativeWindow does not appear to support this layout combination
directly. Am I missing something or could this be achieved in some other way?

2) Depending on how difficult it is, I would also like to create smooth, rounded corners of the window and be able to
control the degree of opacity of the window itself, so that the desktop is partly visible beneath it. Can this be achieved with a GameWindow or would it
be easier to do this with a regular Form with a GLControl on it?


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

1) as far as I know, this is not possible unless you draw your own border. Do WinForms provide such a mode?

2) this is operating-system specific. GameWindow does not currently support this, but some operating systems will respect the alpha channel of the framebuffer and blend the window contents with the background.

Martin's picture
the Fiddler wrote:

1) as far as I know, this is not possible unless you draw your own border. Do WinForms provide such a mode?

I did some research and it is pretty easy to achieve with a .Net form:

this.ControlBox = false;
this.Text = string.Empty;

This results in a form with no window caption, but it still has a frame for resizing.

the Fiddler wrote:

2) this is operating-system specific. GameWindow does not currently support this, but some operating systems will respect the alpha channel of the framebuffer and blend the window contents with the background.

Rounded corners (again, a .Net Form solution):

GraphicsPath graphicpath = new GraphicsPath();
graphicpath.StartFigure();
 graphicpath.AddArc(0, 0, 25, 25, 180, 90);
graphicpath.AddLine(25, 0, this.Width - 25, 0);
graphicpath.AddArc(this.Width - 25, 0, 25, 25, 270, 90);
graphicpath.AddLine(this.Width, 25, this.Width, this.Height - 25);
graphicpath.AddArc(this.Width - 25, this.Height - 25, 25, 25, 0, 90);
graphicpath.AddLine(this.Width - 25, this.Height, 25, this.Height);
graphicpath.AddArc(0, this.Height - 25, 25, 25, 90, 90);
graphicpath.CloseFigure();
this.Region = new Region(graphicpath);

Opacity is a simple property on the Form.

So, given that these things work also in OS X and linux and GLControls respect the "rounding of corners", I think the solution for me is to use a GLControl on a Form instead of GameWindow. But I have no idea if it will work on those platforms, so I guess I will just have to try and implement it to find out :-).
Will post the results here when I get around to it, in case anybody else needs this kind of functionality.