void Run(string[] args) { using (AgateSetup setup = new AgateSetup(args)) { setup.Initialize(true, false, false); if (setup.WasCanceled) { return; } DisplayWindow wind = DisplayWindow.CreateWindowed ("Pong Example", displayWidth, displayHeight); font = new FontSurface("Sans Serif", 14); paddle[0] = new Vector2(50, displayHeight / 2); paddle[1] = new Vector2(playAreaWidth - 50 - paddleWidth, displayHeight / 2); ball = new Vector2(playAreaWidth / 2, displayHeight / 2); ballvelocity = new Vector2(-70, 70); while (wind.IsClosed == false) { Display.BeginFrame(); Display.Clear(Color.DarkGray); DrawBorder(); DrawPaddles(); DrawBall(); DrawScore(); Display.EndFrame(); Core.KeepAlive(); if (Keyboard.Keys[KeyCode.Escape]) { wind.Dispose(); } float time_s = (float)Display.DeltaTime / 1000.0f; UpdatePaddles(time_s); UpdateBall(time_s); } } }
public void Clear() { Display.Clear(new Color(0, 0, 0)); }