public void Run() { GDevice gDevice = GDevice.Get(); IDevice iDevice = IDevice.Get(); iDevice.MouseMove += new EventHandler(OnMouseMove); gDevice.Resize += new EventHandler(OnResizeWindow); while (gDevice.IsRunning) { MessageHandler.Get().ProcessEvents(); if (iDevice.GetKeyState(Tao.Sdl.Sdl.SDLK_ESCAPE)) { gDevice.Quit(); } if (iDevice.GetKeyState(Tao.Sdl.Sdl.SDLK_w)) { camera.Position.x -= gDevice.DeltaTime * 0.01 * Math.Sin(camera.Rotation.y * Math.PI / 180.0); camera.Position.z -= gDevice.DeltaTime * 0.01 * Math.Cos(camera.Rotation.y * Math.PI / 180.0); } if (iDevice.GetKeyState(Tao.Sdl.Sdl.SDLK_s)) { camera.Position.x += gDevice.DeltaTime * 0.01 * Math.Sin(camera.Rotation.y * Math.PI / 180.0); camera.Position.z += gDevice.DeltaTime * 0.01 * Math.Cos(camera.Rotation.y * Math.PI / 180.0); } if (iDevice.GetKeyState(Tao.Sdl.Sdl.SDLK_a)) { camera.Rotation.y += gDevice.DeltaTime * 0.05; } if (iDevice.GetKeyState(Tao.Sdl.Sdl.SDLK_d)) { camera.Rotation.y -= gDevice.DeltaTime * 0.05; } gDevice.BeginRender(); gDevice.SetPerspectiveView(); camera.UpdateCamera(); bspNode.Render(camera.ViewFrustum); gDevice.EndRender(); } }
public void Run() { GDevice gDevice = GDevice.Get(); while (gDevice.IsRunning) { MessageHandler.Get().ProcessEvents(); if (IDevice.Get().GetKeyState(Tao.Sdl.Sdl.SDLK_ESCAPE)) { gDevice.Quit(); } gDevice.BeginRender(); gDevice.SetOrthoView(); boxBackground.Render(); WindowManager.Get().Render(); windowQuit.WindowFont.Render("FPS: " + gDevice.Fps, new Color(255, 255, 255), new Rect(0, 0, 60, 40)); gDevice.EndRender(); } }