root/Code/oMaE/oMaE/Game1.cs @ 10

Revision 10, 3.6 KB (checked in by acarter, 2 years ago)

Added slider and began traffic game

Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using Microsoft.Xna.Framework;
5using Microsoft.Xna.Framework.Audio;
6using Microsoft.Xna.Framework.Content;
7using Microsoft.Xna.Framework.GamerServices;
8using Microsoft.Xna.Framework.Graphics;
9using Microsoft.Xna.Framework.Input;
10using Microsoft.Xna.Framework.Media;
11
12namespace oMaE
13{
14    using MiniGames;
15    using Widgets;
16    /// <summary>
17    /// This is the main type for your game
18    /// </summary>
19    public class Game1 : Microsoft.Xna.Framework.Game
20    {
21        GraphicsDeviceManager graphics;
22        SpriteBatch spriteBatch;
23        GameState gamestate = new GameState();
24        Match match = new Match();
25        FractionalTraffic traffic = new FractionalTraffic();
26        public Game1()
27        {
28            graphics = new GraphicsDeviceManager(this);
29            Content.RootDirectory = "Content";
30        }
31
32        /// <summary>
33        /// Allows the game to perform any initialization it needs to before starting to run.
34        /// This is where it can query for any required services and load any non-graphic
35        /// related content.  Calling base.Initialize will enumerate through any components
36        /// and initialize them as well.
37        /// </summary>
38        protected override void Initialize()
39        {
40            // TODO: Add your initialization logic here
41            this.IsMouseVisible = true;
42            match.Initialize();
43            traffic.Initialize();
44            base.Initialize();
45        }
46
47        /// <summary>
48        /// LoadContent will be called once per game and is the place to load
49        /// all of your content.
50        /// </summary>
51        protected override void LoadContent()
52        {
53            // Create a new SpriteBatch, which can be used to draw textures.
54            spriteBatch = new SpriteBatch(GraphicsDevice);
55            match.LoadContent(Content);
56            traffic.LoadContent(Content);
57            // TODO: use this.Content to load your game content here
58        }
59
60        /// <summary>
61        /// UnloadContent will be called once per game and is the place to unload
62        /// all content.
63        /// </summary>
64        protected override void UnloadContent()
65        {
66            // TODO: Unload any non ContentManager content here
67        }
68
69        /// <summary>
70        /// Allows the game to run logic such as updating the world,
71        /// checking for collisions, gathering input, and playing audio.
72        /// </summary>
73        /// <param name="gameTime">Provides a snapshot of timing values.</param>
74        protected override void Update(GameTime gameTime)
75        {
76            // Allows the game to exit
77            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
78                this.Exit();
79            gamestate.Update(gameTime, Keyboard.GetState(), Mouse.GetState());
80            // TODO: Add your update logic here
81            // match.Update(gamestate);
82            traffic.Update(gamestate);
83            base.Update(gameTime);
84        }
85
86        /// <summary>
87        /// This is called when the game should draw itself.
88        /// </summary>
89        /// <param name="gameTime">Provides a snapshot of timing values.</param>
90        protected override void Draw(GameTime gameTime)
91        {
92            GraphicsDevice.Clear(Color.CornflowerBlue);
93
94            // match.Draw(spriteBatch, gamestate);
95            traffic.Draw(spriteBatch, gamestate);
96            // TODO: Add your drawing code here
97
98            base.Draw(gameTime);
99        }
100    }
101}
Note: See TracBrowser for help on using the browser.