예제 #1
0
        public override void Draw(TGPASpriteBatch spriteBatch)
        {
            //Draw canon
            dRect = ComputeDstRect(canonSrc);

            Color c = Color.White;

            if (IsHit)
            {
                c = Color.Red *0.5f;
            }

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            spriteBatch.Draw(this.Sprite, dRect, this.canonSrc, c, fireAngle, structureLinkPoint, Flip, 1.0f);

            //Draw structure
            dRect = ComputeDstRect(sRect);
            dRect.X += 26;
            this.DstRect = dRect;

            if (IsHit)
            {
                c = (Color.Red * 0.5f);
                IsHit = false;
            }

            spriteBatch.Draw(this.Sprite, dRect, this.SrcRect, c, 0.0f, structureLinkPoint, Flip, 1.0f);
            spriteBatch.End();
        }
        public void DrawParticles(TGPASpriteBatch spriteBatch, bool background)
        {
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);

            foreach (Particle p in particles)
            {
                if (p != null)
                {
                    if (!p.Additive && p.Background == background)
                    {
                        p.Draw(spriteBatch, particuleTex);
                    }
                }
            }

            spriteBatch.End();

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive);

            foreach (Particle p in particles)
            {
                if (p != null)
                {
                    if (p.Additive && p.Background == background)
                    {
                        p.Draw(spriteBatch, particuleTex);
                    }
                }
            }

            spriteBatch.End();
        }
 public override void Draw(TGPASpriteBatch spriteBatch)
 {
     TGPAContext.Instance.TextPrinter.Color = Color.Black *alpha;
     TGPAContext.Instance.TextPrinter.Size = 1.5f;
     TGPAContext.Instance.TextPrinter.Write(spriteBatch,location.X, location.Y, texte, 128);
     TGPAContext.Instance.TextPrinter.Color = Color.Black;
     TGPAContext.Instance.TextPrinter.Size = 1f;
 }
예제 #4
0
        public override void Draw(TGPASpriteBatch spriteBatch)
        {
            double updateRotation = rotation;
            this.rotation -= Math.PI / 4;

            base.Draw(spriteBatch);

            this.rotation = updateRotation;
        }
예제 #5
0
 public override void Draw(TGPASpriteBatch sprite, Texture2D tex)
 {
     sprite.Draw(tex, GameLocation,
         new Rectangle(0, 128, 64, 64),
         this.particuleColor,
         rotation, new Vector2(32.0f, 32.0f),
         new Vector2(1f, 0.1f),
         SpriteEffects.None, 1.0f);
 }
예제 #6
0
        public override void Draw(TGPASpriteBatch spriteBatch)
        {
            double tmpRotation = this.rotation;
            this.rotation = this.visualRotation;

            base.Draw(spriteBatch);

            this.rotation = tmpRotation;
        }
예제 #7
0
        public override void Draw(TGPASpriteBatch spriteBatch)
        {
            Rectangle dstBehind = dRect;
            dstBehind.Width = (int)((float)dstBehind.Width * 1.4f);
            dstBehind.Height = (int)((float)dstBehind.Height * 1.4f);

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            spriteBatch.Draw(this.Sprite, dstBehind, this.SrcRect, Color.SeaShell *0.8f, 0.0f, this.spriteOrigin, Flip, 1.0f);
            spriteBatch.End();

            base.Draw(spriteBatch);
        }
        public void Draw(TGPASpriteBatch spriteBatch)
        {
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            spriteBatch.Draw(videoBackground, new Rectangle(0, 0, TGPAContext.Instance.ScreenWidth, TGPAContext.Instance.ScreenHeight), Color.White);
            spriteBatch.End();

            if (playVideo)
            {
                TGPAContext.Instance.TextPrinter.Color = Color.White;

                if (this.videoPlayer.State == MediaState.Playing)
                {
                    //Display video
                    spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
                    spriteBatch.Draw(this.videoPlayer.GetTexture(), this.videoDst, Color.White);
                    spriteBatch.End();
                }
            }
            else if (playCredits)
            {
                TGPAContext.Instance.TextPrinter.Color = Color.Black;

                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);

                if (currentPageIndex > 0)
                {
                    spriteBatch.Draw(backgrounds[currentPageIndex - 1], bgDst, Color.White);
                }

                spriteBatch.Draw(backgrounds[currentPageIndex], bgDst, new Color(Color.White.R, Color.White.G, Color.White.B, transitionAlpha));

                spriteBatch.End();

                this.pages[currentPageIndex].Draw(spriteBatch);
            }

            if (playVideo)
            {
                TGPAContext.Instance.TextPrinter.Color = Color.White;
            }
            else
            {
                TGPAContext.Instance.TextPrinter.Color = Color.Navy;
            }
            TGPAContext.Instance.ButtonPrinter.Draw(spriteBatch, "#Back", TGPAContext.Instance.Player1.Device.Type, new Vector2(750, TGPAContext.Instance.ScreenHeight - 110));
            TGPAContext.Instance.TextPrinter.Write(spriteBatch, new Vector2(800, TGPAContext.Instance.ScreenHeight - 100), LocalizedStrings.GetString("CreditsScreenLeave"));

            TGPAContext.Instance.ButtonPrinter.Draw(spriteBatch, "#Confirm", TGPAContext.Instance.Player1.Device.Type, new Vector2(750, TGPAContext.Instance.ScreenHeight - 55));
            TGPAContext.Instance.TextPrinter.Write(spriteBatch, new Vector2(800, TGPAContext.Instance.ScreenHeight - 45), LocalizedStrings.GetString("CreditsScreenNext"));

            TGPAContext.Instance.TextPrinter.Color = Color.Black;
        }
