Beispiel #1
0
        // draw 2D gui
        public override void Draw2D(GraphicsDevice gd, FontManager font)
        {
            if (gd == null)
            {
                throw new ArgumentNullException("gd");
            }

            Rectangle rect = new Rectangle(0, 0, 0, 0);

            int screenSizeX = gd.Viewport.Width;
            int screenSizeY = gd.Viewport.Height;

            // draw continue message
            rect.Width  = textureContinue.Width;
            rect.Height = textureContinue.Height;
            rect.Y      = screenSizeY - rect.Height - 60;
            rect.X      = screenSizeX / 2 - rect.Width / 2;
            screenManager.DrawTexture(textureContinue, rect,
                                      Color.White, BlendState.AlphaBlend);

            // deaw winning player number
            rect.Width  = texturePlayerWin.Width;
            rect.Height = texturePlayerWin.Height;
            rect.Y      = 20;
            rect.X      = screenSizeX / 2 - rect.Width / 2;
            screenManager.DrawTexture(texturePlayerWin, rect,
                                      Color.White, BlendState.AlphaBlend);
        }
Beispiel #2
0
        // draw the animated cursor
        void DrawCursor(int x, int y)
        {
            Rectangle rect = new Rectangle(0, 0, 0, 0);

            float rotation = menuTime * 2;

            // draw animated cursor texture
            rect.X      = x - textureCursorAnim.Width / 2;
            rect.Y      = y - textureCursorAnim.Height / 2;
            rect.Width  = textureCursorAnim.Width;
            rect.Height = textureCursorAnim.Height;
            screenManager.DrawTexture(textureCursorAnim, rect, rotation,
                                      Color.White, BlendState.AlphaBlend);

            // draw bullet cursor texture
            rect.X      = x - textureCursorBullet.Width / 2;
            rect.Y      = y - textureCursorBullet.Height / 2;
            rect.Width  = textureCursorBullet.Width;
            rect.Height = textureCursorBullet.Height;
            screenManager.DrawTexture(textureCursorBullet, rect,
                                      Color.White, BlendState.AlphaBlend);

            // draw arrow cursor texture
            rect.X      = x - textureCursorArrow.Width / 2 + 32;
            rect.Y      = y - textureCursorArrow.Height / 2;
            rect.Width  = textureCursorArrow.Width;
            rect.Height = textureCursorArrow.Height;
            screenManager.DrawTexture(textureCursorArrow, rect,
                                      Color.White, BlendState.AlphaBlend);
        }
        public override void Draw2D(GraphicsDevice gd, FontManager font)
        {
            if (gd == null)
            {
                throw new ArgumentNullException("gd");
            }

            int screenSizeX = gd.Viewport.Width;
            int screenSizeY = gd.Viewport.Height;

            Rectangle rect = new Rectangle(0, 0, 0, 0);

            // draw level screen shot
            rect.Width  = levelShots[selection].Width;
            rect.Height = levelShots[selection].Height;
            rect.X      = (screenSizeX - rect.Width) / 2;
            rect.Y      = (screenSizeY - rect.Height) / 2 + 30;
            screenManager.DrawTexture(levelShots[selection], rect,
                                      Color.White, BlendState.AlphaBlend);

            // draw back and select buttons
            rect.Width  = selectBack.Width;
            rect.Height = selectBack.Height;
            rect.X      = (screenSizeX - rect.Width) / 2;
            rect.Y      = 30;
            screenManager.DrawTexture(selectBack, rect,
                                      Color.White, BlendState.AlphaBlend);

            // draw change level text
            rect.Width  = changeLevel.Width;
            rect.Height = changeLevel.Height;
            rect.X      = (screenSizeX - rect.Width) / 2;
            rect.Y      = screenSizeY - rect.Height - 30;
            screenManager.DrawTexture(changeLevel, rect,
                                      Color.White, BlendState.AlphaBlend);
        }
Beispiel #4
0
        // draw 2D gui
        public override void Draw2D(GraphicsDevice gd, FontManager font)
        {
            if (gd == null)
            {
                throw new ArgumentNullException("gd");
            }

            Rectangle rect = new Rectangle(0, 0, 0, 0);

            int screenSizeX = gd.Viewport.Width;
            int screenSizeY = gd.Viewport.Height;

            // draw controlls text aligned to top of screen
            rect.Width  = textureControls.Width;
            rect.Height = textureControls.Height;
            rect.X      = screenSizeX / 2 - rect.Width / 2;
            rect.Y      = 40;
            screenManager.DrawTexture(textureControls, rect,
                                      Color.White, BlendState.AlphaBlend);

            // draw controller texture centered in screen
            rect.Width  = textureDisplay.Width;
            rect.Height = textureDisplay.Height;
            rect.X      = screenSizeX / 2 - rect.Width / 2;
            rect.Y      = screenSizeY / 2 - rect.Height / 2 + 10;
            screenManager.DrawTexture(textureDisplay, rect,
                                      Color.White, BlendState.AlphaBlend);

            // draw continue message aligned to bottom of screen
            rect.Width  = textureContinue.Width;
            rect.Height = textureContinue.Height;
            rect.X      = screenSizeX / 2 - rect.Width / 2;
            rect.Y      = screenSizeY - rect.Height - 60;
            screenManager.DrawTexture(textureContinue, rect,
                                      Color.White, BlendState.AlphaBlend);
        }
