public TPSGame() { Window.Title = GAME_TITLE; Content.RootDirectory = "Content"; // Creating and configuring graphics device graphics = new GraphicsDeviceManager(this); GameSettings gameSettings = SettingsManager.Read(Content.RootDirectory + "/" + GameAssetsPath.SETTINGS_PATH + "GameSettings.xml"); ConfigureGraphicsManager(gameSettings); // Input helper inputHelper = new InputHelper(PlayerIndex.One, SettingsManager.GetKeyboardDictionary(gameSettings.KeyboardSettings[0])); Services.AddService(typeof(InputHelper), inputHelper); // Game Screen Components.Add(new GameScreen(this, LevelCreator.Levels.Forest)); }
public override void Initialize() { // Frame counter frameCounter = new FrameCounterHelper(Game); XYCurs = new Vector2(200, 200); firePos = Vector3.Zero; firePos2 = Vector3.Zero; resolution.X = 800; resolution.Y = 600; cursorPosition.X = resolution.X / 2; cursorPosition.Y = resolution.Y / 2; cursorPosition.Z = 0; // Get services inputHelper = Game.Services.GetService(typeof(InputHelper)) as InputHelper; if (inputHelper == null) throw new InvalidOperationException("Cannot find an input service"); base.Initialize(); }