예제 #9
0
        public override void Draw(TGPASpriteBatch sprite, Texture2D tex)
        {
            Rectangle  sRect = new Rectangle(flag * 64, 0, 64, 64);

            sprite.Draw(tex,
                GameLocation,
                sRect,
                particuleColor,
                rotation,
                new Vector2(32.0f, 32.0f),
                size + (1.0f - frame),
                SpriteEffects.None,
                1.0f);
        }
예제 #10
0
        public void Draw(TGPASpriteBatch spriteBatch,Rectangle src,Texture2D paperRect, GameState gameState)
        {
            if (alpha > 0f)
            {

                int width = 420;
                int height = 50;
                int x = (TGPAContext.Instance.ScreenWidth/2) - (width/2);
                int y = TGPAContext.Instance.TitleSafeArea.Top + 100;

                //Another location for title screen
                if ((gameState == GameState.TitleScreen) || (gameState == GameState.Loading) || (gameState == GameState.Credits))
                {
                    x = TGPAContext.Instance.TitleSafeArea.Left;
                    y = TGPAContext.Instance.TitleSafeArea.Top + 50;
                }

                Rectangle dst = src;
                dst.X = x;
                dst.Y = y - 20; ;
                dst.Width = width;
                dst.Height = height;

                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
                spriteBatch.Draw(paperRect,
                    dst,
                    src,
                    color,
                    0.0f,
                    Vector2.Zero,
                    SpriteEffects.None,
                    1.0f);
                spriteBatch.End();

                src = new Rectangle(0, 0, 32, 32);
                dst = src;
                dst.X = x + 60; ;
                dst.Y = y - 10; ;

                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
                spriteBatch.Draw(note, dst, src, color, 0.0f, Vector2.Zero, SpriteEffects.None, 1.0f);
                spriteBatch.End();

                TGPAContext.Instance.TextPrinter.Color =  Color.Black* alpha;
                TGPAContext.Instance.TextPrinter.Size = 0.8f;
                TGPAContext.Instance.TextPrinter.Write(spriteBatch,x + 90, y - 5, artist + " - " + name, 128);
                TGPAContext.Instance.TextPrinter.Color = Color.Black;
                TGPAContext.Instance.TextPrinter.Size = 1f;
            }
        }
        /// <summary>
        /// Display a button on the screen
        /// </summary>
        /// <param name="spriteBatch"></param>
        /// <param name="button">#Move #Back #Cancel #Confirm #Move #Fire #Bomb #Pause</param>
        /// <param name="device"></param>
        /// <param name="location"></param>
        /// <param name="color">Special color</param>
        public void Draw(TGPASpriteBatch spriteBatch, String button, DeviceType device, Vector2 location, Color color)
        {
            if (buttonsSprite == null) return; //HACK

            Rectangle src = TransformButtonToSprite(button, device);
            Rectangle dst = src;
            dst.X = (int)location.X;
            dst.Y = (int)location.Y;
            dst.Width /= 2;
            dst.Height /= 2;

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            spriteBatch.Draw(buttonsSprite, dst, src, color);
            spriteBatch.End();
        }
