Game Development Reference
In-Depth Information
{
UpdateInput();
_system.Update(elapsedTime);
_system.Render();
simpleOpenGlControl1.Refresh();
}
private void InitializeDisplay()
{
if (_fullscreen)
{
FormBorderStyle = FormBorderStyle.None;
WindowState = FormWindowState.Maximized;
}
else
{
ClientSize = new Size(1280, 720);
}
Setup2DGraphics(ClientSize.Width, ClientSize.Height);
}
protected override void OnClientSizeChanged(EventArgs e)
{
base.OnClientSizeChanged(e);
Gl.glViewport(0, 0, this.ClientSize.Width, this.ClientSize.
Height);
Setup2DGraphics(ClientSize.Width, ClientSize.Height);
}
private void Setup2DGraphics(double width, double height)
{
double halfWidth = width / 2;
double halfHeight = height / 2;
Gl.glMatrixMode(Gl.GL_PROJECTION);
Gl.glLoadIdentity();
Gl.glOrtho(-halfWidth, halfWidth, -halfHeight, halfHeight,
-100, 100);
Gl.glMatrixMode(Gl.GL_MODELVIEW);
Gl.glLoadIdentity();
}
}
}
Search WWH ::




Custom Search