Game Development Reference
In-Depth Information
private void UpdateInput(double elapsedTime)
{
_input.Update(elapsedTime);
}
private void GameLoop(double elapsedTime)
{
UpdateInput(elapsedTime);
_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);
Search WWH ::
Custom Search