예제 #12
0
        public override void Draw(TGPASpriteBatch spriteBatch)
        {
            armDst.X = (int)location.X + dRect.Width / 2;
            armDst.Y = (int)location.Y + dRect.Height / 2;

            //Due to arm orietation, there is a Pi/8 difference in the angle to draw and to use
            double drawAngle = fireAngle + Math.PI / 8;

            //Draw arm with angle
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            spriteBatch.Draw(this.Sprite, armDst, armSrc, Color.White, (float)drawAngle,
                armAnchor,
                this.Flip, 1.0f);
            spriteBatch.End();

            base.Draw(spriteBatch);
        }
예제 #13
0
        public override void Draw(TGPASpriteBatch sprite, Texture2D tex)
        {
            Rectangle sRect = new Rectangle(flag * 64, 256, 64, 64);
            float frameAlpha;

            if (frame > 0.9f)
                frameAlpha = (1.0f - frame) * 10.0f;
            else
                frameAlpha = (frame / 0.9f);

            a = frameAlpha;

            sprite.Draw(tex,
                GameLocation,
                sRect,
                particuleColor,
                    rotation,
                    new Vector2(32.0f, 32.0f),
                    size + (1.0f - frame),
                    SpriteEffects.None,
                    1.0f);
        }
        public void Draw(TGPASpriteBatch spriteBatch)
        {
            //Display ad
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            spriteBatch.Draw(TGPAContext.Instance.NullTex, new Rectangle(0, 0, TGPAContext.Instance.ScreenWidth, TGPAContext.Instance.ScreenHeight), Color.White);

            bool specialCenter = false;
            Rectangle inboundsDst = TGPAContext.Instance.TitleSafeArea;
            if ((inboundsDst.Width > 1024) || (inboundsDst.Height > 768))
            {
                specialCenter = true;
            }

            if (specialCenter)
            {
                Rectangle dst = new Rectangle(0, 0, 1024, 768);
                dst.X = TGPAContext.Instance.ScreenWidth / 2 - dst.Width / 2;
                dst.Y = TGPAContext.Instance.ScreenHeight / 2 - dst.Height / 2;

                spriteBatch.Draw(background, dst, Color.White);
            }
            else
            {
                spriteBatch.Draw(background, inboundsDst, Color.White);
            }

            if (alpha > 0f)
            {
                spriteBatch.Draw(TGPAContext.Instance.NullTex, new Rectangle(0, 0, TGPAContext.Instance.ScreenWidth, TGPAContext.Instance.ScreenHeight), Color.Black * alpha);
            }

            spriteBatch.End();

            #if XBOX
            TGPAContext.Instance.ButtonPrinter.Draw(spriteBatch, "#Plus", TGPAContext.Instance.Player1.Device.Type, new Vector2(250, 700));
            TGPAContext.Instance.TextPrinter.Write(spriteBatch,new Vector2(300, 700), LocalizedStrings.GetString("Buy"));
            #endif
        }
