/// <summary> /// Construct a new HudText internally and automatically add it to the internal list /// </summary> /// <param name="newX"></param> /// <param name="newY"></param> /// <param name="newText"></param> /// <param name="newFont"></param> /// <param name="newColor"></param> public HudText AddHudText(float newX, float newY, string newText, Azul.AZUL_FONTS newFont, Azul.Color newColor) { HudText newHudText = new HudText(newX, newY, newText, newFont, newColor); this.AddHudText(newHudText); return(newHudText); }
/// <summary> /// Draw every element in this HUD display /// </summary> public void Draw() { // Draw the icons this.iconLives.Draw(); // Draw all the text HudText itr = this.hudTextList.Head as HudText; while (itr != null) { // Reset itr.Draw(); // Next node itr = itr.next as HudText; } // Draw all the disposable text itr = this.disposableHudTextList.Head as HudText; while (itr != null) { // Reset itr.Draw(); // Next node itr = itr.next as HudText; } // Draw additional things if need this.OnDraw(); }
// // Methods // /// <summary> /// Initialize the layout and objects to display on the HUD /// </summary> public void Initialize() { // Create the lives icon this.iconLives = new HudIcon(IconLivesX, IconLivesY, Colors.Green, IconLivesSpacing, this.internalLives - 1, Sprite.Name.HUD_Player ); // Still Text HudText p1StillText = new HudText(LabelP1X, HighTextY, "SCORE< 1 >"); this.AddHudText(p1StillText); HudText highScoreStillText = new HudText(LabelHighscoreX, HighTextY, "HI-SCORE"); this.AddHudText(highScoreStillText); HudText p2StillText = new HudText(LabelP2X, HighTextY, "SCORE< 2 >"); this.AddHudText(p2StillText); HudText creditStillText = new HudText(CreditZeroX, LowTextY, "CREDIT 00"); this.AddHudText(creditStillText); // Updating Text this.textScoreP1 = new HudText(TextScoreP1X, MostlyHighTextY, this.internalScoreP1.ToString()); this.AddHudText(this.textScoreP1); this.textScoreP2 = new HudText(TextScoreP2X, MostlyHighTextY, this.internalScoreP2.ToString()); this.AddHudText(this.textScoreP2); this.textHighScore = new HudText(TextHighscoreX, MostlyHighTextY, this.internalHighscore.ToString()); this.AddHudText(this.textHighScore); this.textLives = new HudText(TextLivesX, LowTextY, this.internalLives.ToString()); this.AddHudText(this.textLives); // Additional initialization if requested by derived class this.OnInit(); }
/// <summary> /// Add a new HudText instance to the disposable list /// </summary> /// <param name="newText"></param> public void AddDisposableHudText(HudText newText) { this.disposableHudTextList.PushFront(newText); }
/// <summary> /// Add a new HudText instance to the list /// </summary> /// <param name="newText"></param> public void AddHudText(HudText newText) { this.hudTextList.PushFront(newText); }