Example #1
0
        public View(GameState model, ContentManager content, GraphicsDevice graphics)
        {
            this.model = model;
            this.content = content;
            this.graphics = graphics;
            this.model.StateChanged += new ChangedEventHandler( StateChanged );

            posVec4 = new Vector2(graphics.Viewport.Width - 600, graphics.Viewport.Height - 350);
            posVec3 = new Vector2(graphics.Viewport.Width - 300, graphics.Viewport.Height - 350);
            posVec2 = new Vector2(graphics.Viewport.Width - 575, graphics.Viewport.Height - 300);
            posVec1 = new Vector2(graphics.Viewport.Width - 275, graphics.Viewport.Height - 300);

            sizeVec2 = new Vector2(200, 40);
            sizeVec1 = new Vector2(150, 150);
        }
Example #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            myBackground = new ScrollingBackground();

            //GUI
            gameState = new GameState(this);
             //Adds this as listener to menu model: gameState
            gameState.StateChanged += new ChangedEventHandler( StateChanged );

            view = new View(gameState, this.Content, this.GraphicsDevice);
            view.Load();

            // TODO: use this.Content to load your game content here

            this.menuInputController = new MenuInputController(PlayerIndex.One,
                new Keys[] {
                    Keys.Left,
                    Keys.Right,
                    Keys.Up,
                    Keys.Down,
                    Keys.N,
                    Keys.M,
                    Keys.Escape
                }, gameState);
            this.menuInputController2 = new MenuInputController(PlayerIndex.Two,
                new Keys[] {
                    Keys.A,
                    Keys.D,
                    Keys.W,
                    Keys.S,
                    Keys.Tab,
                    Keys.Q,
                    Keys.Escape
                }, gameState);
        }
Example #3
0
 public MenuInputController(PlayerIndex playerIndex, Keys[] keyMapping, GameState gameState)
     : base(playerIndex, keyMapping)
 {
     this.playerIndex = playerIndex;
     this.gameState = gameState;
 }