예제 #15
0
        public override void Draw(TGPASpriteBatch spriteBatch)
        {
            //Text in box
            //************************************************************
            Vector2 textLocation = this.location;
            textLocation.X += 245;

            try
            {
                if (Focus)
                {
                    if (blink)
                    {
                        TGPAContext.Instance.TextPrinter.Write(spriteBatch,textLocation.X,textLocation.Y, this.text + "_",512);
                    }
                    else
                    {
                        TGPAContext.Instance.TextPrinter.Write(spriteBatch,textLocation.X, textLocation.Y, this.text, 512);
                    }
                }
                else
                {
                    TGPAContext.Instance.TextPrinter.Write(spriteBatch,textLocation.X, textLocation.Y, this.text, 512);
                }
            }
            catch (ArgumentException)
            {
                this.PressKey(Keys.Back, false);
            }

            //Box name
            //************************************************************
            TGPAContext.Instance.TextPrinter.Color = Color.Navy;
            TGPAContext.Instance.TextPrinter.Write(spriteBatch, this.location.X, this.location.Y, this.name, 512);
            TGPAContext.Instance.TextPrinter.Color = Color.Black;
        }
 public override void Draw(TGPASpriteBatch spriteBatch)
 {
     base.Draw(spriteBatch);
 }
            public override void Draw(TGPASpriteBatch spriteBatch)
            {
                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);

                spriteBatch.Draw(TGPAContext.Instance.NullTex,
                    new Rectangle(0, 0, TGPAContext.Instance.ScreenWidth, TGPAContext.Instance.ScreenHeight), Color.White *alphaFadeOut);

                spriteBatch.End();

                base.Draw(spriteBatch);
            }
            public override void Draw(TGPASpriteBatch spriteBatch)
            {
                TGPAContext.Instance.ButtonPrinter.Draw(spriteBatch, button, TGPAContext.Instance.Player1.Device.Type, locationP1, Color.White *alphaColor);

                TGPAContext.Instance.TextPrinter.Color = Color.Black *alphaColor;
                TGPAContext.Instance.TextPrinter.Write(spriteBatch,locationP1.X + ((button == "#Move" && TGPAContext.Instance.Player1.Device.Type == DeviceType.KeyboardMouse) ? 150 : 50), locationP1.Y, LocalizedStrings.GetString(button.Replace("#", "Player")), 128);
                TGPAContext.Instance.TextPrinter.Color = Color.Black;
            }
 public override void Draw(TGPASpriteBatch spriteBatch)
 {
 }
        public void Draw(TGPASpriteBatch spriteBatch)
        {
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            spriteBatch.Draw(this.bgBackTex, dst, src, Color.White);

            //draw stuff
            spriteBatch.End();

            foreach (FlyingStuff fs in flyingStuff)
            {
                fs.Draw(spriteBatch, this.buttonsTex);
            }

            //draw particle
            pmanager.DrawParticles(spriteBatch, true);

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            spriteBatch.Draw(this.bgForeTex, foreDst, foreSrc, Color.White);
            spriteBatch.End();

            if (mode == MenuMode.Titlescreen)
            {
                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);

                if (!startPressed)
                {
                    spriteBatch.End();

                    TGPAContext.Instance.TextPrinter.Color = new Color(Color.White.R, Color.White.G, Color.White.B, startPressAlpha);

                    TGPAContext.Instance.TextPrinter.Size = 3f;

                    String s = LocalizedStrings.GetString("P2PressStartXbox");

                    int x = 512 - ((s.Length * 10) + 50);
                    int y = 370;

                    TGPAContext.Instance.TextPrinter.Write(spriteBatch, x, y, s, 128);

                    TGPAContext.Instance.TextPrinter.Size = 1f;

                    TGPAContext.Instance.TextPrinter.Color = Color.Black;
                }
                else
                {

                    Rectangle tmp_src;

                    spriteBatch.Draw(this.bgSignTex, dst, src, Color.White*magicAlpha);

                    //option
                    tmp_src = buttonOptions;
                    if (this.Focus == MenuButtons.Options)
                        tmp_src.X += 289;

                    spriteBatch.Draw(this.Buttons, buttonOptionsDst, tmp_src, Color.White * magicAlpha);

                    //play
                    tmp_src = buttonGo;
                    if (this.Focus == MenuButtons.Play)
                        tmp_src.X = 289;

                    spriteBatch.Draw(this.Buttons, buttonGoDst, tmp_src, Color.White * magicAlpha);

                    //quit
                    tmp_src = buttonExit;
                    if (this.Focus == MenuButtons.Exit)
                        tmp_src.X += 289;

                    spriteBatch.Draw(this.Buttons, buttonExitDst, tmp_src, Color.White * magicAlpha);
                    spriteBatch.End();

                    TGPAContext.Instance.TextPrinter.Color = Color.White * magicAlpha;

                    //Show Player name
                    TGPAContext.Instance.TextPrinter.Write(spriteBatch, TGPAContext.Instance.TitleSafeArea.Left + 10, TGPAContext.Instance.TitleSafeArea.Bottom - 2 * TGPAContext.Instance.TextPrinter.Size * TGPAContext.Instance.TextPrinter.Font.LineSpacing, TGPAContext.Instance.Player1.Name);

                    //Show version
                    TGPAContext.Instance.TextPrinter.Write(spriteBatch, TGPAContext.Instance.TitleSafeArea.Left + 10, TGPAContext.Instance.TitleSafeArea.Bottom - TGPAContext.Instance.TextPrinter.Size * TGPAContext.Instance.TextPrinter.Font.LineSpacing, "v" + TheGreatPaperGame.Version);

                    //Fade in
                    if (fadeInOut > 0f)
                    {
                        Color blackScreen = new Color(Color.Black.R, Color.Black.G, Color.Black.B, this.fadeInOut);

                        spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
                        spriteBatch.Draw(TGPAContext.Instance.NullTex, new Rectangle(0, 0, TGPAContext.Instance.ScreenWidth, TGPAContext.Instance.ScreenHeight), blackScreen);
                        spriteBatch.End();
                    }

                    if (TGPAContext.Instance.Player1.IsPlayingOnWindows() == false)
                    {
                        //Buttons
                        //***************************************************************************
                        TGPAContext.Instance.ButtonPrinter.Draw(spriteBatch, "#Move", TGPAContext.Instance.Player1.Device.Type, 250, 570);
                        TGPAContext.Instance.ButtonPrinter.Draw(spriteBatch, "#Confirm", TGPAContext.Instance.Player1.Device.Type, 250, 620);

                        TGPAContext.Instance.TextPrinter.Write(spriteBatch, 300, 580, LocalizedStrings.GetString("TitleScreenMove"));
                        TGPAContext.Instance.TextPrinter.Write(spriteBatch, 300, 630, LocalizedStrings.GetString("TitleScreenButtonA"));
                    }

                    if (TGPAContext.Instance.IsTrialMode)
                    {
                        TGPAContext.Instance.ButtonPrinter.Draw(spriteBatch, "#Plus", TGPAContext.Instance.Player1.Device.Type, 250, 520);
                        TGPAContext.Instance.TextPrinter.Write(spriteBatch, 300, 530, LocalizedStrings.GetString("Buy"));
                    }
                    TGPAContext.Instance.ButtonPrinter.Draw(spriteBatch, "#Back", TGPAContext.Instance.Player1.Device.Type, 250, 670);
                    TGPAContext.Instance.TextPrinter.Write(spriteBatch, 300, 680, LocalizedStrings.GetString("ShowCreditsScreen"));

                    TGPAContext.Instance.TextPrinter.Color = Color.Black;
                }

            }
            else
            {
                spriteBatch.Begin();
                spriteBatch.Draw(this.parcheminTex, parcheminSrc, Color.White * magicAlpha);
                spriteBatch.End();

                TGPAContext.Instance.TextPrinter.Color = Color.Black * magicAlpha;

                this.optionsSection.Draw(spriteBatch);

                //Back
            #if WINDOWS
                spriteBatch.Begin();
                spriteBatch.Draw(this.optionsTex, buttonOptionsBackDst, buttonOptionsBackSrc, Color.White * magicAlpha);
                spriteBatch.End();

                TGPAContext.Instance.TextPrinter.Write(spriteBatch, buttonOptionsBackDst.X + buttonOptionsBackDst.Width + 25, buttonOptionsBackDst.Y + buttonOptionsBackDst.Height / 4, "Retour");
            #else
                TGPAContext.Instance.ButtonPrinter.Draw(spriteBatch, "#Cancel", TGPAContext.Instance.Player1.Device.Type, 200, 600);
                TGPAContext.Instance.TextPrinter.Write(spriteBatch, 250, 610, LocalizedStrings.GetString("OptionScreenBack"));

            #endif

                TGPAContext.Instance.TextPrinter.Color = Color.Black;
            }
        }
        public override void Draw(TGPASpriteBatch spriteBatch)
        {
            Color c = Color.White;

            if (IsHit)
            {
                c = (Color.Red * 0.75f);
                IsHit = false;
            }

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            //draw major
            spriteBatch.Draw(theSprite, new Vector2(dRect.X, dRect.Y), bunker1Rect, c);
            //draw soldier
            for (int i = 0; i < 3; i++ ){
                spriteBatch.Draw(theSprite, new Vector2(dRect.X + 190+(i*105) - offset, dRect.Y + 115), soliRect, c);
            }
            //draw bunker
            spriteBatch.Draw(theSprite, new Vector2(dRect.X,dRect.Y), bunker2Rect,c);

            //draw bumper
            if (!firing)
            {
                spriteBatch.Draw(theSprite, new Vector2(dRect.X, dRect.Y), bumper1Rect, c);
            }
            else
            {
                spriteBatch.Draw(theSprite, new Vector2(dRect.X, dRect.Y), bumper2Rect, c);
            }

            spriteBatch.End();
        }
