Example #1
0
 public InputManager(Game game)
 {
     keyBindings = new Dictionary<Key, InputAction>();
     keyPressed = new Dictionary<InputAction, Key>();
     game.Keyboard.KeyUp += HandleKeyboardKeyUp;
     game.Keyboard.KeyDown += HandleKeyboardKeyDown;
     this.game = game;
 }
Example #2
0
        public GameSession(Game game)
            : base(game)
        {
            backgroundTexture = new Texture("resources/background.png");
            Texture gameTexture = new Texture("resources/blocks.png");
            Texture[] textures = CreateBlockTextures(gameTexture);
            GameBlock[] regularBlocks = CreateColoredBlocks(textures, regularBlockColors, false);
            GameBlock[] hardBlocks = CreateColoredBlocks(textures, hardBlockColors, true);
            barTexture = gameTexture.Slice(6, 88, 243, 66);
            gameOverTexture = gameTexture.Slice(5, 166, 238, 45);

            leftPane = new GamePane(this, regularBlocks, hardBlocks, 40.0f, 30.0f);
            rightPane = new GamePane(this, regularBlocks, hardBlocks, 430.0f, 30.0f);
            running = true;
        }
Example #3
0
        public MainMenu(Game game)
            : base(game)
        {
            rnd = new Random();
            logo = new Texture("resources/logo.png");
            menuTexture = new Texture("resources/menu.png");
            backgroundTexture = new Texture("resources/background.png");
            backgroundScale = 1.3f;

            menuItems = new List<MainMenuItem>();
            AddMenuItem(0, 0, 235, 36, OnNewGame);
            AddMenuItem(0, 55, 175, 104, null);
            AddMenuItem(0, 112, 134, 151, null);
            AddMenuItem(0, 170, 98, 218, OnQuit);
        }
Example #4
0
        public static void Main(string[] args)
        {
            // TODO: make this intelligent :)
            Directory.SetCurrentDirectory("../../");

            using (Game game = new Game())
                game.Run(60.0);
        }
Example #5
0
 public GameScreen(Game game)
 {
     this.game = game;
 }