Пример #1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         game.Run();
     }
 }
Пример #2
0
        public GameScreen(Game1 game)
        {
            runTimer = true;
            cardsFlipped = 0;
            font = game.Content.Load<SpriteFont>("myFont");

            this.game = game;
            screenWidth = game.GraphicsDevice.Viewport.Width;
            screenHeight = game.GraphicsDevice.Viewport.Height;
            backgroundTexture = game.Content.Load<Texture2D>("background");
            cardBack = game.Content.Load<Texture2D>("mainBack");
            quitButton = game.Content.Load<Texture2D>("quit");
            quitButtonPosition = new Vector2(700, 400);

            quitButtonRectangle = new Rectangle((int)quitButtonPosition.X, (int)quitButtonPosition.Y, quitButton.Width, quitButton.Height);

            deck = new Deck(game);

            cards = deck.getCardsShuffled();

            rectangles = new Rectangle[12] {
                new Rectangle(50, 0, 100, 100),
                new Rectangle(50, 125, 100, 100),
                new Rectangle(50, 250, 100, 100),
                new Rectangle(250, 0, 100, 100),
                new Rectangle(250, 125, 100, 100),
                new Rectangle(250, 250, 100, 100),
                new Rectangle(450, 0, 100, 100),
                new Rectangle(450, 125, 100, 100),
                new Rectangle(450, 250, 100, 100),
                new Rectangle(650, 0, 100, 100),
                new Rectangle(650, 125, 100, 100),
                new Rectangle(650, 250, 100, 100),
                };

            cards[0].setRect(rectangles[0]);
            cards[1].setRect(rectangles[1]);
            cards[2].setRect(rectangles[2]);
            cards[3].setRect(rectangles[3]);
            cards[4].setRect(rectangles[4]);
            cards[5].setRect(rectangles[5]);
            cards[6].setRect(rectangles[6]);
            cards[7].setRect(rectangles[7]);
            cards[8].setRect(rectangles[8]);
            cards[9].setRect(rectangles[9]);
            cards[10].setRect(rectangles[10]);
            cards[11].setRect(rectangles[11]);
        }
Пример #3
0
        public StartScreen(Game1 game)
        {
            this.game = game;
            screenWidth = game.GraphicsDevice.Viewport.Width;
            screenHeight = game.GraphicsDevice.Viewport.Height;

            backgroundTexture = game.Content.Load<Texture2D>("background");

            startButton = game.Content.Load<Texture2D>("startButton");
            startButtonPosition = new Vector2((screenWidth / 2)- 100, 100);

            scoreboardButton = game.Content.Load<Texture2D>("scoreboard");
            scoreboardButtonPosition = new Vector2((screenWidth / 2) - 100, 200);

            startButtonRectangle = new Rectangle((int)startButtonPosition.X, (int)startButtonPosition.Y, startButton.Width, startButton.Height);
            scoreboardButtonRectangle = new Rectangle((int)scoreboardButtonPosition.X, (int)scoreboardButtonPosition.Y, scoreboardButton.Width, scoreboardButton.Height);
        }
        public ScoreboardScreen(Game1 game)
        {
            players = loadPlayers();

            players.Sort(delegate(Player x, Player y)
            {
                return x.time.CompareTo(y.time);
            });

            font = game.Content.Load<SpriteFont>("myFont");
            scoreFont = game.Content.Load<SpriteFont>("scoreFont");

            this.game = game;
            screenWidth = game.GraphicsDevice.Viewport.Width;
            screenHeight = game.GraphicsDevice.Viewport.Height;
            backgroundTexture = game.Content.Load<Texture2D>("background");

            homeButton = game.Content.Load<Texture2D>("home");
            homeButtonPosition = new Vector2(700, 400);
            homeButtonRectangle = new Rectangle((int)homeButtonPosition.X, (int)homeButtonPosition.Y, homeButton.Width, homeButton.Height);
        }