Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GameOverScreen"/> class.
        /// </summary>
        public GameOverScreen(uint score)
            : base()
        {
            this.score = score;
            this.actionAvailableTime = DateTime.Now.Ticks + 30000000;
            GameClock.Pause();

            this.textDrawPosition  = new Vector2(0, -125);
            this.textDrawOrigin    = FontStatic.Get("defaultFont").MeasureString("Game Over") / 2f;
            this.scoreLogoPosition = new Vector2(0, -20f);
            this.scoreLogoOrigin   = FontStatic.Get("defaultFont").MeasureString("Score") / 2f;
            this.scorePosition     = new Vector2(0, 50f);
            this.scoreOrigin       = FontStatic.Get("defaultFont").MeasureString(Drawer.FormatNumber(this.score)) / 2f;
            this.aButtonPosition   = new Vector2(-240f, 150f);
            this.bButtonPosition   = new Vector2(100f, 150f);
            this.actionXOffset     = new Vector2(50f, 0);
            this.buttonOrigin      = FontStatic.Get("ControllerFont").MeasureString(")") / 2f;
            this.aActionOrigin     = new Vector2(0, FontStatic.Get("defaultFont").MeasureString("Replay").Y / 2);
            this.bActionOrigin     = new Vector2(0, FontStatic.Get("defaultFont").MeasureString("Quit").Y / 2);
            this.buttonColor       = Color.Transparent;

            this.position = new tVector2(1920f / 2f - 2000f, 1080f / 2f);
            this.position.GoTo(1920f / 2f, 1080f / 2f, 0.3f, true);
            this.background = new HypercubeDisplay(
                new Rectangle((int)(this.position.Value.X - 685f / 2f) - 3, (int)(this.position.Value.Y - 370f / 2f) - 3, 685 + 6, 370 + 6),
                3,
                this.random,
                0.2f);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="StartScreen"/> class.
 /// </summary>
 public StartScreen()
     : base()
 {
     this.pressStartLocation = new Vector2(1920 / 2, 1080 / 2);
     this.pressStartOrigin   = FontStatic.Get("defaultFont").MeasureString("Press Start") / 2f;
     this.FadingOut          = true;
 }
 public void Draw()
 {
     Drawer.Draw(
         TextureStatic.Get("background"),
         Drawer.FullScreenRectangle,
         null,
         Color.White,
         0f,
         Vector2.Zero,
         SpriteEffects.None,
         0f);
     Drawer.DrawString(
         FontStatic.Get("defaultFont"),
         "Score: " + ScoreKeeper.score.ToString(),
         new Vector2(205, 205),
         Color.White,
         0f,
         Vector2.Zero,
         0.4f,
         SpriteEffects.None,
         1f
         );
     foreach (Entity e in m_Entities.Values)
     {
         e.Draw();
     }
 }
Beispiel #4
0
        /// <summary>
        /// Draws this instance.
        /// </summary>
        public override void Draw()
        {
            // Write "Paused" at the top-center of the background.
            Drawer.DrawOutlinedString(
                FontStatic.Get("defaultFont"),
                "Paused",
                this.position.Value + this.textDrawPosition,
                Color.White,
                0f,
                this.textDrawOrigin,
                1.2f,
                SpriteEffects.None,
                0.99f);

            // Draw the frame
            Drawer.Draw(
                TextureStatic.Get("BoxArtHolder"),
                this.position.Value,
                null,
                Color.White,
                0f,
                TextureStatic.GetOrigin("BoxArtHolder"),
                1f,
                SpriteEffects.None,
                0.3f);

            if (DateTime.Now.Ticks > this.drawLagTime)
            {
                this.menu.Draw();
            }

            this.background.Draw();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ScoreboardDisplay"/> class.
        /// </summary>
        /// <param name="screen">The screen.</param>
        /// <param name="textDrawLocation">The text draw location.</param>
        /// <param name="rectangleDrawLocation">The rectangle draw location.</param>
        public ScoreboardDisplay(Screen screen, Vector2 textDrawLocation, Vector2 rectangleDrawLocation)
        {
            this.textDrawLocation       = textDrawLocation;
            this.nameDrawLocation       = textDrawLocation + new Vector2(270, 0);
            this.scoreDrawLocation      = nameDrawLocation + new Vector2(1150, 0);
            this.highScoresLogoLocation = rectangleDrawLocation + new Vector2(-310, 0);
            this.highScoresLogoOrigin   = FontStatic.Get("defaultFont").MeasureString("High Scores") / 2f;
            this.verticleSpacing        = 100;
            this.rectangleDrawLocation  = rectangleDrawLocation;
            this.scrollableRectangle    = new Viewport(
                (int)((rectangleDrawLocation.X - 685 / 2f) * Drawer.GetRatio()),
                (int)((rectangleDrawLocation.Y - 370 / 2f) * Drawer.GetRatio()),
                (int)(685 * Drawer.GetRatio()),
                (int)(370 * Drawer.GetRatio()));
            this.scoreOffset             = Vector2.Zero;
            this.scoreOffsetAcceloration = 0;
            this.scoreOffsetVelocity     = 0;
            this.previousHighlighted     = -1;
            this.noScoresHavePosition    = rectangleDrawLocation + new Vector2(0, -40f);
            this.noScoresHaveOrigin      = FontStatic.Get("defaultFont").MeasureString("No scores have") / 2f;
            this.beenRecordedPosition    = rectangleDrawLocation + new Vector2(0, 40f);
            this.beenRecoredOrigin       = FontStatic.Get("defaultFont").MeasureString("been recorded.") / 2f;

            this.background = new HypercubeDisplay(
                new Rectangle((int)(rectangleDrawLocation.X - 685f / 2f) - 3, (int)(rectangleDrawLocation.Y - 370f / 2f) - 3, 685 + 6, 370 + 6),
                3,
                screen.random,
                0.91f);
        }
        public override void Draw()
        {
            base.Draw();

            // Write "Super Power Robots" at the top-center of the background.
            Drawer.DrawOutlinedString(
                FontStatic.Get("defaultFont"),
                "",
                this.position.Value + this.textDrawPosition,
                Color.White,
                0f,
                this.textDrawOrigin,
                1f,
                SpriteEffects.None,
                0.99f);

            // Draw the frame
            Drawer.Draw(
                TextureStatic.Get("BoxArtHolder"),
                this.position.Value,
                null,
                Color.White,
                0f,
                TextureStatic.GetOrigin("BoxArtHolder"),
                1f,
                SpriteEffects.None,
                0.3f);

            this.menu.Draw();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="VolumeControlDisplayEntry"/> class.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <param name="description">The description.</param>
        /// <param name="actions">The actions.</param>
        /// <param name="position">The position.</param>
        /// <param name="numberDisplayPosition">The number display position.</param>
        /// <param name="scale">The scale of the largest number.</param>
        /// <param name="numberLayerDepth">The number layer depth.</param>
        /// <param name="musicVolume">Is this for music volume? Else, sound volume.</param>
        /// <param name="ignoreOffsetPosition">if set to <c>true</c> [ignore offset position].</param>
        public VolumeControlDisplayEntry(
            string text,
            string description,
            MenuAction[] actions,
            Vector2 position,
            Vector2 numberDisplayPosition,
            float scale,
            float numberLayerDepth,
            bool musicVolume,
            bool ignoreOffsetPosition)
            : base(text, description, actions, position)
        {
            this.displayPosition      = numberDisplayPosition;
            this.scale                = scale;
            this.numberLayerDepth     = numberLayerDepth;
            this.musicVolume          = musicVolume;
            this.ignoreOffsetPosition = ignoreOffsetPosition;
            this.previouslyHighlighed = false;
            this.positions            = new List <tVector2>();
            this.scales               = new List <tfloat>();
            for (int i = 0; i <= 10; i++)
            {
                this.positions.Add(new tVector2(numberDisplayPosition.X, numberDisplayPosition.Y));
                this.scales.Add(new tfloat(0));
            }

            this.origins = new List <Vector2>();
            for (int i = 0; i <= 10; i++)
            {
                this.origins.Add(FontStatic.Get("defaultFont").MeasureString(i.ToString()) / 2f);
            }
        }
Beispiel #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MenuEntry"/> class.
 /// </summary>
 /// <param name="text">The text to display.</param>
 /// <param name="actions">The this.actions associated with this menu entry. For example,
 /// one action might be pressing "A" to select the entry. Adding
 /// an action of Left, Right, Up, or Down will overwrite the
 /// menu entry navigation.</param>
 /// <param name="position">The this.position of the image.</param>
 public MenuEntry(string text, MenuAction[] actions, Vector2 position)
 {
     this.text       = text;
     this.actions    = actions;
     this.layerDepth = 1;
     this.position   = position;
     this.origin     = FontStatic.Get("defaultFont").MeasureString(text) / 2f;
 }
Beispiel #9
0
        /// <summary>
        /// Draws this instance.
        /// </summary>
        public override void Draw()
        {
            base.Draw();

            this.background.Draw();
            Drawer.Draw(
                TextureStatic.Get("instructionBorder"),
                this.position.Value,
                null,
                Color.White,
                0f,
                TextureStatic.GetOrigin("instructionBorder"),
                1f,
                SpriteEffects.None,
                0.3f);

            if (this.viewport.Width > 0)
            {
                GameWorld.spriteBatch.End();
                Viewport previousViewport = GameWorld.spriteBatch.GraphicsDevice.Viewport;
                GameWorld.spriteBatch.GraphicsDevice.Viewport = this.viewport;
                GameWorld.spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend);

                Drawer.DrawOutlinedString(
                    FontStatic.Get("defaultFont"),
                    "Credits",
                    this.position.Value + this.scrollPosition.Value,
                    Color.White,
                    0f,
                    this.titleOrigin,
                    1.3f,
                    SpriteEffects.None,
                    0.8f);
                for (int i = 0; i < this.display.Count; i++)
                {
                    // Only draw if it is going to be on the screen...
                    Vector2 temp = this.position.Value + this.scrollPosition.Value + this.verticleSpacing[i];
                    if (temp.Y > -300 && temp.Y < 2220)
                    {
                        Drawer.DrawOutlinedString(
                            FontStatic.Get("defaultFont"),
                            this.display[i],
                            temp,
                            Color.White,
                            0f,
                            Vector2.Zero,
                            1f,
                            SpriteEffects.None,
                            0.8f);
                    }
                }

                GameWorld.spriteBatch.End();
                GameWorld.spriteBatch.GraphicsDevice.Viewport = previousViewport;
                GameWorld.spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend);
            }
        }
Beispiel #10
0
        /// <summary>
        /// Recreates the specified text.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <param name="position">The position of the first character.</param>
        /// <param name="exploadPosition">The expload position.</param>
        /// <param name="scale">The scale.</param>
        /// <param name="color">The color.</param>
        /// <param name="fontName">Name of the font.</param>
        /// <param name="layerDepth">The layer depth.</param>
        /// <param name="centered">If true, the text will be centered at position. If false, position will be the top-left of the text.</param>
        public void Create(string text, Vector2 position, Vector2 exploadPosition, float scale, Color color, string fontName, float layerDepth, bool centered)
        {
            foreach (FancyCharacter character in this)
            {
                this.exploadingChars.Add(character);
                character.Expload(exploadPosition);
            }

            this.Clear();
            if (text.Length == 0)
            {
                return;
            }

            position += scale * FontStatic.Get(fontName).MeasureString(text[0].ToString()) / 2f;
            if (centered)
            {
                position -= scale * FontStatic.Get(fontName).MeasureString(text) / 2f;
            }

            float initialX   = position.X;
            long  timeOffset = 10000000;

            for (int i = 0; i < text.Length; i++)
            {
                if (text[i] != '\n')
                {
                    if (text[i] == '#')
                    {
                        i++;
                        this.Add(new FancyCharacter(Drawer.GetControllerSymbolMap(text[i]), position, scale * 1.2f, color, "controllerFont", timeOffset, layerDepth));
                        position.X += 0.5f * FontStatic.Get("controllerFont").MeasureString(Drawer.GetControllerSymbolMap(text[i]).ToString()).X *scale;
                    }
                    else
                    {
                        this.Add(new FancyCharacter(text[i], position, scale, color, fontName, timeOffset, layerDepth));
                        position.X += 0.5f * FontStatic.Get(fontName).MeasureString(text[i].ToString()).X *scale;
                    }
                }

                if (i < text.Length - 1 && text[i + 1] != '\n')
                {
                    position.X += 0.5f * FontStatic.Get(fontName).MeasureString(text[i + 1].ToString()).X *scale;
                }

                if (text[i] == '\n')
                {
                    position.X  = initialX;
                    position.Y += FontStatic.Get(fontName).MeasureString(" ").Y *scale * 0.75f;
                    timeOffset  = 10000000;
                }

                timeOffset += 200000;
            }
        }
Beispiel #11
0
 /// <summary>
 /// Draws the specified highlighted.
 /// </summary>
 /// <param name="offsetPosition">The offset position.</param>
 /// <param name="highlighted">Specifies whether or not this menu entry
 /// is the highlighted menu entry in the list of menu entries.</param>
 public virtual void Draw(Vector2 offsetPosition, bool highlighted)
 {
     Drawer.DrawOutlinedString(
         FontStatic.Get("defaultFont"),
         this.text,
         this.position + offsetPosition,
         Color.White,
         0f,
         this.origin,
         (highlighted ? 0.9f : 0.7f),
         SpriteEffects.None,
         this.layerDepth);
 }
Beispiel #12
0
 /// <summary>
 /// Draws the menu entry at the specified position.
 /// </summary>
 /// <param name="offsetPosition"></param>
 /// <param name="highlighted">Specifies whether or not this menu entry
 /// is the highlighted menu entry in the list of menu entries.</param>
 public override void Draw(Vector2 offsetPosition, bool highlighted)
 {
     Drawer.DrawOutlinedString(
         FontStatic.Get("defaultFont"),
         this.text,
         this.position + offsetPosition,
         Color.White,
         0f,
         FontStatic.Get("defaultFont").MeasureString(this.text) / 2f,
         highlighted ? 0.9f : 0.7f,
         SpriteEffects.None,
         this.layerDepth);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="StupidGameScreen"/> class.
        /// </summary>
        /// <param name="scoreboardIndex">The game-specific index into the scoreboard.</param>
        public StupidGameScreen(int scoreboardIndex)
            : base(scoreboardIndex)
        {
            // Here should be the construction of all objects and the setting of objects that do not change.
            // The Reset method should be used to set objects that do change.
            this.display                = "Mash A. Isn't this a fun game?";
            this.displayPosition        = new Vector2(1920 / 2, 300); // Remember, screen resolution is guarenteed to be 1920*1080
            this.displayOrigin          = FontStatic.Get("defaultFont").MeasureString(this.display) / 2f;
            this.scorePosition          = new Vector2(1920 / 2, 500);
            this.countDownTimerPosition = new Vector2(1920 / 2, 700);

            // Always call reset at the end of the constructor!
            this.Reset();
        }
        /// <summary>
        /// Draws this instance.
        /// </summary>
        public override void Draw()
        {
            base.Draw();

            Drawer.DrawOutlinedString(
                FontStatic.Get("defaultFont"),
                "Press Start",
                this.pressStartLocation,
                Color.White,
                0f,
                this.pressStartOrigin,
                1f,
                SpriteEffects.None,
                0.5f);
        }
Beispiel #15
0
        /// <summary>
        /// Draws this instance.
        /// </summary>
        public void Draw()
        {
            float alpha = 1f;

            if (GameClock.Now - this.creationTime < 3000000f)
            {
                alpha = MathHelper.Clamp((GameClock.Now - this.creationTime) / 3000000f, 0, 1);
            }

            tempColor.A = (byte)(this.color.A * alpha);
            tempColor.B = (byte)(this.color.B * alpha);
            tempColor.G = (byte)(this.color.G * alpha);
            tempColor.R = (byte)(this.color.R * alpha);

            float tempScale = this.scale;

            if (GameClock.Now >= this.startupEffectTime - 2500000 && GameClock.Now <= this.startupEffectTime + 2500000)
            {
                tempScale *= Math.Abs((GameClock.Now - this.startupEffectTime) / 2500000f) * 0.4f + 0.6f;
            }

            if (this.font.ToLower().Equals("controllerfont"))
            {
                Drawer.DrawString(
                    FontStatic.Get(this.font),
                    this.character.ToString(),
                    this.position,
                    tempColor,
                    this.rotation,
                    this.origin,
                    tempScale,
                    SpriteEffects.None,
                    this.layerDepth);
            }
            else
            {
                Drawer.DrawOutlinedString(
                    FontStatic.Get(this.font),
                    this.character.ToString(),
                    this.position,
                    tempColor,
                    this.rotation,
                    this.origin,
                    tempScale,
                    SpriteEffects.None,
                    this.layerDepth);
            }
        }
 /// <summary>
 /// Draws this instance.
 /// </summary>
 public override void Draw()
 {
     base.Draw();
     this.sprWorld.Draw();
     Drawer.DrawString(
         FontStatic.Get("defaultFont"),
         "Level: " + (this.currentLevel + 1).ToString(),
         new Vector2(875, 205),
         Color.White,
         0f,
         Vector2.Zero,
         0.4f,
         SpriteEffects.None,
         1f
         );
 }
        public SPRMainScreen(int scoreBoardIndex)
            : base()
        {
            this.menu = new MainMenu(
                new Vector2(0, -60),
                new MenuAction[]
            {
                new MenuAction(ActionType.Select, new PlayGameDelegate(scoreBoardIndex))
            },
                50,
                scoreBoardIndex);

            this.textDrawPosition = new Vector2(265, -225);
            this.textDrawOrigin   = FontStatic.Get("defaultFont").MeasureString("Super Power");
            this.position         = new tVector2(1920f / 2f, 1080f / 2f);
            this.position.GoTo(1920f / 2f, 1080f / 2f, 0.3f, true);
        }
Beispiel #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FancyCharacter"/> class.
 /// </summary>
 /// <param name="character">The character.</param>
 /// <param name="position">The position.</param>
 /// <param name="scale">The scale.</param>
 /// <param name="color">The color.</param>
 /// <param name="fontName">Name of the font.</param>
 /// <param name="startupEffectTimeOffset">The startup effect time offset.</param>
 /// <param name="layerDepth">The layer depth.</param>
 public FancyCharacter(char character, Vector2 position, float scale, Color color, string fontName, long startupEffectTimeOffset, float layerDepth)
 {
     this.character          = character;
     this.position           = position;
     this.font               = fontName;
     this.origin             = FontStatic.Get(fontName).MeasureString(character.ToString()) / 2f;
     this.scale              = scale;
     this.color              = color;
     this.layerDepth         = layerDepth;
     this.Disposed           = false;
     this.velocity           = Vector2.Zero;
     this.acceloration       = Vector2.Zero;
     this.rotationalVelocity = 0;
     this.rotation           = 0;
     this.creationTime       = GameClock.Now;
     this.startupEffectTime  = this.creationTime + startupEffectTimeOffset;
     this.tempColor          = new Color();
 }
 public override void Draw()
 {
     base.Draw();
     Drawer.DrawRectangle(
         new Rectangle(0, 0, 1920, 1080),
         1920,
         0f,
         Color.Black);
     Drawer.DrawString(
         FontStatic.Get("defaultFont"),
         "Please Select Your Weapon For Slot #" + count / 2,
         new Vector2(300, 100),
         Color.White,
         0f,
         new Vector2(1920 / 2, 100),
         0.35f,
         SpriteEffects.None,
         1f);
     this.menu.Draw();
 }
        /// <summary>
        /// Draws the menu entry at the specified position.
        /// </summary>
        /// <param name="offsetPosition">The offset position.</param>
        /// <param name="highlighted">Specifies whether or not this menu entry
        /// is the highlighted menu entry in the list of menu entries.</param>
        public override void Draw(Vector2 offsetPosition, bool highlighted)
        {
            base.Draw(offsetPosition, highlighted);

            for (int i = 0; i <= 10; i++)
            {
                if (this.scales[i].Value != 0)
                {
                    Drawer.DrawOutlinedString(
                        FontStatic.Get("defaultFont"),
                        i.ToString(),
                        this.positions[i].Value + (this.ignoreOffsetPosition ? Vector2.Zero : offsetPosition),
                        Color.White,
                        0f,
                        this.origins[i],
                        this.scales[i].Value,
                        SpriteEffects.None,
                        this.numberLayerDepth);
                }
            }
        }
Beispiel #21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PauseScreen"/> class.
        /// </summary>
        public PauseScreen()
            : base()
        {
            this.menu = new PauseMenu(
                new Vector2(0, -60),
                new MenuAction[]
            {
                new MenuAction(ActionType.GoBack, new QuitPauseScreenDelegate()),
            },
                75);

            this.textDrawPosition = new Vector2(0, -225);
            this.textDrawOrigin   = FontStatic.Get("defaultFont").MeasureString("Paused") / 2f;
            this.position         = new tVector2(1920f / 2f - 2000f, 1080f / 2f);
            this.position.GoTo(1920f / 2f, 1080f / 2f, 0.3f, true);
            this.drawLagTime = DateTime.Now.Ticks + 1000000;
            this.background  = new HypercubeDisplay(
                new Rectangle((int)(this.position.Value.X - 584f / 2f) - 3, (int)(this.position.Value.Y - 700f / 2f) - 3, 584 + 6, 700 + 6),
                3,
                this.random,
                0.2f);
        }
        /// <summary>
        /// Draws this instance.
        /// </summary>
        public override void Draw()
        {
            base.Draw();

            Drawer.DrawOutlinedString(
                FontStatic.Get("defaultFont"),
                this.display,
                this.displayPosition,
                Color.White,
                0f,
                this.displayOrigin,
                1f,
                SpriteEffects.None,
                1f);

            Drawer.DrawOutlinedString(
                FontStatic.Get("defaultFont"),
                Drawer.FormatNumber(this.Score),
                this.scorePosition,
                Color.White,
                0f,
                FontStatic.Get("defaultFont").MeasureString(this.Score.ToString()) / 2f,
                1f,
                SpriteEffects.None,
                1f);

            string secondsRemaining = Math.Max((Math.Ceiling((this.gameOverTime - GameClock.Now) / 10000000f)), 0).ToString();

            Drawer.DrawOutlinedString(
                FontStatic.Get("defaultFont"),
                secondsRemaining,
                this.countDownTimerPosition,
                Color.White,
                0f,
                FontStatic.Get("defaultFont").MeasureString(secondsRemaining) / 2f,
                1f,
                SpriteEffects.None,
                1f);
        }
        public override void Draw()
        {
            base.Draw();
            for (int i = 0; i < m_Weapons.Length; i++)
            {
                if (m_Weapons[i] != null)
                {
                    m_Weapons[i].Draw();
                }
            }
            float healthtemp = this.getHealth();

            Drawer.DrawString(
                FontStatic.Get("defaultFont"),
                ("Bot Health: " + healthtemp.ToString()),
                new Vector2(1450, 205),
                Color.White,
                0f,
                Vector2.Zero,
                0.4f,
                SpriteEffects.None,
                1f);
        }
Beispiel #24
0
        /// <summary>
        /// Draws this instance.
        /// </summary>
        public override void Draw()
        {
            Drawer.DrawString(
                FontStatic.Get("defaultFont"),
                terminalText,
                this.position.Value + this.textDrawPosition,
                Color.PaleGreen,
                0f,
                this.textDrawOrigin,
                .4f,
                SpriteEffects.None,
                0.99f);

            // Draw the frame
            Drawer.Draw(
                TextureStatic.Get("BoxArtHolder"),
                this.position.Value,
                null,
                Color.White,
                0f,
                TextureStatic.GetOrigin("BoxArtHolder"),
                1f,
                SpriteEffects.None,
                0.9f);
            backgroundLength.X = this.position.Value.X + TextureStatic.Get("BoxArtHolder").Width / 2;
            backgroundLength.Y = this.position.Value.Y;
            backgroundStart.X  = this.position.Value.X - TextureStatic.Get("BoxArtHolder").Width / 2;
            backgroundStart.Y  = this.position.Value.Y;
            Drawer.DrawLine(
                backgroundStart,
                backgroundLength,
                TextureStatic.Get("BoxArtHolder").Height,
                .89f,
                Color.Black);

            // this.background.Draw();
        }
Beispiel #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PauseScreen"/> class.
 /// </summary>
 public TextScreen(string text)
     : base()
 {
     terminalText          = text;
     textLocationHolder    = text;
     this.textDrawPosition = new Vector2(0, -225);
     this.textDrawOrigin   = FontStatic.Get("defaultFont").MeasureString(terminalText) / 2f;
     this.position         = new tVector2(1920f / 2f - 2000f, 1080f / 2f);
     this.position.GoTo(1920f / 2f, 1080f / 2f, 0.3f, true);
     this.drawLagTime = DateTime.Now.Ticks + 1000000;
     //this.background = new HypercubeDisplay(
     //    new Rectangle((int)(this.position.Value.X - 584f / 2f) - 3, (int)(this.position.Value.Y - 700f / 2f) - 3, 584 + 6, 700 + 6),
     //    3,
     //    this.random,
     //    0.2f);
     if (terminalText.Length > 23)
     {
         string[] temp = terminalText.Split(' ');
         terminalText = "";
         int count = 1;
         foreach (string word in temp)
         {
             if (terminalText.Length + word.Length < 28 * count)
             {
                 terminalText = terminalText + word + " ";
             }
             else
             {
                 count++;
                 terminalText = terminalText + "\n" + word + " ";
             }
         }
         this.textDrawOrigin    = FontStatic.Get("defaultFont").MeasureString(terminalText) / 2f;
         this.textDrawOrigin.Y -= count * 60;
     }
 }
Beispiel #26
0
        /// <summary>
        /// Draws this instance.
        /// </summary>
        public override void Draw()
        {
            // Write "Game Over" at the top-center of the background. And all the other stuff...
            Drawer.DrawOutlinedString(
                FontStatic.Get("defaultFont"),
                "Game Over",
                this.position.Value + this.textDrawPosition,
                Color.White,
                0f,
                this.textDrawOrigin,
                1.2f,
                SpriteEffects.None,
                0.99f);
            Drawer.DrawOutlinedString(
                FontStatic.Get("defaultFont"),
                "Score",
                this.position.Value + this.scoreLogoPosition,
                Color.White,
                0f,
                this.scoreLogoOrigin,
                0.4f,
                SpriteEffects.None,
                0.99f);
            Drawer.DrawOutlinedString(
                FontStatic.Get("defaultFont"),
                Drawer.FormatNumber(this.score),
                this.position.Value + this.scorePosition,
                Color.White,
                0f,
                this.scoreOrigin,
                0.9f,
                SpriteEffects.None,
                0.99f);
            Drawer.DrawControllerSymbol(
                Buttons.A,
                this.position.Value + this.aButtonPosition,
                this.buttonColor,
                0f,
                this.buttonOrigin,
                0.65f,
                SpriteEffects.None,
                0.99f);
            Drawer.DrawControllerSymbol(
                Buttons.B,
                this.position.Value + this.bButtonPosition,
                this.buttonColor,
                0f,
                this.buttonOrigin,
                0.65f,
                SpriteEffects.None,
                0.99f);
            Drawer.DrawOutlinedString(
                FontStatic.Get("defaultFont"),
                "Replay",
                this.position.Value + this.aButtonPosition + this.actionXOffset,
                this.buttonColor,
                0f,
                this.aActionOrigin,
                0.65f,
                SpriteEffects.None,
                0.99f);
            Drawer.DrawOutlinedString(
                FontStatic.Get("defaultFont"),
                "Exit",
                this.position.Value + this.bButtonPosition + this.actionXOffset,
                this.buttonColor,
                0f,
                this.bActionOrigin,
                0.65f,
                SpriteEffects.None,
                0.99f);

            // Draw the frame
            Drawer.Draw(
                TextureStatic.Get("TitleNameBorder"),
                this.position.Value,
                null,
                Color.White,
                0f,
                TextureStatic.GetOrigin("TitleNameBorder"),
                1f,
                SpriteEffects.None,
                0.3f);

            this.background.Draw();
        }
        /// <summary>
        /// Draws this instance.
        /// </summary>
        public void Draw()
        {
            this.background.Draw();
            Drawer.Draw(
                TextureStatic.Get("TitleNameBorder"),
                this.rectangleDrawLocation,
                null,
                Color.White,
                0f,
                TextureStatic.GetOrigin("TitleNameBorder"),
                1f,
                SpriteEffects.None,
                0.92f);

            // Don't draw if a menu entry is selected.
            if (GameInfoCollection.CurrentIndex != GameInfoCollection.GameInfos.Count - 1)
            {
                Scoreboard tempScoreboard = GameWorld.gameSaver.GetScoreBoard(GameInfoCollection.GameInfos[GameInfoCollection.CurrentIndex].ScoreboardIndex);
                if (tempScoreboard != null)
                {
                    Drawer.DrawOutlinedString(
                        FontStatic.Get("defaultFont"),
                        "High Scores",
                        this.highScoresLogoLocation,
                        Color.White,
                        MathHelper.PiOver2,
                        this.highScoresLogoOrigin,
                        0.5f,
                        SpriteEffects.None,
                        0.921f);

                    if (tempScoreboard.Count > 0)
                    {
                        GameWorld.spriteBatch.End();
                        Viewport previousViewport = GameWorld.spriteBatch.GraphicsDevice.Viewport;
                        GameWorld.spriteBatch.GraphicsDevice.Viewport = this.scrollableRectangle;
                        GameWorld.spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend);

                        // Find the index of the first entry to be drawn.
                        int firstIndex = (int)Math.Min(Math.Ceiling(Math.Abs((this.textDrawLocation.Y - this.scoreOffset.Y) / this.verticleSpacing)), tempScoreboard.Count - 1);

                        // Find the number of entries to display.
                        int entries = (int)Math.Min((1080 / verticleSpacing + 4), tempScoreboard.Count - firstIndex);

                        this.tempVector2.X = 0;
                        this.tempVector2.Y = Math.Max(firstIndex - 3, 0) * this.verticleSpacing;
                        for (int i = Math.Max(firstIndex - 3, 0); i < firstIndex + entries; i++)
                        {
                            Drawer.DrawOutlinedString(
                                FontStatic.Get("defaultFont"),
                                (i + 1).ToString() + ".",
                                this.textDrawLocation + this.scoreOffset + this.tempVector2,
                                Color.White,
                                0f,
                                Vector2.Zero,
                                0.88f,
                                SpriteEffects.None,
                                0.98f);
                            Drawer.DrawOutlinedString(
                                FontStatic.Get("defaultFont"),
                                tempScoreboard[i].Gamertag,
                                this.nameDrawLocation + this.scoreOffset + this.tempVector2,
                                Color.White,
                                0f,
                                Vector2.Zero,
                                0.88f,
                                SpriteEffects.None,
                                0.98f);
                            Drawer.DrawOutlinedString(
                                FontStatic.Get("defaultFont"),
                                Drawer.FormatNumber(((uint)Math.Max(tempScoreboard[i].Scores[GameInfoCollection.CurrentIndex], 0))),
                                this.scoreDrawLocation + this.scoreOffset + this.tempVector2,
                                Color.White,
                                0f,
                                Vector2.Zero,
                                0.88f,
                                SpriteEffects.None,
                                0.98f);
                            this.tempVector2.Y += this.verticleSpacing;
                        }

                        GameWorld.spriteBatch.End();
                        GameWorld.spriteBatch.GraphicsDevice.Viewport = previousViewport;
                        GameWorld.spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend);
                    }
                    else
                    {
                        Drawer.DrawOutlinedString(
                            FontStatic.Get("defaultFont"),
                            "No scores have",
                            this.noScoresHavePosition,
                            Color.White,
                            0f,
                            this.noScoresHaveOrigin,
                            0.7f,
                            SpriteEffects.None,
                            0.921f);
                        Drawer.DrawOutlinedString(
                            FontStatic.Get("defaultFont"),
                            "been recorded.",
                            this.beenRecordedPosition,
                            Color.White,
                            0f,
                            this.beenRecoredOrigin,
                            0.7f,
                            SpriteEffects.None,
                            0.921f);
                    }
                }
            }
        }
