using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Input; namespace MonoGameCommunity.Wiki.Samples { public class SampleGame : Game { private static readonly Color Ink = new Color(13, 17, 23); private static readonly Color Cyan = new Color(77, 225, 255); private Color _background = Color.CornflowerBlue; public SampleGame() { Content.RootDirectory = "Content"; } protected override void Update(GameTime gameTime) { if (Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } var seconds = (int)gameTime.TotalGameTime.TotalSeconds; _background = (seconds % 2 == 0) ? Ink : Cyan; base.Update(gameTime); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(_background); base.Draw(gameTime); } } }