コード例 #1
0
        public SettlersOfCatan()
        {
            gameType = "BaseGame";

            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            graphics.IsFullScreen = fullscreen;
            graphics.PreferredBackBufferHeight = height;
            graphics.PreferredBackBufferWidth = width;

            input = new InputHandler(this);
            Components.Add(input);

            camera = new Camera(this);
            Components.Add(camera);
            camera.UpdateInput = false;

            gameManager = new GameStateManager(this);
            Components.Add(gameManager);

            //Components.Add(new GamerServicesComponent(this));

            //TitleIntroState = new TitleIntroState(this);
            StartMenuState = new StartMenuState(this);
            PlayingState = new PlayingState(this);
            FinishedState = new FinishedState(this);

            gameManager.ChangeState(StartMenuState.Value);

            #if DEBUG
            fps = new FrameRate(this);
            #else
            fps = new FrameRate(this, true, false);
            #endif
            Components.Add(fps);
        }
コード例 #2
0
        //Purpose: sets the graphics and then calls the methods to draw everything gameboard related
        private void DrawScene(GameTime gameTime, Camera camera)
        {
            GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;
            GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            GraphicsDevice.BlendState = BlendState.AlphaBlend;

            effect.Projection = camera.Projection;
            effect.View = camera.View;

            effect.EnableDefaultLighting();

            ourGame.SpriteBatch.Begin();
            DrawBoard();
            DrawPorts();
            DrawRoads();
            DrawRoadsCanBuild();
            DrawSettlements();
            DrawSettlementsCanBuild();
            ourGame.SpriteBatch.End();
        }
コード例 #3
0
        // Method to draw the board and sprites, probably will want to separate out the sprite drawing to make
        // this cleaner, but for now it works
        private void DrawScene(GameTime gameTime, Camera camera)
        {
            ourGame.SpriteBatch.Begin();
            ourGame.SpriteBatch.Draw(backgroundTexture, screenRectangle, Color.White);
            ourGame.SpriteBatch.End();

            GraphicsDevice.RasterizerState = RasterizerState.CullClockwise;
            GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            GraphicsDevice.BlendState = BlendState.AlphaBlend;

            effect.Projection = camera.Projection;
            effect.View = camera.View;

            effect.EnableDefaultLighting();
            Matrix world = new Matrix();
            DrawBoard(ref world);

            Vector3 housePosition = new Vector3(-88, 20, 1);

            basicEffect.World = Matrix.CreateScale( 0.5f ) * Matrix.CreateScale(1, -1, 1) * Matrix.CreateTranslation(housePosition);
            basicEffect.View = ourGame.camera.View;
            basicEffect.Projection = ourGame.camera.Projection;

            ourGame.SpriteBatch.Begin(0, BlendState.AlphaBlend, null, DepthStencilState.Default, RasterizerState.CullNone, basicEffect);
            ourGame.SpriteBatch.Draw(orangeSettlement, new Rectangle(0, 0, 75, 75), Color.White);
            ourGame.SpriteBatch.End();
        }