예제 #22
0
 public override void Draw(Game.Graphics.TGPASpriteBatch spriteBatch)
 {
     throw new NotImplementedException("Use Draw(SpriteBatch,Texture2D) instead");
 }
        /// <summary>
        /// Write text at the specified location but with custom layout settings
        /// </summary>
        /// <param name="location"></param>
        /// <param name="s"></param>
        /// <param name="lineSize"></param>
        public void Write(TGPASpriteBatch spriteBatch, float x, float y, String s, int lineSize)
        {
            if (font == null) return; //HACK

            string[] words = s.Split(' ');
            int jumpSize = (int)((float)(font.LineSpacing * Size));
            int currentLineSpacesleft = lineSize;
            int lineNumber = 0;

            StringBuilder linePart = new StringBuilder();
            bool draw = false;
            int xButtonPosition = 0;
            Vector2 buttonLocation = Vector2.Zero;
            String missingPart = "";

            foreach (string w in words)
            {
                //Draw button
                //if (ButtonPrinter.Keywords.Contains(w))
                //{
                //    if (TGPAContext.Instance.Player1 != null)
                //    {
                //        buttonLocation.X = x + xButtonPosition * 2;
                //        buttonLocation.Y = y + (lineNumber * jumpSize);
                //        buttonPrinter.Draw(spriteBatch, w, TGPAContext.Instance.Player1.Device, buttonLocation, new Color(Color.White,alphaColor));
                //    }

                //    for (int i = 0; i < w.Length; i++)
                //    {
                //        linePart.Append("  ");
                //    }
                //}
                //else
                //{

                xButtonPosition += w.Length;

                if (currentLineSpacesleft - w.Length <= 0)
                {
                    currentLineSpacesleft = lineSize;
                    draw = true;
                    lineNumber++;
                    missingPart = w;
                }
                else
                {
                    currentLineSpacesleft -= w.Length;
                    linePart.Append(w + " ");
                }

                if (draw)
                {
                    spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
                    spriteBatch.DrawString(font, linePart.ToString(), new Vector2(x, y + (lineNumber * jumpSize)), color, 0f, new Vector2(), size, SpriteEffects.None, 1f);
                    spriteBatch.End();

                    draw = false;
                    linePart.Remove(0, linePart.Length - 1); //Clear buffer
                    linePart.Append(missingPart + " ");
                    missingPart = "";

                    xButtonPosition = 0;
                }
            }

            if (lineNumber > 0)
            {
                lineNumber++; //If just 1 line
            }

            //Last line
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            spriteBatch.DrawString(font, linePart.ToString(), new Vector2(x, y + (lineNumber * jumpSize)), color, 0f, new Vector2(), size, SpriteEffects.None, 1f);
            spriteBatch.End();
        }
 /// <summary>
 /// Write text at the specified location.
 /// </summary>
 /// <param name="location"></param>
 /// <param name="s"></param>
 public void Write(TGPASpriteBatch spriteBatch, Vector2 location, String s)
 {
     this.Write(spriteBatch, location.X, location.Y, s, 1024);
 }
 /// <summary>
 /// Write text at the specified location.
 /// </summary>
 /// <param name="location"></param>
 /// <param name="s"></param>
 public void Write(TGPASpriteBatch spriteBatch,float x, float y, String s)
 {
     this.Write(spriteBatch,x, y, s, 1024);
 }
