Exemple #1
0
        protected void LoadContent()
        {
            //Load fonts
            SmartFont[] fonts = new SmartFont[100];
            fonts[16] = fontFactory.LoadFont("Consolas", 16f).Load();
            //fonts[32] = fontFactory.LoadFont("Consolas", 32f).Load();
            //fonts[72] = fontFactory.LoadFont("LemonMilk", 72f).Load();

            TextureLib textures = new TextureLib(GraphicsDevice, contentManager);

            //Load textures
            textures.LoadTexture("pixel");
            textures.LoadTexture("board");
            textures.LoadTexture("boardBevel");
            textures.LoadTexture("marbleTable");

            textures.LoadTexture("title");
            textures.LoadTexture("play");
            textures.LoadTexture("singleplayer");
            textures.LoadTexture("singleplayerBig");
            textures.LoadTexture("multiplayer");
            textures.LoadTexture("howtoplay");
            textures.LoadTexture("options");
            textures.LoadTexture("about");
            textures.LoadTexture("goback");
            textures.LoadTexture("gamesetup");
            textures.LoadTexture("human");
            textures.LoadTexture("computer");

            textures.LoadTexture("indentBlue");
            textures.LoadTexture("indentBrown");
            textures.LoadTexture("indentGreen");
            textures.LoadTexture("indentRed");
            textures.LoadTexture("indentYellow");

            textures.LoadTexture("blueMarble");
            textures.LoadTexture("greenMarble");
            textures.LoadTexture("redMarble");
            textures.LoadTexture("yellowMarble");

            content = new GameContent(textures, fonts);

            board     = new Board();
            boardView = new BoardView(board, Size);
            boardView.AnalysisView = this.AnalysisView;
            boardView.NotationView = this.NotationPane;

            boardView.LoadContent(Device, Content);


            Player[] players = new Player[4];
            players[0] = new ComputerPlayer(0, Personality.Adaptive, ComputerPlayer.Difficulties[9], boardView);
            players[1] = new ComputerPlayer(1, Personality.Aggressive, ComputerPlayer.Difficulties[9], boardView);
            players[2] = new ComputerPlayer(2, Personality.Active, ComputerPlayer.Difficulties[9], boardView);
            players[3] = new ComputerPlayer(3, Personality.Passive, ComputerPlayer.Difficulties[9], boardView);

            boardView.SetPlayers(players);
            boardView.Playing = true;
        }
 public void Draw(SpriteBatch batch, GameContent content)
 {
     if (!IsMouseOver)
     {
         batch.Draw(Sprites[SelectionIndex], Position, Color.White);
     }
     else
     {
         batch.Draw(Sprites[SelectionIndex], Position, Sprites[SelectionIndex].Bounds, Color.White, 0, Vector2.Zero, 1.15f, SpriteEffects.None, 1);
     }
 }
Exemple #3
0
        public override void Load(GameContent content)
        {
            AddDrawable((bg = new Sprite(content.Textures["board"], engine.Window.ClientBounds)));
            AddDrawable((titleLabel = new Sprite(content.Textures["title"], new Vector2(10, 20))));

            AddObject((playBtn = new Button(engine, content.Textures["play"], new Vector2(10, 155), ButtonAnimation.None, engine.GetGameState("singleplayer"))));
            AddObject((multiplayerBtn = new Button(engine, content.Textures["multiplayer"], new Vector2(10, 225), ButtonAnimation.None)));
            AddObject((howtoplayBtn = new Button(engine, content.Textures["howtoplay"], new Vector2(10, 295), ButtonAnimation.None)));
            AddObject((optionsBtn = new Button(engine, content.Textures["options"], new Vector2(10, 365), ButtonAnimation.None)));
            AddObject((aboutBtn = new Button(engine, content.Textures["about"], new Vector2(10, 435), ButtonAnimation.None)));
        }
