public static async Task Main() { Console.Title = _seconds.ToString(); _world = new SampleWorld(200, 40, 80, 20); _game = new Game(120, 30); _game.OnRedraw += OnRedraw; _game.OnTick += OnTick; _game.OnKeyAvailable += OnKeyAvailable; _game.Initialize(); await _game.Run(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { GraphicsDevice.Viewport = new Viewport(0, 0, 500, 500); viewport = new BoxingViewportAdapter(Window, GraphicsDevice, 500, 500, 0, 0); spriteBatch = new SpriteBatch(GraphicsDevice); var gameObject = new SampleGameObject(Content, spriteBatch, GraphicsDevice, viewport); InitializeInput(gameObject); world = new SampleWorld(gameObject); world.AddScene("start", new StartScene()); world.AddScene("main", new MainScene()); base.Initialize(); world.Initialize(); world.Switch("start"); }