public void CreateHistory() { int Idx = GameLogic.CharHistory; TextTitle = GameLogic.CharacterNames[Idx]; //Animation if (TxtTitleCol == Color.Red) { TxtTitleCol = Color.Yellow; } else { TxtTitleCol = Color.Red; } UI2DRenderer.FillRectangle(new Rectangle(0, 0, 1280, 720), null, new Color(0, 0, 0, 170)); UI2DRenderer.FillRectangle(new Rectangle(130, 250, Luna.Width, Luna.Height), Luna, Color.White); UI2DRenderer.FillRectangle(new Rectangle(50, 190, MenuHistory[Idx].Width, MenuHistory[Idx].Height), MenuHistory[Idx], Color.White); UI2DRenderer.FillRectangle(new Rectangle(255, 220, FrameW, FrameH), CarsTextures[Idx], Color.White); UI2DRenderer.FillRectangle(new Rectangle(255 - 15, 220 - 15, FrameW + 30, FrameH + 30), Marco, Color.White); UI2DRenderer.FillRectangle(new Rectangle(600, 140, 440, 535), null, new Color(0, 0, 0, 255)); UI2DRenderer.WriteText(new Vector2(610, 155), GameLogic.HistoryPers[Idx], Color.LawnGreen, CasioFont, new Vector2(0.75f, 0.75f)); // Draw a 2D text string at the center of the screen UI2DRenderer.WriteText(new Vector2(0, 50), TextTitle, Color.Red, PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None); UI2DRenderer.WriteText(new Vector2(450, 670), "Continue", TxtTitleCol, BladeFont, new Vector2(1.0f, 1.0f)); }
public void CreateBoxStatus(Vector2 BoxPos, Game_Player Player) { if (Player.PlyHealth < 0) { Player.PlyHealth = 0; } int PosX = (int)BoxPos.X; int PosXP = (int)BoxPos.X + BoxStatusTx[0].Width; int PoxY = (int)BoxPos.Y + 25; int Healt = Player.PlyHealth / 5; int Popul = Player.Popularity / 5; TextTitle = Player.PlyName; Color ColorHBar = new Color(new Vector4(255, 0, 0, 10)); Color ColorHPolBar = new Color(new Vector4(255, 255, 255, 10)); UI2DRenderer.FillRectangle(new Rectangle(PosX, PoxY, BoxStatusTx[0].Width, BoxStatusTx[0].Height), BoxStatusTx[0], ColorHBar); UI2DRenderer.FillRectangle(new Rectangle(PosX, PoxY + 20, BoxStatusTx[0].Width, BoxStatusTx[0].Height), BoxStatusTx[0], ColorHPolBar); PosX += BoxStatusTx[0].Width; UI2DRenderer.FillRectangle(new Rectangle(PosX, PoxY, BoxStatusTx[1].Width * Healt, BoxStatusTx[1].Height), BoxStatusTx[1], ColorHBar); //UI2DRenderer.FillRectangle(new Rectangle(PosX, PoxY + 20, BoxStatusTx[1].Width * Popul, BoxStatusTx[1].Height), BoxStatusTx[1], ColorHPolBar); PosX += BoxStatusTx[1].Width * Healt; PosXP += BoxStatusTx[1].Width * Popul; UI2DRenderer.FillRectangle(new Rectangle(PosX, PoxY, BoxStatusTx[2].Width, BoxStatusTx[2].Height), BoxStatusTx[2], ColorHBar); //UI2DRenderer.FillRectangle(new Rectangle(PosXP, PoxY + 20, BoxStatusTx[2].Width, BoxStatusTx[2].Height), BoxStatusTx[2], ColorHPolBar); UI2DRenderer.WriteText(BoxPos, TextTitle, Color.DarkGray, CalibriFont, new Vector2(0.5f, 0.5f)); }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { UI2DRenderer.WriteText(Vector2.Zero, "Light Direction: " + lightSource.Direction.ToString(), Color.White, textFont); scene.Draw(gameTime.ElapsedGameTime, gameTime.IsRunningSlowly); }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { // Draw a 2D text string at the center of the screen UI2DRenderer.WriteText(Vector2.Zero, label, Color.Black, textFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.Top); scene.Draw(gameTime.ElapsedGameTime, gameTime.IsRunningSlowly); }
public void PutCordenates(string Legend, Vector3 Cord, Vector2 Pos) { UI2DRenderer.WriteText(Pos, Legend + " X: " + Cord.X.ToString() + " Y: " + Cord.Y.ToString() + " Z: " + Cord.Z.ToString(), Color.LightCyan, DefaultFont, new Vector2(0.5f, 0.5f)); }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { // If car is not null and already added to the physics engine if (car != null && ((NewtonPhysics)scene.PhysicsEngine).GetBody(car) != IntPtr.Zero) { // Gets the keyboard state KeyboardState keyboard = Keyboard.GetState(); // Control the car steering with right and left arrow keys if (keyboard.IsKeyDown(Keys.Right)) { car.SetSteering(-1); } else if (keyboard.IsKeyDown(Keys.Left)) { car.SetSteering(1); } else { car.SetSteering(0); } // Control the car's forward torque with up and down arrow keys if (keyboard.IsKeyDown(Keys.Up)) { car.SetTireTorque(1); } else if (keyboard.IsKeyDown(Keys.Down)) { car.SetTireTorque(-1); } else { car.SetTireTorque(0); } // Control the hand brake with space key if (keyboard.IsKeyDown(Keys.Space)) { car.ApplyHandBrakes(1); } else { car.ApplyHandBrakes(0); } } UI2DRenderer.WriteText(new Vector2(5, 30), "Press the following keys to change " + "the active camera:", Color.Red, textFont, Vector2.One * 0.5f); UI2DRenderer.WriteText(new Vector2(5, 50), "'C' -- Car chasing camera", Color.Red, textFont, Vector2.One * 0.5f); UI2DRenderer.WriteText(new Vector2(5, 70), "'F' -- Far camera", Color.Red, textFont, Vector2.One * 0.5f); UI2DRenderer.WriteText(new Vector2(5, 90), "'N' -- Near camera", Color.Red, textFont, Vector2.One * 0.5f); scene.Draw(gameTime.ElapsedGameTime, gameTime.IsRunningSlowly); }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { // Draw a 2D text string at the center of the screen // NOTE: Since scene.Draw(..) (which is called by base.Draw(..)) will clear the // background this WriteText function should be called after base.Draw(..). UI2DRenderer.WriteText(Vector2.Zero, "Hello World!!", Color.GreenYellow, textFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.Center); scene.Draw(gameTime.ElapsedGameTime, gameTime.IsRunningSlowly); }
public void PutGameData(int PosX, int PosY) { UI2DRenderer.WriteText(new Vector2(PosX, PosY + 0), "Actual Level:" + GameLogic.ActualLevel.ToString(), Color.LightCyan, DefaultFont, new Vector2(0.5f, 0.5f)); UI2DRenderer.WriteText(new Vector2(PosX, PosY + 20), "Game State:" + GameLogic.CurrentGameState.ToString(), Color.LightCyan, DefaultFont, new Vector2(0.5f, 0.5f)); UI2DRenderer.WriteText(new Vector2(PosX, PosY + 40), "Game Mode:" + GameLogic.GameMode.ToString(), Color.LightCyan, DefaultFont, new Vector2(0.5f, 0.5f)); UI2DRenderer.WriteText(new Vector2(PosX, PosY + 60), "Multi Mode:" + GameLogic.MultiplayerMode.ToString(), Color.LightCyan, DefaultFont, new Vector2(0.5f, 0.5f)); UI2DRenderer.WriteText(new Vector2(PosX, PosY + 80), "Num Playes:" + GameLogic.NumberPlayers.ToString(), Color.LightCyan, DefaultFont, new Vector2(0.5f, 0.5f)); UI2DRenderer.WriteText(new Vector2(PosX, PosY + 100), "Pause:" + GameLogic.Pause_State.ToString(), Color.LightCyan, DefaultFont, new Vector2(0.5f, 0.5f)); UI2DRenderer.WriteText(new Vector2(PosX, PosY + 120), "Std Screen:" + GameLogic.StateScreen.ToString(), Color.LightCyan, DefaultFont, new Vector2(0.5f, 0.5f)); }
public void CreateBuilding() { TxtTitleCol = new Color(255, 10, 10, AlfaColor); AlfaColor -= 3; if (AlfaColor < 0) { AlfaColor = 255; } // texto en Construccion UI2DRenderer.WriteText(new Vector2(10, 5), "Building", TxtTitleCol, BladeFont); }
protected override void PaintComponent() { base.PaintComponent(); if (label.Length > 0) { if (textFont != null) { UI2DRenderer.WriteText(textPos, label, textColor, textFont); } } }
public void CreateMenuPause() { int Idx = (int)GameLogic.Pause_State; TextTitle = "PAUSE GAME"; UI2DRenderer.FillRectangle(new Rectangle(450, 200, MenuMPauseSprites[Idx].Width, MenuMPauseSprites[Idx].Height), MenuMPauseSprites[Idx], Color.White); // Draw a 2D text string at the center of the screen UI2DRenderer.WriteText(Vector2.Zero, TextTitle, TxtTitleCol, PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.Top); }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { #if WINDOWS_PHONE UI2DRenderer.WriteText(Vector2.Zero, "Tap the screen to toggle the animation!!", Color.GreenYellow, textFont); #else // Draw a 2D text string at the center of the screen UI2DRenderer.WriteText(Vector2.Zero, "Press 'A' to toggle the animation!!", Color.GreenYellow, textFont); #endif scene.Draw(gameTime.ElapsedGameTime, gameTime.IsRunningSlowly); }
public void CreateMenuPly() { int Idx; string NumberPly; TextTitle = "Select Your Player"; UI2DRenderer.FillRectangle(new Rectangle(0, 0, 1280, 720), null, new Color(0, 0, 0, 170)); UI2DRenderer.FillRectangle(new Rectangle(130, 250, Luna.Width, Luna.Height), Luna, Color.White); for (Idx = 0; Idx < 8; Idx++) { UI2DRenderer.FillRectangle(new Rectangle((int)PosObjMenu[Idx].X, (int)PosObjMenu[Idx].Y, FrameW, FrameH), CarsTextures[Idx], Color.White); UI2DRenderer.FillRectangle(new Rectangle((int)PosObjMenu[Idx].X - 15, (int)PosObjMenu[Idx].Y - 15, FrameW + 30, FrameH + 30), Marco, Color.White); } for (Idx = 0; Idx < GameLogic.NumberPlayers; Idx++) { UI2DRenderer.DrawRectangle(new Rectangle((int)PosObjMenu[GameLogic.Players[Idx].PlySelect - 1].X, (int)PosObjMenu[GameLogic.Players[Idx].PlySelect - 1].Y, FrameW, FrameH), GameLogic.Players[Idx].PlayerColor, 5); if (!GameLogic.Players[Idx].IsPlyOK) { NumberPly = (Idx + 1).ToString(); } else { NumberPly = "X"; } //Player Number UI2DRenderer.WriteText(new Vector2(PosObjMenu[GameLogic.Players[Idx].PlySelect - 1].X + 8, PosObjMenu[GameLogic.Players[Idx].PlySelect - 1].Y + 2), NumberPly, GameLogic.Players[Idx].PlayerColor, BladeFont); } /******** text For the Screen ********/ UI2DRenderer.WriteText(new Vector2(0, 50), TextTitle, Color.Red, PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None); UI2DRenderer.WriteText(new Vector2(1050, 680), TextIP, new Color(255, 10, 10, 255), CalibriFont, new Vector2(0.8f, 0.8f)); UI2DRenderer.WriteText(new Vector2(0, 610), TextMsg, new Color(255, 10, 10, 255), BladeFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None); }
protected override void Draw(GameTime gameTime) { if (useImageSequence) { if (calibrateNextSequence) { Calibrate(); if (sequenceID < imageNames.Length - 1) { sequenceID++; ((NullCapture)captureDevice).StaticImageFile = imageNames[sequenceID]; } else { FinalizeCalibration(); } calibrateNextSequence = false; } UI2DRenderer.WriteText(Vector2.Zero, "Press ENTER key to proceed to the next image", Color.Yellow, font, Vector2.One * 0.6f, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.Bottom); } else { timer += (float)gameTime.ElapsedGameTime.TotalMilliseconds; // If we are still collecting calibration data // - For every 1.5s add calibration data from detected 7*9 chessboard if (captureCount < CALIB_COUNT_MAX) { if (timer >= CAPTURE_INTERVAL) { Calibrate(); timer = 0; } } else { if (!finalized) { FinalizeCalibration(); } } } scene.Draw(gameTime.ElapsedGameTime, gameTime.IsRunningSlowly); }
protected override void PaintComponent() { base.PaintComponent(); // Show the highlight when mouse is over if (focused) { UI2DRenderer.DrawRectangle(focusRect, focusedColor, 2); } if (label.Length > 0 && textFont != null) { UI2DRenderer.WriteText(textPos, label, textColor, textFont); } }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { #if WINDOWS_PHONE UI2DRenderer.WriteText(Vector2.Zero, "Tap the screen to toggle the animation!!", Color.GreenYellow, textFont); UI2DRenderer.WriteText(new Vector2(0, 35), textToPrint, Color.GreenYellow, textFont); #else // Draw a 2D text string at the center of the screen UI2DRenderer.WriteText(Vector2.Zero, "Press the 'Space' bar to play the animation!!", Color.Orange, textFont); UI2DRenderer.WriteText(new Vector2(0, 40), textToPrint, Color.Orange, textFont); #endif scene.Draw(gameTime.ElapsedGameTime, gameTime.IsRunningSlowly); }
public void CreateMenuPlayMode() { int Idx = (int)GameLogic.MultiplayerMode; TextTitle = "Select the Multiplayer mode"; UI2DRenderer.FillRectangle(new Rectangle(0, 0, 1280, 720), null, new Color(0, 0, 0, 170)); UI2DRenderer.FillRectangle(new Rectangle(130, 250, Luna.Width, Luna.Height), Luna, Color.White); UI2DRenderer.FillRectangle(new Rectangle(450, 170, MenuMPlaySprites[Idx].Width, MenuMPlaySprites[Idx].Height), MenuMPlaySprites[Idx], Color.White); // Draw a 2D text string at the center of the screen UI2DRenderer.WriteText(new Vector2(0, 90), TextTitle, Color.Red, PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None); UI2DRenderer.WriteText(new Vector2(0, 55), TextRobert, Color.Gray, RoboCopFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None); }
public void CreateRankingTour() { int Idx; Idx = (int)GameLogic.EndActionTour; TextTitle = "Tournament Ranking"; //Animation if (TxtTitleCol == Color.Red) { TxtTitleCol = Color.Yellow; } else { TxtTitleCol = Color.Red; } UI2DRenderer.FillRectangle(new Rectangle(0, 0, 1280, 720), null, new Color(0, 0, 0, 170)); UI2DRenderer.FillRectangle(new Rectangle(130, 250, Luna.Width, Luna.Height), Luna, Color.White); UI2DRenderer.FillRectangle(new Rectangle(560, 560, MenuTourt[Idx].Width, MenuTourt[Idx].Height), MenuTourt[Idx], Color.White); for (Idx = 0; Idx < GameLogic.NumberPlayers; Idx++) { UI2DRenderer.FillRectangle(new Rectangle((int)PosObjMenu[Idx].X, 220, FrameW, FrameH), CarsTextures[GameLogic.Players[Idx].PlySelect - 1], Color.White); UI2DRenderer.FillRectangle(new Rectangle((int)PosObjMenu[Idx].X - 15, 220 - 15, FrameW + 30, FrameH + 30), Marco, Color.White); if (GameLogic.Players[Idx].IsDead == true) { UI2DRenderer.FillRectangle(new Rectangle((int)PosObjMenu[Idx].X - 15, 220 - 15, FrameW + 30, FrameH + 30), Muerte, Color.White); } else { UI2DRenderer.WriteText(new Vector2((int)PosObjMenu[Idx].X - 5, 160), "Winner!", TxtTitleCol, PuntosFont); } UI2DRenderer.WriteText(new Vector2((int)PosObjMenu[Idx].X + 10, 425), "Deaths: " + GameLogic.Players[Idx].NumDeads, Color.Red, BladeFont); //UI2DRenderer.WriteText(new Vector2((int)PosObjMenu[Idx].X + 10, 460), "Kills: " + GameLogic.Players[Idx].NumKills, Color.Red, BladeFont); } // Draw a 2D text string at the center of the screen UI2DRenderer.WriteText(new Vector2(0, 50), TextTitle, Color.Red, PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None); }
public void CreateEndGame() { int Idx; TextTitle = "Congratulations!!!"; //Animation if (TxtTitleCol == Color.Red) { TxtTitleCol = Color.Yellow; } else { TxtTitleCol = Color.Red; } UI2DRenderer.FillRectangle(new Rectangle(0, 0, 1280, 720), null, new Color(0, 0, 0, 170)); UI2DRenderer.FillRectangle(new Rectangle(130, 250, Luna.Width, Luna.Height), Luna, Color.White); UI2DRenderer.FillRectangle(new Rectangle(260, 440, Trofeo.Width, Trofeo.Height), Trofeo, Color.White); for (Idx = 0; Idx < GameLogic.NumberPlayers; Idx++) { if (GameLogic.Players[Idx].IsDead == false) { UI2DRenderer.WriteText(new Vector2(210 - 5, 160), "Winner!", TxtTitleCol, PuntosFont); UI2DRenderer.FillRectangle(new Rectangle(210, 220, FrameW, FrameH), CarsTextures[GameLogic.Players[Idx].PlySelect - 1], Color.White); UI2DRenderer.FillRectangle(new Rectangle(210 - 15, 220 - 15, FrameW + 30, FrameH + 30), Marco, Color.White); UI2DRenderer.FillRectangle(new Rectangle(600, 250, 600, 300), null, new Color(0, 0, 0, 255)); UI2DRenderer.WriteText(new Vector2(610, 255), GameLogic.HistoryEndgame[GameLogic.Players[Idx].PlySelect - 1], Color.LawnGreen, CasioFont, new Vector2(0.75f, 0.75f)); } } // Draw a 2D text string at the center of the screen UI2DRenderer.WriteText(new Vector2(0, 50), TextTitle, Color.Red, PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None); UI2DRenderer.WriteText(new Vector2(480, 620), "Continue", TxtTitleCol, BladeFont, new Vector2(1.0f, 1.0f)); }
public void CreateMenuSelLevel() { int Idx = (int)GameLogic.ActualLevel; TextTitle = "Select your level"; UI2DRenderer.FillRectangle(new Rectangle(0, 0, 1280, 720), null, new Color(0, 0, 0, 170)); UI2DRenderer.FillRectangle(new Rectangle(30, 180, MenuLevelsprites[Idx].Width, MenuLevelsprites[Idx].Height), MenuLevelsprites[Idx], Color.White); UI2DRenderer.FillRectangle(new Rectangle(450, 170, Levelsprites[Idx].Width, Levelsprites[Idx].Height), Levelsprites[Idx], Color.White); // Draw a 2D text string at the center of the screen UI2DRenderer.WriteText(new Vector2(0, 90), TextTitle, Color.Red, PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None); UI2DRenderer.WriteText(new Vector2(0, 55), TextRobert, Color.Gray, RoboCopFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None); }
public void CreateCredits() { int Idx = (int)GameLogic.CreditScreen; //Velo UI2DRenderer.FillRectangle(new Rectangle(0, 0, 1280, 720), null, new Color(0, 0, 0, 190)); UI2DRenderer.FillRectangle(new Rectangle(130, 250, Luna.Width, Luna.Height), Luna, Color.White); UI2DRenderer.FillRectangle(new Rectangle(74, 200, Credits[Idx].Width, Credits[Idx].Height), Credits[Idx], Color.White); //Title 1 UI2DRenderer.WriteText(new Vector2(0, 30), "Credits:", Color.Gray, RoboCopFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None); //Title A UI2DRenderer.WriteText(new Vector2(0, 60), "ultimate demolition derby", Color.Red, PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None); //Title B UI2DRenderer.WriteText(new Vector2(0, 110), "on the moon", Color.Red, PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None); }
protected override void PaintComponent() { base.PaintComponent(); if (lines == null) { return; } Color c = animationBarColor; c.A = 255; for (int i = 0; i < linesToDraw.Count; i++) { if (alpha < 255 && linesToDraw.Count > 4) { c.A = (byte)((i + 1) / 6.0f * alpha); } UI2DRenderer.DrawLine(linesToDraw[i].Start, linesToDraw[i].End, c, lineWidth); } if (textFont != null && label.Length > 0) { UI2DRenderer.WriteText(textPos, label, textColor, textFont); } animationCounter++; if (animationCounter > updateInterval) { linesToDraw.RemoveAt(0); linesToDraw.Add(lines[curTail]); curTail++; if (curTail >= lines.Length) { curTail = 0; } animationCounter = 0; } }
private void DrawLabels() { UI2DRenderer.WriteText( Vector2.Zero, " " + status, Color.White, textFont, GoblinEnums.HorizontalAlignment.Left, GoblinEnums.VerticalAlignment.Bottom ); UI2DRenderer.WriteText( Vector2.Zero, topRightText,//" Selected: " + (selected != null ? selected.Name : "Nothing"),//selectedObjectLabel, Color.White, textFont, GoblinEnums.HorizontalAlignment.Right, GoblinEnums.VerticalAlignment.Top ); }
protected override void PaintComponent() { base.PaintComponent(); // Draw the radio button part if (mouseDown && enabled) { // Use disabled color to display pressed down action UI2DRenderer.FillCircle(center, radius - 1, disabledColor); } else if (selected) { Color c = (enabled) ? buttonColor : disabledColor; UI2DRenderer.DrawCircle(center, radius - 1, c); UI2DRenderer.DrawCircle(center, radius - 2, c); UI2DRenderer.FillCircle(center, radius - 3, selectedColor); } else { Color c = (enabled) ? buttonColor : disabledColor; UI2DRenderer.FillCircle(center, radius - 1, c); } // Draw the border of the check box part UI2DRenderer.DrawCircle(center, radius, color); // Show the highlight when mouse is over if (enabled && within && !mouseDown) { UI2DRenderer.DrawCircle(center, radius - 1, highlightColor); UI2DRenderer.DrawCircle(center, radius - 2, highlightColor); } if (label.Length > 0 && textFont != null) { UI2DRenderer.WriteText(textPos, label, textColor, textFont); } }
public void CreateMenuMode() { int Idx = (int)GameLogic.GameMode; TextTitle = "Select your game mode"; //Velo UI2DRenderer.FillRectangle(new Rectangle(0, 0, 1280, 720), null, new Color(0, 0, 0, 170)); UI2DRenderer.FillRectangle(new Rectangle(130, 250, Luna.Width, Luna.Height), Luna, Color.White); UI2DRenderer.FillRectangle(new Rectangle(450, 200, MenusSprites[Idx].Width, MenusSprites[Idx].Height), MenusSprites[Idx], Color.White); // Draw a 2D text string at the center of the screen UI2DRenderer.WriteText(new Vector2(0, 80), TextTitle, Color.Red, PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None); UI2DRenderer.WriteText(new Vector2(0, 55), TextRobert, Color.Gray, RoboCopFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None); UI2DRenderer.WriteText(new Vector2(1050, 680), TextIP, new Color(255, 10, 10, 255), CalibriFont, new Vector2(0.8f, 0.8f)); }
protected override void PaintComponent() { base.PaintComponent(); // Draw the check box part if (mouseDown && enabled) { // Use disabled color to display pressed down action UI2DRenderer.FillRectangle(boxRect, null, disabledColor); } else if (selected) { Color c = (enabled) ? boxColor : disabledColor; UI2DRenderer.FillRectangle(boxRect, null, c); UI2DRenderer.FillRectangle(selectedRect, null, selectedColor); } else { Color c = (enabled) ? boxColor : disabledColor; UI2DRenderer.FillRectangle(boxRect, null, c); } // Draw the border of the check box part UI2DRenderer.DrawRectangle(boxRect, color, 1); // Show the highlight when mouse is over if (enabled && within && !mouseDown) { UI2DRenderer.DrawRectangle(highlightRect, highlightColor, 2); } if (label.Length > 0 && textFont != null) { // Draw the label part UI2DRenderer.WriteText(textPos, label, textColor, textFont); } }
protected override void PaintComponent() { if ((mouseDown && enabled) || (focused && clickKeyPressed)) { // Use disabled color to display pressed down action UI2DRenderer.FillRectangle(paintBounds, backTexture, disabledColor); } else { base.PaintComponent(); } if (label.Length > 0) { if (textFont != null) { UI2DRenderer.WriteText(textPos, label, textColor, textFont); } } Color color = ColorHelper.Empty; // Add highlight on the border if mouse is hovering if (enabled && within && !mouseDown) { color = highlightColor; } else if (focused) { color = focusedColor; } if (!color.Equals(ColorHelper.Empty)) { UI2DRenderer.DrawRectangle(highlightBound, color, 2); } }
public void CreateIntro() { TextTitle = "Press ENTER to continue"; //Velo UI2DRenderer.FillRectangle(new Rectangle(0, 0, 1280, 720), null, new Color(0, 0, 0, 170)); //Logo UI2DRenderer.FillRectangle(new Rectangle(440, 250, GameLogo.Width * 2, GameLogo.Height * 2), GameLogo, Color.White); //Titulo UI2DRenderer.FillRectangle(new Rectangle(190, 30, GameTitle.Width, GameTitle.Height), GameTitle, Color.White); //Animation if (TxtTitleCol == Color.Black) { TxtTitleCol = Color.White; } else { TxtTitleCol = Color.Black; } //Title 1 //UI2DRenderer.WriteText(new Vector2(0, 30), "Robert Swanson Presents:", Color.Gray, // RoboCopFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None); //Title A //UI2DRenderer.WriteText(new Vector2(0, 60), "ultimate demolition derby", Color.Red, // PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None); //Title B //UI2DRenderer.WriteText(new Vector2(0, 110), "on the moon", Color.Red, // PuntosFont, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.None); //info Text UI2DRenderer.WriteText(new Vector2(450, 670), TextTitle, TxtTitleCol, RoboCopFont, new Vector2(1.0f, 1.0f)); UI2DRenderer.WriteText(new Vector2(1050, 680), TextIP, new Color(255, 10, 10, 255), CalibriFont, new Vector2(0.8f, 0.8f)); }
protected override void PaintComponent() { base.PaintComponent(); // paint the progress bar if (indeterminate) { int x = 0; int gap = paintBounds.Width / 12; int bigGap = gap * 2; if (indeterminateCounter > 80) { indeterminateCounter = 0; } if (indeterminateCounter > 40) { UI2DRenderer.FillRectangle(new Rectangle(paintBounds.X, paintBounds.Y + 1, (int)((indeterminateCounter - 40) / 40f * gap), (paintBounds.Height - 2)), null, barColor); int w = (int)((80 - indeterminateCounter) / 40f * gap); UI2DRenderer.FillRectangle(new Rectangle(paintBounds.X + paintBounds.Width - w, paintBounds.Y + 1, w, (paintBounds.Height - 2)), null, barColor); } else { x = (int)((indeterminateCounter / 80f + 5) * bigGap); UI2DRenderer.FillRectangle(new Rectangle(paintBounds.X + x, paintBounds.Y + 1, gap, (paintBounds.Height - 2)), null, barColor); } for (int i = 0; i < 5; i++) { x = (int)((indeterminateCounter / 80f + i) * bigGap); UI2DRenderer.FillRectangle(new Rectangle(paintBounds.X + x, paintBounds.Y + 1, gap, (paintBounds.Height - 2)), null, barColor); } indeterminateCounter++; } else { UI2DRenderer.FillRectangle(new Rectangle(paintBounds.X + 1, paintBounds.Y + 1, (int)(PercentComplete / 100 * (paintBounds.Width - 2)), paintBounds.Height - 2), null, barColor); } // paint the percent complete if (!indeterminate && paintString && textFont != null) { String msg = (int)PercentComplete + "%"; Vector2 pos = new Vector2(); Vector2 msgMeasure = textFont.MeasureString(msg); pos.X = paintBounds.X + (int)(paintBounds.Width - msgMeasure.X) / 2; pos.Y = paintBounds.Y + (int)(paintBounds.Height - msgMeasure.Y) / 2; UI2DRenderer.WriteText(pos, msg, stringColor, textFont); } }
private void writeText(string s, int offset) { UI2DRenderer.WriteText(new Vector2(0, 5 + offset), s, Color.White, font, GoblinEnums.HorizontalAlignment.Center, GoblinEnums.VerticalAlignment.Top + 80); }