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; }
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); }
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) { //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 }
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); }
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); }
/// <summary> /// Draw a sleeping cat + map information /// </summary> /// <param name="spriteBatch"></param> public void Draw(TGPASpriteBatch spriteBatch) { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(TGPAContext.Instance.NullTex, backgroundDst, null, Color.White); spriteBatch.End(); //Draw background if ((this.previewBG1 != null) && (this.previewBG1Fadeout > 0.0f)) { if (this.previewBG1.SpriteTexture != null) { Color c = Color.White * previewBG1Fadeout; spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(this.previewBG1.SpriteTexture, backgroundDst, null, c); spriteBatch.End(); } } if ((this.previewBG2 != null) && (this.previewBG2Fadeout > 0.0f)) { if (this.previewBG2.SpriteTexture != null) { Color c = (Color.White * previewBG2Fadeout); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(this.previewBG2.SpriteTexture, backgroundDst, null, c); spriteBatch.End(); } } spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(texture, backgroundDst, background, Color.White); spriteBatch.End(); Rectangle rect2 = new Rectangle(170, 195, 685, 220); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(TGPAContext.Instance.NullTex, rect2, Color.White * 0.55f); spriteBatch.End(); //display name and description Vector2 textPosition = new Vector2(500, 85); textPosition.X -= (overview.Name.Length / 2) * 10; TGPAContext.Instance.TextPrinter.Color = Color.Black; TGPAContext.Instance.TextPrinter.Write(spriteBatch, textPosition.X, textPosition.Y, overview.Name, 50); textPosition = new Vector2(185, 180); TGPAContext.Instance.TextPrinter.Size = 1f; TGPAContext.Instance.TextPrinter.Write(spriteBatch, textPosition.X, textPosition.Y, overview.Description, 45); Rectangle dst = currentloading; dst.X = TGPAContext.Instance.ScreenWidth / 2 - dst.Width / 2; dst.Y = (2 * TGPAContext.Instance.ScreenHeight / 3 - dst.Height / 2); if (!TGPAContext.Instance.MapLoaded) { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(texture, dst, currentloading, Color.White); spriteBatch.End(); } else { Rectangle rect3 = new Rectangle(410, 470, 190, 55); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(TGPAContext.Instance.NullTex, rect3, Color.White * 0.45f); spriteBatch.End(); dst.Y -= dst.Height; TGPAContext.Instance.ButtonPrinter.Draw(spriteBatch, "#Confirm", TGPAContext.Instance.Player1.Device.Type, new Vector2((TGPAContext.Instance.ScreenWidth / 2) - 100, dst.Y + dst.Height + 50), Color.White); TGPAContext.Instance.TextPrinter.Write(spriteBatch, TGPAContext.Instance.ScreenWidth / 2 - 50, dst.Y + dst.Height + 50, LocalizedStrings.GetString("LevelSelectionScreenPressStart"), 64); } }
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); spriteBatch.Draw(this.Sprite, dRect, sRect, c, 0.0f, Vector2.Zero, Flip, 1.0f); spriteBatch.End(); }
public void Draw(TGPASpriteBatch spriteBatch, Texture2D bonus_sprites) { this.color = Color.White *alpha; spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(bonus_sprites, dRect, sRect, color); spriteBatch.End(); }
/// <summary> /// Draw a line between 2 points /// </summary> /// <param name="sp"></param> public static void DrawLine(TGPASpriteBatch sp, Point p1, Point p2) { sp.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend); for (int x = 1; x < 20; x++) { Vector2 tVec = new Vector2(p1.X, p1.Y); Vector2 nVec = new Vector2(p2.X, p2.Y); Vector2 iVec = (nVec - tVec) * ((float)x / 20.0f) + tVec; sp.Draw(GlobalSprite, iVec, sRectLine, Color.White); } sp.End(); }
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) { 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 void Draw(TGPASpriteBatch spriteBatch) { if (drawBossLifebar) { //Draw lifebar : inside Rectangle dst = srcBarIn; dst.X = (TGPAContext.Instance.ScreenWidth - srcBarIn.Width) / 2; #if XBOX dst.Y = TGPAContext.Instance.TitleSafeArea.Bottom - srcBarIn.Height; #else dst.Y = TGPAContext.Instance.TitleSafeArea.Bottom - 2 * srcBarIn.Height; #endif dst.Width = (int)((double)initWidth * bossLifePurcent); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(TGPAContext.Instance.HudTex, dst, srcBarIn, Color.White); //Then a rectangle dst.Width = srcBarOut.Width; spriteBatch.Draw(TGPAContext.Instance.HudTex, dst, srcBarOut, Color.White); spriteBatch.End(); } if (drawWarning) { Rectangle dst = new Rectangle((TGPAContext.Instance.ScreenWidth / 2) - (warningSprite.Width / 2), (TGPAContext.Instance.ScreenHeight / 2) - (warningSprite.Height / 2), warningSprite.Width, warningSprite.Height); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(warningSprite, dst, Color.White * alpha); spriteBatch.End(); } //*************************************** // Player 1 HUD //*************************************** #region Player 1 HUD Rectangle sRect; Rectangle dRect; Color cCheat = Color.White; if (TGPAContext.Instance.Player1.Lives >= 0) { TGPAContext.Instance.TextPrinter.Color = Color.Black; TGPAContext.Instance.TextPrinter.Size = 1; sRect = this.Lives; dRect = this.Lives; dRect.X = TGPAContext.Instance.TitleSafeArea.Left + 10; dRect.Y = TGPAContext.Instance.TitleSafeArea.Top; dRect.Width = (int)(((float)this.Lives.Width) / 2.0f); dRect.Height = (int)(((float)this.Lives.Height) / 2.0f); int leftX = dRect.X; if (TGPAContext.Instance.Cheatcodes.IsInvincible) cCheat = (new Color(Color.Silver.R, Color.Silver.G, Color.Silver.B, 0.75f)); if (TGPAContext.Instance.Player1.Lives < 6) { for (int i = 0; i < TGPAContext.Instance.Player1.Lives; i++) { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(TGPAContext.Instance.HudTex, dRect, sRect, cCheat); spriteBatch.End(); dRect.X += 20; } } else { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(TGPAContext.Instance.HudTex, dRect, sRect, cCheat); spriteBatch.End(); TGPAContext.Instance.TextPrinter.Write(spriteBatch,dRect.X + dRect.Width + 5, 20 + dRect.Y, "x " + TGPAContext.Instance.Player1.Lives, 128); } sRect = this.Bombs; dRect = this.Bombs; dRect.X = TGPAContext.Instance.TitleSafeArea.Left + 10; dRect.Y = TGPAContext.Instance.TitleSafeArea.Top + 50; dRect.Width = (int)(((float)this.Lives.Width) / 2.0f); dRect.Height = (int)(((float)this.Lives.Height) / 2.0f); if (TGPAContext.Instance.Player1.Bomb.Ammo < 6) { for (int i = 0; i < TGPAContext.Instance.Player1.Bomb.Ammo; i++) { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(TGPAContext.Instance.HudTex, dRect, sRect, cCheat); spriteBatch.End(); dRect.X += 20; } } else { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(TGPAContext.Instance.HudTex, dRect, sRect, Color.White); spriteBatch.End(); TGPAContext.Instance.TextPrinter.Write(spriteBatch,dRect.X + dRect.Width + 5, 65 + TGPAContext.Instance.TitleSafeArea.Top, "x " + TGPAContext.Instance.Player1.Bomb.Ammo); } //Ammo left sRect = this.Ammo; dRect = this.Ammo; dRect.X = TGPAContext.Instance.TitleSafeArea.Left + 10; dRect.Y = TGPAContext.Instance.TitleSafeArea.Top + 90; spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(TGPAContext.Instance.HudTex, dRect, sRect, cCheat); spriteBatch.End(); sRect = this.AmmoLevel; dRect = this.AmmoLevel; dRect.X = TGPAContext.Instance.TitleSafeArea.Left + 58; dRect.Y = TGPAContext.Instance.TitleSafeArea.Top + 90 + 59; double purcentAmmo = (float)TGPAContext.Instance.Player1.Weapon.Ammo / (float)TGPAContext.Instance.Player1.Weapon.MaxAmmo; double rotation = purcentAmmo * Math.PI; Color c = Color.White; if (rotation > this.CurrentNeedleAngleP1) { this.CurrentNeedleAngleP1 += 0.01; if (this.CurrentNeedleAngleP1 > rotation) this.CurrentNeedleAngleP1 = rotation; } else if (rotation < this.CurrentNeedleAngleP1) { this.CurrentNeedleAngleP1 -= 0.01; if (this.CurrentNeedleAngleP1 < rotation) this.CurrentNeedleAngleP1 = rotation; } if (this.CurrentNeedleAngleP1 > Math.PI) { this.CurrentNeedleAngleP1 = Math.PI; } if (this.CurrentNeedleAngleP1 > 3 * Math.PI / 4) c = new Color(Color.Green.R, Color.Green.G, Color.Green.B, 0.8f); else if ((this.CurrentNeedleAngleP1 < 3 * Math.PI / 4) && (rotation > 2 * Math.PI / 4)) c = new Color(Color.Blue.R, Color.Blue.G, Color.Blue.B, 0.8f); else if (this.CurrentNeedleAngleP1 < 2 * Math.PI / 4) { c = (new Color(Color.Red.R, Color.Red.G, Color.Red.B, 0.8f)); if (this.CurrentNeedleAngleP1 < Math.PI / 5) { TGPAContext.Instance.TextPrinter.Write(spriteBatch,leftX, dRect.Y + dRect.Height, LocalizedStrings.GetString("LowAmmo"), 128); } } spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(TGPAContext.Instance.HudTex, dRect, sRect, c, (float)this.CurrentNeedleAngleP1, new Vector2(34, 12), SpriteEffects.None, 1.0f); spriteBatch.End(); //Ammo type ( = bonus to get) sRect = this.WeaponP1; dRect = this.WeaponP1; dRect.Width /= 6; dRect.Height /= 6; dRect.X = TGPAContext.Instance.TitleSafeArea.Left + 160; dRect.Y = TGPAContext.Instance.TitleSafeArea.Top; spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(TGPAContext.Instance.BonusTex, dRect, sRect, Color.White); spriteBatch.End(); //more precise debug infos if (TGPAContext.Instance.Saver.OptionsData.DebugMode) { TGPAContext.Instance.TextPrinter.Color = Color.Chartreuse; TGPAContext.Instance.TextPrinter.Write(spriteBatch,200, 0, "" + TGPAContext.Instance.Map.Scroll + " invincible : " + TGPAContext.Instance.Player1.Invincible); TGPAContext.Instance.TextPrinter.Color = Color.Black; } } #endregion //*************************************** // Player 2 HUD //*************************************** #region Player 2 HUD if ((TGPAContext.Instance.Player2 != null) && (TGPAContext.Instance.Player2.Lives >= 0)) { cCheat = Color.White; TGPAContext.Instance.TextPrinter.Color = Color.Black; TGPAContext.Instance.TextPrinter.Size = 1; sRect = this.Lives; dRect = this.Lives; dRect.X = TGPAContext.Instance.ScreenWidth - 10 - TGPAContext.Instance.TitleSafeArea.Left; dRect.Y = TGPAContext.Instance.TitleSafeArea.Top; dRect.Width = (int)(((float)this.Lives.Width) / 2.0f); dRect.Height = (int)(((float)this.Lives.Height) / 2.0f); dRect.X -= dRect.Width; if (TGPAContext.Instance.Player2.Lives < 6) { for (int i = 0; i < TGPAContext.Instance.Player2.Lives; i++) { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(TGPAContext.Instance.HudTex, dRect, sRect, cCheat); spriteBatch.End(); dRect.X -= 20; } } else { dRect.X = TGPAContext.Instance.ScreenWidth - TGPAContext.Instance.TitleSafeArea.Left - 125; spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(TGPAContext.Instance.HudTex, dRect, sRect, cCheat); spriteBatch.End(); TGPAContext.Instance.TextPrinter.Write(spriteBatch,dRect.X + dRect.Width + 5, dRect.Y + 20, "x " + TGPAContext.Instance.Player2.Lives, 128); } sRect = this.Bombs; dRect = this.Bombs; dRect.X = TGPAContext.Instance.ScreenWidth - 10 - TGPAContext.Instance.TitleSafeArea.Left; dRect.Y = 50 + TGPAContext.Instance.TitleSafeArea.Top; dRect.Width = (int)(((float)this.Lives.Width) / 2.0f); dRect.Height = (int)(((float)this.Lives.Height) / 2.0f); dRect.X -= dRect.Width; if (TGPAContext.Instance.Player2.Bomb.Ammo < 6) { for (int i = 0; i < TGPAContext.Instance.Player2.Bomb.Ammo; i++) { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(TGPAContext.Instance.HudTex, dRect, sRect, cCheat); spriteBatch.End(); dRect.X -= 20; } } else { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(TGPAContext.Instance.HudTex, dRect, sRect, cCheat); spriteBatch.End(); TGPAContext.Instance.TextPrinter.Write(spriteBatch,dRect.X - dRect.Width + 20, 65 + TGPAContext.Instance.TitleSafeArea.Top, "x " + TGPAContext.Instance.Player2.Bomb.Ammo, 128); } //Ammo left sRect = this.Ammo; dRect = this.Ammo; dRect.X = TGPAContext.Instance.ScreenWidth - dRect.Width - 10 - TGPAContext.Instance.TitleSafeArea.Left; dRect.Y = 90 + TGPAContext.Instance.TitleSafeArea.Top; spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(TGPAContext.Instance.HudTex, dRect, sRect, cCheat); spriteBatch.End(); sRect = this.AmmoLevel; dRect = this.AmmoLevel; dRect.X = TGPAContext.Instance.ScreenWidth - 58 - TGPAContext.Instance.TitleSafeArea.Left; dRect.Y = TGPAContext.Instance.TitleSafeArea.Top + 90 + 59; double rotation = ((float)TGPAContext.Instance.Player2.Weapon.Ammo / (float)TGPAContext.Instance.Player2.Weapon.MaxAmmo) * Math.PI; Color c = Color.White; if (rotation > this.CurrentNeedleAngleP2) { this.CurrentNeedleAngleP2 += 0.01; if (this.CurrentNeedleAngleP2 > rotation) this.CurrentNeedleAngleP2 = rotation; } else if (rotation < this.CurrentNeedleAngleP2) { this.CurrentNeedleAngleP2 -= 0.01; if (this.CurrentNeedleAngleP2 < rotation) this.CurrentNeedleAngleP2 = rotation; } if (this.CurrentNeedleAngleP2 > Math.PI) { this.CurrentNeedleAngleP2 = Math.PI; } if (this.CurrentNeedleAngleP2 > 3 * Math.PI / 4) c = (Color.Green * 0.8f); else if ((this.CurrentNeedleAngleP2 < 3 * Math.PI / 4) && (rotation > 2 * Math.PI / 4)) c = (Color.Blue * 0.8f); else if (this.CurrentNeedleAngleP2 < 2 * Math.PI / 4) { c = (Color.Red * 0.8f); if (this.CurrentNeedleAngleP2 < Math.PI / 5) { TGPAContext.Instance.TextPrinter.Write(spriteBatch,TGPAContext.Instance.TitleSafeArea.Right - 200, dRect.Y + dRect.Height, LocalizedStrings.GetString("LowAmmo"), 100); } } spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(TGPAContext.Instance.HudTex, dRect, sRect, c, (float)this.CurrentNeedleAngleP2, new Vector2(34, 12), SpriteEffects.None, 1.0f); spriteBatch.End(); //Ammo type ( = bonus to get) sRect = this.WeaponP2; dRect = this.WeaponP2; dRect.Width /= 6; dRect.Height /= 6; dRect.X = TGPAContext.Instance.ScreenWidth - TGPAContext.Instance.TitleSafeArea.Left - 160 - dRect.Width; dRect.Y = TGPAContext.Instance.TitleSafeArea.Top; spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(TGPAContext.Instance.BonusTex, dRect, sRect, Color.White); spriteBatch.End(); } else { if (TGPAContext.Instance.Player2 == null) { if (displayPressStartPlayer2) { String text = null; int x = 0; #if WINDOWS if (TGPAContext.Instance.Player1.Device.Type == Utils.Input.DeviceType.KeyboardMouse) { text = LocalizedStrings.GetString("P2PressStartXbox"); //Start } else { text = LocalizedStrings.GetString("P2PressStartPC"); //Start/Enter } x = TGPAContext.Instance.ScreenWidth - TGPAContext.Instance.TitleSafeArea.Left - 305; #else text = LocalizedStrings.GetString("P2PressStartXbox"); x = TGPAContext.Instance.ScreenWidth - TGPAContext.Instance.TitleSafeArea.Left - 225; #endif TGPAContext.Instance.TextPrinter.Color = displayedColor; TGPAContext.Instance.TextPrinter.Write(spriteBatch,x, TGPAContext.Instance.TitleSafeArea.Top + 15, text, 512); TGPAContext.Instance.TextPrinter.Color = Color.Black; } } } //Score sRect = this.Score; dRect = this.Score; dRect.Width = (int)(((float)this.Score.Width) / 2.0f); dRect.Height = (int)(((float)this.Score.Height) / 2.0f); int scoreX = TGPAContext.Instance.TitleSafeArea.Top; scoreX = (TGPAContext.Instance.ScreenWidth / 2) - (dRect.Width / 2); dRect.X = scoreX; int scoreY = TGPAContext.Instance.TitleSafeArea.Top; dRect.Y = scoreY; spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(TGPAContext.Instance.HudTex, dRect, sRect, cCheat); spriteBatch.End(); int total = TGPAContext.Instance.Player1.Score; if (TGPAContext.Instance.Player2 != null) { total += TGPAContext.Instance.Player2.Score; } TGPAContext.Instance.TextPrinter.Write(spriteBatch,scoreX + dRect.Width/3, scoreY + 20, "" + total, 56); #endregion }
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(); }
/// <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(); }
public void Draw(Rectangle dRect, TGPASpriteBatch spriteBatch) { //Draw element if (sRect != Rectangle.Empty) { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(sprite, dRect, sRect, Color.White); spriteBatch.End(); } Vector2 textLoc = new Vector2(dRect.X, dRect.Y); string text; if (label == null) { text = value.ToString(); } else { text = LocalizedStrings.GetString(label); } dRect.Width = text.Length + 20; dRect.Height = 20; TGPAContext.Instance.TextPrinter.Write(spriteBatch,textLoc.X, textLoc.Y, text, 1024); }
public override void Draw(TGPASpriteBatch spriteBatch) { Rectangle dRect = this.SrcRect; dRect.X = (int)location.X; dRect.Y = (int)location.Y; spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(Sprite, dRect, sRect, Color.White, (float)rotation, Vector2.Zero, Flip, 1.0f); spriteBatch.End(); }
public override void Draw(TGPASpriteBatch spriteBatch) { Color bodyColor = Color.White; if (IsHit) { if ((this.rightWheels.HP <= 0) && (this.rightHand.HP <= 0) && (this.rightEar.HP <= 0)) { bodyColor = (Color.Red *0.75f); } IsHit = false; } Color wheelsColor = Color.White; if (rightWheels.IsHit) { wheelsColor =(Color.Red *0.75f); rightWheels.IsHit = false; } Color armColor = Color.White; if ((rightHand.IsHit) || (leftHand.IsHit)) { armColor = (Color.Red * 0.75f); rightHand.IsHit = false; } Color earColor = Color.White; if (leftEar.IsHit) { earColor = (Color.Red * 0.75f); leftEar.IsHit = false; } Color posterColor = Color.Red*this.alarmColor; spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); //Left wheels spriteBatch.Draw(this.Sprite, leftWheels.DstRect, leftWheels.SrcRect, wheelsColor, (float)leftWheels.Rotation, leftWheels.SpriteOrigin, Flip, 1.0f); //Left ear spriteBatch.Draw(this.Sprite, leftEar.DstRect, leftEar.SrcRect, earColor, (float)leftEar.Rotation, leftEar.SpriteOrigin, Flip, 1.0f); //Left arm spriteBatch.Draw(this.Sprite, leftHand.DstRect, leftHand.SrcRect, armColor, (float)leftHand.ComputedRotation, leftHand.SpriteOrigin, Flip, 1.0f); //Poster ? if (drawPoster) { Rectangle realPosterDst = posterDst; realPosterDst.X = this.dRect.X + posterDst.X; realPosterDst.Y = this.dRect.Y + posterDst.Y; spriteBatch.Draw(this.Sprite, realPosterDst, posterSrc, Color.White, 0.0f, Vector2.Zero, Flip, 1.0f); spriteBatch.Draw(this.Sprite, realPosterDst, posterSrc, posterColor, 0.0f, Vector2.Zero, Flip, 1.0f); } //Body spriteBatch.Draw(this.Sprite, dRect, sRect, bodyColor, 0.0f, Vector2.Zero, Flip, 0.0f); //Right arm spriteBatch.Draw(this.Sprite, rightHand.DstRect, rightHand.SrcRect, armColor, (float)rightHand.ComputedRotation, rightHand.SpriteOrigin, Flip, 1.0f); //Right ear spriteBatch.Draw(this.Sprite, rightEar.DstRect, rightEar.SrcRect, earColor, (float)rightEar.Rotation, rightEar.SpriteOrigin, Flip, 1.0f); //Right wheels spriteBatch.Draw(this.Sprite, rightWheels.DstRect, rightWheels.SrcRect, wheelsColor, (float)rightWheels.Rotation, rightWheels.SpriteOrigin, Flip, 1.0f); spriteBatch.End(); #if DEBUG TGPAContext.Instance.TextPrinter.Write(spriteBatch,this.location, "(" + this.attackType.ToString() + ")"); #endif }
public virtual void Draw(TGPASpriteBatch spriteBatch, Texture2D texture) { dRect.X = (int)location.X; dRect.Y = (int)location.Y; Rectangle dstShotBehind = dRect; dstShotBehind.Width = (int)((float)dstShotBehind.Width * 1.2f); dstShotBehind.Height = (int)((float)dstShotBehind.Height * 1.2f); Color shotColor = Color.White; if (this.IsHit) { shotColor = Color.Red; this.IsHit = false; } if (this.EnemyFire) { if (this.DrawBehindShot) { spriteBatch.Draw(texture, dstShotBehind, sRect, this.behindColor, -(float)rotation, spriteOrigin, this.flips, 1.0f); } spriteBatch.Draw(texture, dRect, sRect, shotColor, -(float)rotation, spriteOrigin, this.flips, 1.0f); } else { if (this.DrawBehindShot) { spriteBatch.Draw(texture, dstShotBehind, sRect, this.behindColor, -(float)rotation, spriteOrigin, SpriteEffects.None, 1.0f); } spriteBatch.Draw(texture, dRect, sRect, Color.White, -(float)rotation, spriteOrigin, SpriteEffects.None, 1.0f); } }
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(); }
public void Draw(TGPASpriteBatch spriteBatch) { if (playersOut) { if (fadeOut > 0f) { Color backscreen; if (victory) { backscreen = (Color.White *this.fadeOut); } else { backscreen = (Color.Black *this.fadeOut); } spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(TGPAContext.Instance.NullTex, new Rectangle(0, 0, TGPAContext.Instance.ScreenWidth, TGPAContext.Instance.ScreenHeight), backscreen); spriteBatch.End(); } //Level spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(TGPAContext.Instance.HudTex, levelDst, TGPAContext.Instance.PaperRect,Color.White *(this.fadeOut + 0.1f)); spriteBatch.End(); String toPrint = "Level : " + TGPAContext.Instance.Map.Level; int w = 20 + toPrint.Length * 11; TGPAContext.Instance.TextPrinter.Write(spriteBatch,levelDst.X + (levelDst.Width / 2) - w / 2, levelDst.Y + (levelDst.Height / 4), toPrint, 512); toPrint = TGPAContext.Instance.Map.Name; w = 20 + toPrint.Length * 11; TGPAContext.Instance.TextPrinter.Write(spriteBatch,levelDst.X + (levelDst.Width / 2) - w / 2, levelDst.Y + (levelDst.Height / 2), TGPAContext.Instance.Map.Name, 512); //Score #region Score compute if (playersOut) { scoreDst.X = TGPAContext.Instance.ScreenWidth / 2 - scoreDst.Width / 2; spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(sprites, scoreDst, scoreSrc, Color.White); spriteBatch.End(); double duree = (elapsedGameTime - startGameTime); int h = (int)((duree / 1000) / 3600); int m = (int)(((duree / 1000) / 60) % 60); int s = (int)((duree / 1000) % 60); if (!victory) { TGPAContext.Instance.TextPrinter.Color = Color.Red; } if (cheat) { TGPAContext.Instance.TextPrinter.Color = Color.Silver; } int x = 137; int xbis = 337; int y = 212; TGPAContext.Instance.TextPrinter.Write(spriteBatch,x, y, LocalizedStrings.GetString("EndlevelScreenElapsedTime") + " : "); TGPAContext.Instance.TextPrinter.Color = Color.Black; TGPAContext.Instance.TextPrinter.Write(spriteBatch,xbis, 240, h.ToString("00") + "h" + m.ToString("00") + "m" + s.ToString("00") + "s"); if ((victory) && (!cheat)) { TGPAContext.Instance.TextPrinter.Write(spriteBatch,x, scoreDst.Y + 150, LocalizedStrings.GetString("EndlevelScreenRemainingLives") + " :"); //Display heart icons or just a heart and a number if (displayedLives < 6) { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); for (int i = 0; i < displayedLives; i++) { Rectangle heartDst = new Rectangle(x + i * (heartSrc.Width / 2), scoreDst.Y + 180, heartSrc.Width, heartSrc.Height); spriteBatch.Draw(sprites, heartDst, heartSrc, Color.White); } spriteBatch.End(); } else { Rectangle heartDst = new Rectangle(x, scoreDst.Y + 180, heartSrc.Width, heartSrc.Height); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(sprites, heartDst, heartSrc, Color.White); spriteBatch.End(); TGPAContext.Instance.TextPrinter.Color = Color.DarkMagenta; TGPAContext.Instance.TextPrinter.Write(spriteBatch,heartDst.Right + 10, heartDst.Center.Y, " x " + displayedLives,128); TGPAContext.Instance.TextPrinter.Color = Color.Black; } TGPAContext.Instance.TextPrinter.Write(spriteBatch,xbis, scoreDst.Y + 179, totalLives.ToString("0000000 pts")); TGPAContext.Instance.TextPrinter.Write(spriteBatch,x, scoreDst.Y + 238, LocalizedStrings.GetString("EndlevelScreenRemainingBombs") + " :"); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); for (int i = 0; i < displayedBombs; i++) { Rectangle bombDst = new Rectangle(x + i * (bombSrc.Width / 2), scoreDst.Y + 265, bombSrc.Width, bombSrc.Height); spriteBatch.Draw(sprites, bombDst, bombSrc, Color.White); } spriteBatch.End(); TGPAContext.Instance.TextPrinter.Write(spriteBatch,xbis, scoreDst.Y + 270, totalBombs.ToString("0000000 pts")); TGPAContext.Instance.TextPrinter.Write(spriteBatch,x, scoreDst.Y + 325, LocalizedStrings.GetString("EndlevelScreenLevelPoints") + " : "); TGPAContext.Instance.TextPrinter.Write(spriteBatch,xbis, scoreDst.Y + 355, score.ToString("0000000 pts")); if (scoreOK) { TGPAContext.Instance.TextPrinter.Color = Color.Blue; TGPAContext.Instance.TextPrinter.Write(spriteBatch,x, scoreDst.Y + 380, "Supertotal : "); TGPAContext.Instance.TextPrinter.Write(spriteBatch,xbis - 40, scoreDst.Y + 410, scoreTotal.ToString("0000000000 pts")); TGPAContext.Instance.TextPrinter.Color = Color.Black; } } } #endregion #region Highscore if (highscoreOK) { int xHighscoreOK = 480; TGPAContext.Instance.TextPrinter.Size = 0.9f; String mode = this.scoreTypeDisplay == ScoreType.Single ? "Mode1P" : "Mode2P"; TGPAContext.Instance.TextPrinter.Write(spriteBatch,xHighscoreOK + 65, scoreDst.Y + 90, "(" + LocalizedStrings.GetString(mode) + ")"); if (cheat) { TGPAContext.Instance.TextPrinter.Color = Color.Red; TGPAContext.Instance.TextPrinter.Write(spriteBatch,xHighscoreOK + 65, scoreDst.Y + 120, "Cheats ON (no score)"); TGPAContext.Instance.TextPrinter.Color = Color.Black; } for (int i = 0; i < 7; i++) { if ((scoreRank == (i + 1)) && (this.scoreTypeSave == this.scoreTypeDisplay)) { TGPAContext.Instance.TextPrinter.Color = Color.Green; } SerializableDictionary<string, ScoreLine[]> scoreDictionnary; if (TGPAContext.Instance.Saver.SaveData.ScoresBylevel.TryGetValue(this.scoreTypeDisplay, out scoreDictionnary)) { ScoreLine[] scoreLines; if (scoreDictionnary.TryGetValue(TGPAContext.Instance.CurrentMap, out scoreLines)) { TGPAContext.Instance.TextPrinter.Write(spriteBatch,xHighscoreOK + 65, scoreDst.Y + 150 + (i * 30), (i + 1) + ". " + scoreLines[i].ToString()); } } else { TGPAContext.Instance.Saver.AddScore(TGPAContext.Instance.CurrentMap, this.scoreTypeDisplay, ScoreLine.GetDefaultScoreLine(1)); } if (scoreRank == (i + 1)) { TGPAContext.Instance.TextPrinter.Color = Color.Black; } } TGPAContext.Instance.TextPrinter.Size = 1f; //Buttons //*************************************************************************** if (highscoreOK) { TGPAContext.Instance.TextPrinter.Color = Color.LightSalmon; TGPAContext.Instance.TextPrinter.Write(spriteBatch,600, this.scoreDst.Bottom - 65, LocalizedStrings.GetString(this.scoreTypeDisplay == ScoreType.Single ? "SwitchToScoreTypeCoop" : "SwitchToScoreTypeSingle")); TGPAContext.Instance.ButtonPrinter.Draw(spriteBatch, "#Plus", TGPAContext.Instance.Player1.Device.Type, 550, this.scoreDst.Bottom - 70); if (victory) { TGPAContext.Instance.TextPrinter.Color = Color.Black; } else { TGPAContext.Instance.TextPrinter.Color = Color.White; } TGPAContext.Instance.ButtonPrinter.Draw(spriteBatch, "#Back", TGPAContext.Instance.Player1.Device.Type, 150, 700); if (TGPAContext.Instance.Player1.IsPlayingOnWindows() == false) { TGPAContext.Instance.ButtonPrinter.Draw(spriteBatch, "#Cancel", TGPAContext.Instance.Player1.Device.Type, 200, 700); } TGPAContext.Instance.ButtonPrinter.Draw(spriteBatch, "#Confirm", TGPAContext.Instance.Player1.Device.Type, 550, 700); if (victory) { TGPAContext.Instance.TextPrinter.Write(spriteBatch,600, 700, LocalizedStrings.GetString("EndlevelScreenPressAcontinue")); } else { TGPAContext.Instance.TextPrinter.Write(spriteBatch,600, 700, LocalizedStrings.GetString("EndlevelScreenPressAretry")); } TGPAContext.Instance.TextPrinter.Write(spriteBatch,245, 700, LocalizedStrings.GetString("EndlevelScreenPressB")); TGPAContext.Instance.TextPrinter.Color = Color.Black; } } #endregion } }
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); }
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(); }
/// <summary> /// Draw the sprite on the screen /// </summary> /// <param name="theSpriteBatch"></param> public void Draw(TGPASpriteBatch theSpriteBatch) { Rectangle dst = new Rectangle((int)Position.X, (int)Position.Y, TGPAContext.Instance.ScreenWidth, TGPAContext.Instance.ScreenHeight); theSpriteBatch.Draw(SpriteTexture,dst, Color.White); }
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); }
/// <summary> /// Draw a map with points for each level, and way between them /// </summary> /// <param name="spriteBatch"></param> /// <param name="Game"></param> public void Draw(TGPASpriteBatch spriteBatch) { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); //Background spriteBatch.Draw(background, new Rectangle(0, 0, TGPAContext.Instance.ScreenWidth, TGPAContext.Instance.ScreenHeight), null, Color.White); Rectangle LastLevelDst = Rectangle.Empty; //Draw levels and a way between them for (int i = 0; i < WorldCount; i++) { //The player need to have unlocked the level to display it Rectangle levelDst = Rectangle.Empty; if ((i <= TGPAContext.Instance.Saver.SaveData.LastLevel) && (i < WorldCount)) { Vector2 loc = levelPositionOnMap[i]; levelDst = new Rectangle( (int)loc.X - levelSrc.Width / 2, (int)loc.Y - levelSrc.Height / 2, levelSrc.Width, levelSrc.Height ); Color levelColor = Color.White; Color blinkColor = Color.Gray * alphaColorForLevelBlinking; if ((selectedIndex == i) & (!shipIsMoving)) { levelColor = Color.Red; blinkColor = Color.OrangeRed * 0.0f; } else if (pointedIndex == i) { levelColor = Color.SpringGreen; blinkColor = Color.White * 0.0f; } else if (i == TGPAContext.Instance.Saver.SaveData.LastLevel) { blinkColor = Color.PaleVioletRed * alphaColorForLevelBlinking; } spriteBatch.Draw(buttons, levelDst, levelSrc, levelColor); spriteBatch.Draw(buttons, levelDst, levelSrc, blinkColor); //Draw the way if (i > 0) { Vector2 p1 = levelPositionOnMap[i - 1]; Vector2 p2 = pointsBezier[i - 1][0]; Vector2 p3 = pointsBezier[i - 1][1]; Vector2 p4 = levelPositionOnMap[i]; int requiredPoints = (int)(Math.Sqrt(Math.Pow(p4.X - p1.X, 2) + Math.Pow(p4.Y - p1.Y, 2)) / 50) + 2; //evaluate number of point to show depending of the distance between p1 an p4 Rectangle wayDst = waySrc; for (int x = 1; x < requiredPoints; x++) { float t = (float)x / (float)(requiredPoints); //quadratic bezier equation need a parameter t, with 0<=t<=1 if (t <= 1) { wayDst.X = (int)((Math.Pow(1 - t, 3)) * p1.X + 3 * (Math.Pow(1 - t, 2)) * t * p2.X + 3 * (1 - t) * t * t * p3.X + t * t * t * p4.X) - wayDst.Width / 2; wayDst.Y = (int)((Math.Pow(1 - t, 3)) * p1.Y + 3 * (Math.Pow(1 - t, 2)) * t * p2.Y + 3 * (1 - t) * t * t * p3.Y + t * t * t * p4.Y) - wayDst.Height / 2; spriteBatch.Draw(buttons, wayDst, waySrc, Color.White, 0.0f, new Vector2(waySrc.Width / 2, waySrc.Height / 2), SpriteEffects.None, 1.0f); } } } } } //Draw little ship spriteBatch.Draw(buttons, shipDst, shipSrc, Color.White, 0.0f, Vector2.Zero, shipFlip, 1.0f); //Draw selected world information Vector2 v = levelPositionOnMap[selectedIndex]; Color whiteColor = Color.White * alphaPostIt; spriteBatch.Draw(buttons, postitDst, postitSrc, whiteColor); //Play and back Buttonfor PC if (TGPAContext.Instance.Player1.IsPlayingOnWindows()) { //Launch game if (focus == LevelSelectionScreenButton.Play) { Rectangle srcBis = arrowSrc; srcBis.Y += srcBis.Height; spriteBatch.Draw(buttons, playDst, srcBis, whiteColor,0.0f,Vector2.Zero,SpriteEffects.FlipHorizontally,1.0f); } else { spriteBatch.Draw(buttons, playDst, arrowSrc, whiteColor, 0.0f, Vector2.Zero, SpriteEffects.FlipHorizontally, 1.0f); } //Back if (focus == LevelSelectionScreenButton.Back) { Rectangle srcBis = arrowSrc; srcBis.Y += srcBis.Height; spriteBatch.Draw(buttons, backDst, srcBis, whiteColor); } else { spriteBatch.Draw(buttons, backDst, arrowSrc, whiteColor); } } spriteBatch.End(); //Play and back text for PC if (TGPAContext.Instance.Player1.IsPlayingOnWindows()) { if (alphaPostIt > 0.8f) { playDst.X = 290; playDst.Y = 485; backDst.X = 90; backDst.Y = 555; string playText = "Play"; string backText = "Back to title"; TGPAContext.Instance.TextPrinter.Color = Color.Navy; TGPAContext.Instance.TextPrinter.Write(spriteBatch, playDst.X - (playText.Length * 12), playDst.Y + 5, playText); TGPAContext.Instance.TextPrinter.Color = Color.Red; TGPAContext.Instance.TextPrinter.Write(spriteBatch, backDst.X + backDst.Width, backDst.Y + 5, backText); TGPAContext.Instance.TextPrinter.Color = Color.Black; } } TGPAContext.Instance.TextPrinter.Color = (Color.Black * alphaPostIt); TGPAContext.Instance.TextPrinter.Write(spriteBatch,postitDst.X + 20, postitDst.Y + 100, "Level " + overview.Level); TGPAContext.Instance.TextPrinter.Write(spriteBatch,postitDst.X + 20, postitDst.Y + 130, overview.Name); TGPAContext.Instance.TextPrinter.Size = 0.8f; for (int i = 0; i < this.levelParts.Length; i++) { TGPAContext.Instance.TextPrinter.Write(spriteBatch,postitDst.X + 25, postitDst.Y + 170 + (80 * i), LocalizedStrings.GetString("LevelSelectionScreenPart") + " " + i + " - " + LocalizedStrings.GetString("LevelSelectionScreenBestScore")); ScoreLine bestScore = TGPAContext.Instance.Saver.GetBestScoreForLevel(this.levelParts[i], this.scoreType); if (bestScore.Score > 0) { TGPAContext.Instance.TextPrinter.Color = (Color.Blue * alphaPostIt); TGPAContext.Instance.TextPrinter.Write(spriteBatch,postitDst.X + 25, postitDst.Y + 190 + (80 * i), bestScore.ToString()); TGPAContext.Instance.TextPrinter.Write(spriteBatch, postitDst.X + 105, postitDst.Y + 210 + (80 * i), bestScore.GetDifficultyString()); } else { TGPAContext.Instance.TextPrinter.Color = (Color.Red * alphaPostIt); TGPAContext.Instance.TextPrinter.Write(spriteBatch,postitDst.X + 25, postitDst.Y + 190 + (80 * i), LocalizedStrings.GetString("LevelSelectionScreenNoHighscore")); } TGPAContext.Instance.TextPrinter.Color = (Color.Black * alphaPostIt); } TGPAContext.Instance.TextPrinter.Color = Color.Black; TGPAContext.Instance.TextPrinter.Size = 1f; if (launchLevel == false) { //Buttons //*************************************************************************** if (TGPAContext.Instance.Player1.IsPlayingOnWindows() == false) { TGPAContext.Instance.ButtonPrinter.Draw(spriteBatch, "#Move", TGPAContext.Instance.Player1.Device.Type, 535, 630); TGPAContext.Instance.ButtonPrinter.Draw(spriteBatch, "#Confirm", TGPAContext.Instance.Player1.Device.Type, 535, 700); TGPAContext.Instance.ButtonPrinter.Draw(spriteBatch, "#Cancel", TGPAContext.Instance.Player1.Device.Type, 150, 630); TGPAContext.Instance.TextPrinter.Write(spriteBatch,595, 650, LocalizedStrings.GetString("LevelSelectionScreenMove")); TGPAContext.Instance.TextPrinter.Write(spriteBatch,595, 700, LocalizedStrings.GetString("LevelSelectionScreenPressA")); TGPAContext.Instance.TextPrinter.Write(spriteBatch,205, 650, LocalizedStrings.GetString("LevelSelectionScreenPressB")); } TGPAContext.Instance.TextPrinter.Write(spriteBatch,170, 700, LocalizedStrings.GetString(this.scoreType == ScoreType.Single ? "SwitchToScoreTypeCoop" : "SwitchToScoreTypeSingle")); TGPAContext.Instance.ButtonPrinter.Draw(spriteBatch, "#Plus", TGPAContext.Instance.Player1.Device.Type, 115, 690); } if (fadeoutAlpha > 0f) { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(background, new Rectangle(0, 0, TGPAContext.Instance.ScreenWidth, TGPAContext.Instance.ScreenHeight), null, (Color.Black * fadeoutAlpha)); spriteBatch.End(); } if (launchLevel) { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(TGPAContext.Instance.HudTex, rectDst, TGPAContext.Instance.PaperRect, Color.White); spriteBatch.End(); TGPAContext.Instance.TextPrinter.Write(spriteBatch,rectDst.X + 50, rectDst.Y + 60, LocalizedStrings.GetString("Difficulty")); difficultyListControl.Draw(spriteBatch); TGPAContext.Instance.TextPrinter.Size = 0.8f; TGPAContext.Instance.TextPrinter.Write(spriteBatch,rectDst.X + 40, rectDst.Y + 125, LocalizedStrings.GetString((Difficulty)this.difficultyListControl.FocusedElement.Value + "Desc"), 50); TGPAContext.Instance.TextPrinter.Size = 1f; TGPAContext.Instance.TextPrinter.Color = Color.White; TGPAContext.Instance.ButtonPrinter.Draw(spriteBatch, "#Back", TGPAContext.Instance.Player1.Device.Type, 350, 550); TGPAContext.Instance.TextPrinter.Write(spriteBatch,400, 560, LocalizedStrings.GetString("CancelLaunchLevel")); TGPAContext.Instance.TextPrinter.Color = Color.Black; } }
public override void Draw(TGPASpriteBatch spriteBatch, Texture2D texture) { this.behindColor = moustikShotColor; Color c = Color.White; if ((5000 - ttl) > nextBlink) { switch (nextBlink) { case 1000: nextBlink = 2000; break; case 2000: nextBlink = 3000; break; case 3000: nextBlink = 3500; break; case 4000: nextBlink = 4200; break; case 4200: nextBlink = 4300; break; case 4400: nextBlink = 4600; break; case 4600: nextBlink = 4800; break; default: nextBlink = 5000; break; } c = Color.Red; this.behindColor = moustikBlinkShotColor; } if (IsHit) { c = Color.Red; this.IsHit = false; } Rectangle dstShotBehind = dRect; dstShotBehind.Width = (int)((float)dstShotBehind.Width * 1.35f); dstShotBehind.Height = (int)((float)dstShotBehind.Height * 1.35f); spriteBatch.Draw(texture, dstShotBehind, sRect, this.behindColor, -(float)rotation, spriteOrigin, this.flips, 1.0f); spriteBatch.Draw(texture, dRect, sRect, c, -(float)rotation, spriteOrigin, flips, 1.0f); }
/// <summary> /// Draw the sprite on the screen with specified dimensions (used in map editor) /// </summary> /// <param name="theSpriteBatch"></param> /// <param name="screenWidth"></param> /// <param name="screenHeight"></param> public void Draw(TGPASpriteBatch theSpriteBatch, int screenWidth, int screenHeight) { theSpriteBatch.Draw(SpriteTexture, Position, new Rectangle(0, 0, screenWidth, screenHeight), Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0); }