Beispiel #5
0
        public override void Draw2D(GraphicsDevice gd, FontManager font)
        {
            if (gd == null)
            {
                throw new ArgumentNullException("gd");
            }

            Rectangle rect = new Rectangle(0, 0, 0, 0);

            int screenSizeX = gd.Viewport.Width;
            int screenSizeY = gd.Viewport.Height;

            // if single player mode
            if (gameManager.GameMode == GameMode.SinglePlayer)
            {
                rect.Width  = textureSelectBack.Width;
                rect.Height = textureSelectBack.Height;
                rect.X      = screenSizeX / 2 - rect.Width / 2;
                rect.Y      = 50;
                if (confirmed[0])
                {
                    rect.Width  = textureSelectCancel.Width;
                    rect.Height = textureSelectCancel.Height;
                    screenManager.DrawTexture(textureSelectCancel, rect,
                                              Color.White, BlendState.AlphaBlend);
                }
                else
                {
                    screenManager.DrawTexture(textureSelectBack, rect,
                                              Color.White, BlendState.AlphaBlend);
                }

                rect.Width  = textureInvertYCheck.Width;
                rect.Height = textureInvertYCheck.Height;
                rect.Y      = screenSizeY - rect.Height - 30;
                rect.X      = screenSizeX / 2 - rect.Width / 2;
                if ((invertY & 1) == 0)
                {
                    screenManager.DrawTexture(textureInvertYUncheck, rect,
                                              Color.White, BlendState.AlphaBlend);
                }
                else
                {
                    screenManager.DrawTexture(textureInvertYCheck, rect,
                                              Color.White, BlendState.AlphaBlend);
                }

                rect.Width  = textureChangeShip.Width;
                rect.Height = textureChangeShip.Height;
                rect.X      = screenSizeX / 5 - rect.Width / 2;
                rect.Y      = 60;
                screenManager.DrawTexture(textureChangeShip, rect,
                                          Color.White, BlendState.AlphaBlend);

                rect.Width  = textureRotateShip.Width;
                rect.Height = textureRotateShip.Height;
                rect.X      = screenSizeX * 4 / 5 - rect.Width / 2;
                rect.Y      = 60;
                screenManager.DrawTexture(textureRotateShip, rect,
                                          Color.White, BlendState.AlphaBlend);
            }
            else // if multi player mode
            {
                rect.Width  = textureChangeShip.Width;
                rect.Height = textureChangeShip.Height;
                rect.X      = (screenSizeX - rect.Width) / 2;
                rect.Y      = 40;
                screenManager.DrawTexture(textureChangeShip, rect,
                                          Color.White, BlendState.AlphaBlend);

                rect.Width  = textureRotateShip.Width;
                rect.Height = textureRotateShip.Height;
                rect.X      = (screenSizeX - rect.Width) / 2;
                rect.Y      = 40 + textureChangeShip.Height;
                screenManager.DrawTexture(textureRotateShip, rect,
                                          Color.White, BlendState.AlphaBlend);

                rect.Width  = textureInvertYCheck.Width;
                rect.Height = textureInvertYCheck.Height;
                rect.Y      = screenSizeY - rect.Height - 30;
                rect.X      = screenSizeX / 4 - rect.Width / 2;
                if ((invertY & 1) == 0)
                {
                    screenManager.DrawTexture(textureInvertYUncheck, rect,
                                              Color.White, BlendState.AlphaBlend);
                }
                else
                {
                    screenManager.DrawTexture(textureInvertYCheck, rect,
                                              Color.White, BlendState.AlphaBlend);
                }
                rect.X = screenSizeX * 3 / 4 - rect.Width / 2;
                if ((invertY & 2) == 0)
                {
                    screenManager.DrawTexture(textureInvertYUncheck, rect,
                                              Color.White, BlendState.AlphaBlend);
                }
                else
                {
                    screenManager.DrawTexture(textureInvertYCheck, rect,
                                              Color.White, BlendState.AlphaBlend);
                }

                rect.Width  = textureSelectBack.Width;
                rect.Height = textureSelectBack.Height;
                rect.X      = screenSizeX / 8 - rect.Width / 2;
                rect.Y      = 40;
                if (confirmed[0])
                {
                    rect.Width  = textureSelectCancel.Width;
                    rect.Height = textureSelectCancel.Height;
                    screenManager.DrawTexture(textureSelectCancel, rect,
                                              Color.White, BlendState.AlphaBlend);
                }
                else
                {
                    screenManager.DrawTexture(textureSelectBack, rect,
                                              Color.White, BlendState.AlphaBlend);
                }
                rect.Width  = textureSelectBack.Width;
                rect.Height = textureSelectBack.Height;
                rect.X      = screenSizeX * 7 / 8 - rect.Width / 2;
                rect.Y      = 40;
                if (confirmed[1])
                {
                    rect.Width  = textureSelectCancel.Width;
                    rect.Height = textureSelectCancel.Height;
                    screenManager.DrawTexture(textureSelectCancel, rect,
                                              Color.White, BlendState.AlphaBlend);
                }
                else
                {
                    screenManager.DrawTexture(textureSelectBack, rect,
                                              Color.White, BlendState.AlphaBlend);
                }
            }
        }