예제 #26
0
        public override void Draw(TGPASpriteBatch spriteBatch)
        {
            dRect.X = (int)this.Location.X;
            dRect.Y = (int)this.Location.Y;

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);

            Color c = Color.White;

            if (IsHit)
            {
                c = Color.Red *0.95f;
                IsHit = false;
            }

            //Rotation can be used in update but not in draw
            float finalrotation = UseRotationWhenDrawing ? (float)rotation : 0.0f;

            spriteBatch.Draw(this.Sprite, this.DstRect, this.SrcRect, c, finalrotation, this.spriteOrigin, Flip, 1.0f);

            spriteBatch.End();
        }
        public override void Draw(TGPASpriteBatch spriteBatch)
        {
            Color c = Color.White;

            if (IsHit)
            {
                c = Color.Green *0.5f;
                IsHit = false;
            }

            if (attacks == AttackBoss2.Grow)
            {
                c = Color.Red;
            }

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            spriteBatch.Draw(this.Sprite, dRect, sRect, c, 0.0f, Vector2.Zero, Flip, 1.0f);
            spriteBatch.End();
        }
        public override void Draw(TGPASpriteBatch spriteBatch)
        {
            Rectangle src = new Rectangle();
            Rectangle dst = new Rectangle();

            Color c = Color.White;

            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);

            if (Focus)
            {
                //Draw left arrow
                //************************************************************

                if (!drawLeft)
                {
                    c = (Color.Gray * 0.3f);
                }

                leftArrowDst = arrowSrc;
                leftArrowDst.X = (int)location.X + 200;
                leftArrowDst.Y = (int)location.Y;

                src = arrowSrc;
                if (focus == leftArrowDst)
                {
                    src.X += src.Width;
                }
                spriteBatch.Draw(this.Sprite, leftArrowDst, src, c);
            }
            spriteBatch.End();

            //Draw element
            //************************************************************
            dst = this.focusedElement.SrcRect;
            dst.X = (int)location.X + 200 + arrowSrc.Width;
            dst.Y = (int)location.Y;

            src = this.focusedElement.SrcRect;
            this.focusedElement.Draw(dst, spriteBatch);

            if (Focus)
            {

                //Draw right arrow
                //************************************************************
                c = Color.White;
                if (!drawRight)
                {
                    c = Color.Gray * 0.3f;
                }

                rightArrowDst = arrowSrc;
                rightArrowDst.X = (int)location.X + 200 + arrowSrc.Width + this.focusedElement.SrcRect.Width;
                rightArrowDst.Y = (int)location.Y;

                src = arrowSrc;
                if (focus == rightArrowDst)
                {
                    src.X += src.Width;
                }
                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
                spriteBatch.Draw(this.Sprite, rightArrowDst, src, c, 0.0f, Vector2.Zero, SpriteEffects.FlipHorizontally, 1.0f);

                //************************************************************
                spriteBatch.End();

                if (confirmButtonEnable)
                {

                    spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);

                    if (focus == this.confirmButton)
                    {
                        spriteBatch.Draw(TGPAContext.Instance.HudTex, this.confirmButton, TGPAContext.Instance.PaperRect, Color.Green * 0.5f);

                    }
                    else
                    {
                        spriteBatch.Draw(TGPAContext.Instance.HudTex, this.confirmButton, TGPAContext.Instance.PaperRect, Color.Aquamarine * 0.5f);
                    }

                    spriteBatch.End();

                    TGPAContext.Instance.TextPrinter.Write(spriteBatch, this.confirmButton.X + 15, this.confirmButton.Y + 15, LocalizedStrings.GetString(this.confirmButtonlabel), 512);
                }

                //Draw help buttons for Pad
                if (TGPAContext.Instance.Player1.IsPlayingOnWindows() == false && (Focus))
                {
                    if (confirmButtonEnable)
                    {
                        TGPAContext.Instance.ButtonPrinter.Draw(spriteBatch, "#Confirm", TGPAContext.Instance.Player1.Device.Type, confirmButton.X + confirmButton.Width, this.confirmButton.Y);
                    }
                }
            }

            TGPAContext.Instance.TextPrinter.Color = Color.Navy;
            TGPAContext.Instance.TextPrinter.Write(spriteBatch, this.location.X, this.location.Y, this.name, 512);
            TGPAContext.Instance.TextPrinter.Color = Color.Black;
        }
 public void Draw(TGPASpriteBatch spriteBatch, Texture2D texture)
 {
     spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
     spriteBatch.Draw(texture, dst, src, Color.White, 0.0f, Vector2.Zero, direction > 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 1.0f);
     spriteBatch.End();
 }
 public abstract void Draw(TGPASpriteBatch spriteBatch);
        public void Draw(TGPASpriteBatch spriteBatch)
        {
            TGPAContext.Instance.TextPrinter.Write(spriteBatch, 110, this.Y, this.SectionName);

            foreach (TGPAControl[] controlList in controls)
            {
                foreach (TGPAControl control in controlList)
                {
                    if (control != null)
                    {
                        control.Draw(spriteBatch);
                    }
                }
            }

            TGPAContext.Instance.TextPrinter.SetDefaultFont();
        }