Exemple #4
0
        public override void Load(GameContent content)
        {
            const int margin    = 45;
            Rectangle boardRect = new Rectangle(margin, margin, engine.Window.ClientBounds.Width - (margin * 2) - 20, engine.Window.ClientBounds.Height - (margin * 2) - 20);

            AddDrawable((bgMarble = new Sprite(content.Textures["marbleTable"], engine.Window.ClientBounds)));
            AddDrawable((bg = new Sprite(content.Textures["board"], boardRect)));

            board     = new Board();
            boardView = new BoardView(board, boardRect);
            boardView.LoadContent(engine.GraphicsDevice, engine.Content);

            AddObject(boardView);
            AddRenderable(boardView);
        }
        public override void Load(GameContent content)
        {
            AddDrawable((bg = new Sprite(content.Textures["board"], engine.Window.ClientBounds)));
            AddDrawable((title = new Sprite(content.Textures["gamesetup"], new Vector2(10, 10))));

            AddDrawable((yellowMarble = new Sprite(content.Textures["yellowMarble"], new Rectangle(10, 100, 36, 36))));
            AddDrawable((redMarble = new Sprite(content.Textures["redMarble"], new Rectangle(10, 200, 36, 36))));
            AddDrawable((greenMarble = new Sprite(content.Textures["greenMarble"], new Rectangle(10, 300, 36, 36))));
            AddDrawable((blueMarble = new Sprite(content.Textures["blueMarble"], new Rectangle(10, 400, 36, 36))));

            AddObject((toggleButtonP1 = new ToggleButton(new Texture2D[] { content.Textures["human"], content.Textures["computer"] }, new Vector2(50, 100))));
            AddObject((toggleButtonP2 = new ToggleButton(new Texture2D[] { content.Textures["human"], content.Textures["computer"] }, new Vector2(50, 200))));
            AddObject((toggleButtonP3 = new ToggleButton(new Texture2D[] { content.Textures["human"], content.Textures["computer"] }, new Vector2(50, 300))));
            AddObject((toggleButtonP4 = new ToggleButton(new Texture2D[] { content.Textures["human"], content.Textures["computer"] }, new Vector2(50, 400))));

            AddObject((play = new Button(engine, content.Textures["play"], new Vector2(575, 665), ButtonAnimation.None, TargetScopeStartGame)));
            AddObject((back = new Button(engine, content.Textures["goback"], new Vector2(10, 665), ButtonAnimation.None, engine.GetPrevious)));
        }
Exemple #6
0
        /// <summary>
        /// Draws the board
        /// </summary>
        /// <param name="batch">SpriteBatch</param>
        /// <param name="textures">Texture Library</param>
        public void Draw(SpriteBatch batch, GameContent content)
        {
            DrawBoard(batch, content.Textures);
            DrawMarbles(batch, content.Textures);

            for (int l = 0; l < guiLines.Count; l++)
            {
                guiLines[l].Draw(batch, content.Textures);
            }

            if (currentAnimation != null)
            {
                currentAnimation.Draw(batch, content.Textures);
            }

            if (currentDrag != null)
            {
                currentDrag.Draw(batch, content.Textures);
            }
        }
 public void Draw(SpriteBatch batch, GameContent content)
 {
     batch.Draw(Texture, BoundingBox, Color.White);
 }
 public abstract void Load(GameContent content);
Exemple #9
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            fontFactory = new FontFactory(GraphicsDevice);

            //Load fonts
            SmartFont[] fonts = new SmartFont[100];
            fonts[16] = fontFactory.LoadFont("Consolas", 16f).Load();
            //fonts[32] = fontFactory.LoadFont("Consolas", 32f).Load();
            //fonts[72] = fontFactory.LoadFont("LemonMilk", 72f).Load();

            TextureLib textures = new TextureLib(Content);

            //Load textures
            textures.LoadTexture("board");
            textures.LoadTexture("boardBevel");
            textures.LoadTexture("marbleTable");

            textures.LoadTexture("title");
            textures.LoadTexture("play");
            textures.LoadTexture("singleplayer");
            textures.LoadTexture("singleplayerBig");
            textures.LoadTexture("multiplayer");
            textures.LoadTexture("howtoplay");
            textures.LoadTexture("options");
            textures.LoadTexture("about");
            textures.LoadTexture("goback");
            textures.LoadTexture("gamesetup");
            textures.LoadTexture("human");
            textures.LoadTexture("computer");

            textures.LoadTexture("indentBlue");
            textures.LoadTexture("indentBrown");
            textures.LoadTexture("indentGreen");
            textures.LoadTexture("indentRed");
            textures.LoadTexture("indentYellow");

            textures.LoadTexture("blueMarble");
            textures.LoadTexture("greenMarble");
            textures.LoadTexture("redMarble");
            textures.LoadTexture("yellowMarble");

            content = new GameContent(textures, fonts);

            MainMenu mainMenu = new MainMenu(this);

            gameStates.Add("mainmenu", mainMenu);

            Singleplayer singleplayer = new Singleplayer(this);

            gameStates.Add("singleplayer", singleplayer);

            Gameplay gameplay = new Gameplay(this);

            gameStates.Add("gameplay", gameplay);

            mainMenu.Load(content);
            singleplayer.Load(content);
            gameplay.Load(content);

            currentGameState = mainMenu;
        }