Beispiel #28
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CreditsScreen"/> class.
        /// </summary>
        public CreditsScreen()
            : base()
        {
            this.shouldDispose = false;
            this.FadingOut     = true;
            this.position      = new tVector2(1920f / 2f - 2000f, 1080f / 2f);
            this.position.GoTo(1920f / 2f, 1080f / 2f, 0.3f, true);
            this.background = new HypercubeDisplay(
                new Rectangle((int)(this.position.Value.X - 1450f / 2f) - 3, (int)(this.position.Value.Y - 800f / 2f) - 3, 1450 + 6, 800 + 6),
                3,
                this.random,
                0.2f);
            this.scrollPosition = new tVector2(0, 1000);
            this.scrollPosition.GoTo(0, -21000, 82f, true);
            this.titleOrigin = FontStatic.Get("defaultFont").MeasureString("Credits") / 2f;
            this.viewport    = new Viewport(
                (int)((this.position.Value.X - 1450f / 2f) * Drawer.GetRatio()),
                (int)((this.position.Value.Y - 800f / 2f) * Drawer.GetRatio()),
                (int)(1450 * Drawer.GetRatio()),
                (int)(800 * Drawer.GetRatio()));
            this.previousPositionX = 0;
            string fullText =
                @"Ty Taylor
    Supreme Overlord of the Universe
    Framework and Game Engine

Marc Buchner
    Assistant to Mr. Taylor

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Some guy
    Stuff and things

Copyright 2011
Case Western Reserve University
http://eecs.case.edu";

            this.display = fullText.Split('\n').ToList <string>();
            float unitSpacing = FontStatic.Get("defaultFont").MeasureString(" ").Y;

            this.verticleSpacing = new List <Vector2>(this.display.Count);
            for (int i = 0; i < this.display.Count; i++)
            {
                this.verticleSpacing.Add(new Vector2(-800, 300 + i * unitSpacing));
            }
        }
        /// <summary>
        /// Updates this instance.
        /// </summary>
        public void Update()
        {
            this.background.Update();

            if (this.screen.IsOnTop())
            {
                if (GameInfoCollection.CurrentIndex != GameInfoCollection.GameInfos.Count - 1 && this.previousGameInfoSelected < 0)
                {
                    this.aAndXButtonDisplay.Create(
                        "#A Play       #X Instructions",
                        this.titleBorderPosition + new Vector2(0, 160),
                        this.titleBorderPosition,
                        0.35f,
                        Color.White,
                        "defaultFont",
                        0.971f,
                        true);
                }
                else if (GameInfoCollection.CurrentIndex == GameInfoCollection.GameInfos.Count - 1 && this.previousGameInfoSelected >= 0)
                {
                    this.aAndXButtonDisplay.Create(
                        string.Empty,
                        this.titleBorderPosition + new Vector2(0, 160),
                        this.titleBorderPosition,
                        0.35f,
                        Color.White,
                        "defaultFont",
                        0.971f,
                        true);
                }

                if (this.previousGameInfoSelected != GameInfoCollection.CurrentIndex && GameInfoCollection.CurrentIndex != GameInfoCollection.GameInfos.Count - 1)
                {
                    float titleXMeasurement = FontStatic.Get("defaultFont").MeasureString(
                        GameInfoCollection.GameInfos[GameInfoCollection.CurrentIndex].Title).X;
                    float titleScale = Math.Min(1f, this.maxTitleWidth / titleXMeasurement);
                    this.titleString.Create(
                        GameInfoCollection.GameInfos[GameInfoCollection.CurrentIndex].Title,
                        this.titlePosition,
                        this.titleBorderPosition,
                        titleScale,
                        Color.White,
                        "defaultFont",
                        0.99f,
                        true);
                    this.descriptionString.Create(
                        GameInfoCollection.GameInfos[GameInfoCollection.CurrentIndex].Description,
                        this.descriptionPosition,
                        this.titleBorderPosition,
                        0.35f,
                        Color.White,
                        "defaultFont",
                        0.99f,
                        false);
                }
                else if (this.previousGameInfoSelected < 0 && this.previousGameInfoSelected != -this.boxArtMenu.CurrentSelected - 1 || this.menuHasReset)
                {
                    this.menuHasReset = false;
                    this.titleString.Create(
                        this.boxArtMenu[this.boxArtMenu.CurrentSelected].text,
                        this.titlePosition,
                        this.titleBorderPosition,
                        1f,
                        Color.White,
                        "defaultFont",
                        0.99f,
                        true);
                    this.descriptionString.Create(
                        (this.boxArtMenu[this.boxArtMenu.CurrentSelected] as DescriptionMenuEntry).Description,
                        this.descriptionPosition,
                        this.titleBorderPosition,
                        0.35f,
                        Color.White,
                        "defaultFont",
                        0.99f,
                        false);
                }

                if (GameInfoCollection.CurrentIndex == GameInfoCollection.GameInfos.Count - 1)
                {
                    if (this.previousGameInfoSelected >= 0)
                    {
                        this.menuHasReset = true;
                    }

                    this.previousGameInfoSelected = -this.boxArtMenu.CurrentSelected - 1;
                }
                else
                {
                    this.previousGameInfoSelected = GameInfoCollection.CurrentIndex;
                }
            }

            this.titleString.Update();
            this.descriptionString.Update();
            this.aAndXButtonDisplay.Update();
        }