/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { mouseState = Mouse.GetState(); keyboardState = Keyboard.GetState(); if (keyboardState != oldKeyboardState) { //import config-data if (keyboardState.IsKeyDown(Keys.I)) { session.LoadGameValues(); } //reload map/game else if (keyboardState.IsKeyDown(Keys.R)) { session = new Classes.Session(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight); } else if (keyboardState.IsKeyDown(Keys.OemPlus) || keyboardState.IsKeyDown(Keys.Add)) { Globals.tile_stretch_factor++; if (Globals.tile_stretch_factor > 5) { Globals.tile_stretch_factor = 5; } } else if (keyboardState.IsKeyDown(Keys.OemMinus) || keyboardState.IsKeyDown(Keys.Subtract)) { Globals.tile_stretch_factor--; if (Globals.tile_stretch_factor < 1) { Globals.tile_stretch_factor = 1; } } else if (keyboardState.IsKeyDown(Keys.P)) { paused = !paused; session.Pause(); } } oldKeyboardState = keyboardState; oldMouseState = mouseState; if (!paused) { session.Update(keyboardState, mouseState, gameTime); } base.Update(gameTime); }
/// <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() { IsMouseVisible = true; Globals.GraphicsDevice = GraphicsDevice; Globals.primitive = new Texture2D(GraphicsDevice, 1, 1); spriteFont = Content.Load <SpriteFont>("std_font"); Globals.tileMap = Content.Load <Texture2D>("basetiles"); Globals.buttons_medium = Content.Load <Texture2D>("Buttons_Medium_Spritesheet"); Globals.buttons_small = Content.Load <Texture2D>("Buttons_Small_Spritesheet"); borders = Content.Load <Texture2D>("borders"); session = new Classes.Session(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight); session.SerializeBorderTextures(GraphicsDevice, borders); base.Initialize(); }
public Special(HttpClient client, Classes.Session session) { this.client = client; this.session = session; }