// Draw: public override void Draw(GameTime gameTime) { base.Draw(gameTime); SpriteBatch sb = this.parentManager.game.spriteBatch; sb.Begin(); sb.Draw(background, new Vector2(0, 0), Color.White); // Background Box Vector2 backgroundBox = new Vector2(MGP_Constants.SCREEN_MID_X - 300, MGP_Constants.SCREEN_MID_Y - 300); sb.Draw(this.parentManager.game.spr_messageBox, new Rectangle((int)backgroundBox.X, (int)backgroundBox.Y, 600, 600), new Color(0, 0, 128, 200)); // Title String title = "Minigame Results"; Vector2 titlePos = CenterString.getCenterStringVector(new Vector2(backgroundBox.X + 300, backgroundBox.Y + 50), title, this.parentManager.game.ft_mainMenuFont); sb.DrawString(this.parentManager.game.ft_mainMenuFont, title, titlePos, Color.White); sb.End(); // Player Result Entities for (int i = 0; i <= 3; i++) { entities[i].Draw(gameTime); } }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); // Draw Background: SpriteBatch sb = this.parentManager.game.spriteBatch; sb.Begin(); sb.Draw(this.parentManager.game.bg_titleScreen, new Vector2(xPos, yPos), Color.White); // Background Box Vector2 backgroundBox = new Vector2(50, 50); sb.Draw(this.parentManager.game.spr_messageBox, new Rectangle((int)backgroundBox.X, (int)backgroundBox.Y, 500, 150), new Color(0, 0, 128, 200)); // Text Vector2 textPos = CenterString.getCenterStringVector(new Vector2(300, 125), text[textIndex], this.parentManager.game.ft_mainMenuFont); sb.DrawString(this.parentManager.game.ft_mainMenuFont, text[textIndex], textPos, Color.White); // Player Meeples for (int i = 0; i < 4; i++) { sb.Draw(gsm.gameOptions.players[i].meeple.sprite, new Rectangle((int)currMeeplePos[i].X, (int)currMeeplePos[i].Y, meepleWidth, meepleHeight), Color.White); } // Star sb.Draw(stars[starIndex], curStarPos, Color.White); sb.End(); }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); SpriteBatch sb = this.parentManager.game.spriteBatch; sb.Begin(); // Draw the button instructions Texture2D moveControl = parentManager.game.keys_move; Vector2 moveControlPos = new Vector2(MGP_Constants.SCREEN_MID_X - 250, 475); sb.Draw(moveControl, moveControlPos, Color.White); String text = " ... Move Camera\n\n\nselect ... Return"; Vector2 smTextPos = CenterString.getCenterStringVector(new Vector2(MGP_Constants.SCREEN_MID_X, 575), text, parentManager.game.ft_rollDice_lg); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X - 2, smTextPos.Y), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X + 2, smTextPos.Y), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X, smTextPos.Y - 2), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X, smTextPos.Y + 2), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, smTextPos, Color.White); sb.End(); }
} // end of update // Draw: public override void Draw(GameTime gameTime) { base.Draw(gameTime); SpriteBatch sb = this.parentManager.game.spriteBatch; sb.Begin(); // Draw Background: sb.Draw(this.parentManager.game.bg_titleScreen, new Vector2(xPos, yPos), Color.White); // Draw Buttons Color tColor; for (int i = 0; i < numItems; i++) { // Cloud Background: sb.Draw(this.parentManager.game.spr_cloudIcon, new Rectangle((int)(items[i].xPos - (cloudWidth / 2)), (int)items[i].yPos - (cloudHeight / 2), cloudWidth, cloudHeight), Color.White); // Meeple sb.Draw(meeples[i].sprite, meeples[i].pos, Color.White); // Draw Text: if (i == currentMenuItem) { tColor = Color.Blue; } // Color first character choice grey else if (players.Count == 1 && i == (int)players[0]) { tColor = Color.Gray; } else { tColor = Color.Red; } Vector2 textPos = CenterString.getCenterStringVector(new Vector2(items[i].xPos, items[i].yPos), items[i].text, parentManager.game.ft_mainMenuFont); sb.DrawString(this.parentManager.game.ft_mainMenuFont, items[i].text, textPos, tColor); } // Background Box Vector2 backgroundBox = new Vector2(MGP_Constants.SCREEN_MID_X - 450, MGP_Constants.SCREEN_MID_Y + 150); sb.Draw(this.parentManager.game.spr_messageBox, new Rectangle((int)backgroundBox.X, (int)backgroundBox.Y, 900, 150), new Color(0, 0, 128, 150)); // Description Text Vector2 textDesPos = CenterString.getCenterStringVector(new Vector2(backgroundBox.X + 450, backgroundBox.Y + 75), description, this.parentManager.game.ft_mainMenuFont); sb.DrawString(this.parentManager.game.ft_mainMenuFont, description, textDesPos, Color.White); // Glove sb.Draw(parentManager.game.spr_glove, glovePos, Color.White); // End drawing: sb.End(); }
// Draw: public override void Draw(GameTime gameTime) { base.Draw(gameTime); // Draw Background: SpriteBatch sb = this.parentManager.game.spriteBatch; sb.Begin(); if (transitionTimerOne < 60) { // Box 1 covering top half Vector2 boxOne = new Vector2(0, 0 - (transitionTimerOne * 12)); sb.Draw(this.parentManager.game.confirmPlayerFade, new Rectangle((int)boxOne.X, (int)boxOne.Y, MGP_Constants.SCREEN_WIDTH, MGP_Constants.SCREEN_MID_Y), Color.White); // Box 2 covering bottom half Vector2 boxTwo = new Vector2(0, MGP_Constants.SCREEN_MID_Y + (transitionTimerOne * 12)); sb.Draw(this.parentManager.game.confirmPlayerFade, new Rectangle((int)boxTwo.X, (int)boxTwo.Y, MGP_Constants.SCREEN_WIDTH, MGP_Constants.SCREEN_MID_Y), Color.White); } else { // draw text // Draw text for last 3 rounds string text = ""; if (roundsLeft == 1) { text = "LAST TURN"; } else if (roundsLeft <= 3) { text = "LAST" + roundsLeft.ToString() + " TURNS"; } Vector2 boldTextPos = CenterString.getCenterStringVector(new Vector2(MGP_Constants.SCREEN_MID_X, MGP_Constants.SCREEN_MID_Y - 75), text, this.parentManager.game.ft_confirmPlayer_Bold); sb.DrawString(this.parentManager.game.ft_confirmPlayer_Bold, text, boldTextPos, Color.White); Vector2 textPos = CenterString.getCenterStringVector(new Vector2(MGP_Constants.SCREEN_MID_X, MGP_Constants.SCREEN_MID_Y - 75), text, this.parentManager.game.ft_confirmPlayer); sb.DrawString(this.parentManager.game.ft_confirmPlayer, text, textPos, Color.Black); Vector2 sm_textPos = CenterString.getCenterStringVector(new Vector2(MGP_Constants.SCREEN_MID_X, MGP_Constants.SCREEN_MID_Y - 75), text, this.parentManager.game.ft_confirmPlayer_sm); sb.DrawString(this.parentManager.game.ft_confirmPlayer_sm, text, sm_textPos, Color.Gold); // Draw text for players name text = playerName + " START"; boldTextPos = CenterString.getCenterStringVector(new Vector2(MGP_Constants.SCREEN_MID_X, MGP_Constants.SCREEN_MID_Y), text, this.parentManager.game.ft_confirmPlayer_Bold); sb.DrawString(this.parentManager.game.ft_confirmPlayer_Bold, text, boldTextPos, Color.White); textPos = CenterString.getCenterStringVector(new Vector2(MGP_Constants.SCREEN_MID_X, MGP_Constants.SCREEN_MID_Y), text, this.parentManager.game.ft_confirmPlayer); sb.DrawString(this.parentManager.game.ft_confirmPlayer, text, textPos, Color.Black); sm_textPos = CenterString.getCenterStringVector(new Vector2(MGP_Constants.SCREEN_MID_X, MGP_Constants.SCREEN_MID_Y), text, this.parentManager.game.ft_confirmPlayer_sm); sb.DrawString(this.parentManager.game.ft_confirmPlayer_sm, text, sm_textPos, Color.Gold); } sb.End(); }// End Draw
} // End update // Draw: public override void Draw(GameTime gameTime) { base.Draw(gameTime); SpriteBatch sb = this.parentManager.game.spriteBatch; sb.Begin(); // Draw Background: sb.Draw(this.parentManager.game.bg_titleScreen, new Vector2(xPos, yPos), Color.White); // Draw Buttons Color tColor; int i = 0; foreach (MenuItem item in items) { Vector2 pos = new Vector2(item.xPos, item.yPos); Rectangle cloudPos = new Rectangle((int)item.xPos - cloudWidth / 2, (int)item.yPos - cloudHeight / 2, cloudWidth, cloudHeight); Vector2 textPos = CenterString.getCenterStringVector(pos, item.text, this.parentManager.game.ft_mainMenuFont); // Cloud Background: sb.Draw(this.parentManager.game.spr_cloudIcon, cloudPos, Color.White); // Draw Text: if (i == currentMenuItem) { tColor = Color.Blue; } else { tColor = Color.Red; } sb.DrawString(this.parentManager.game.ft_mainMenuFont, item.text, textPos, tColor); i++; } // Background Box Vector2 backgroundBox = new Vector2(MGP_Constants.SCREEN_MID_X - 550, MGP_Constants.SCREEN_MID_Y + 150); sb.Draw(this.parentManager.game.spr_messageBox, new Rectangle((int)backgroundBox.X, (int)backgroundBox.Y, 1100, 150), new Color(0, 0, 128, 200)); // Text Vector2 textDesPos = CenterString.getCenterStringVector(new Vector2(backgroundBox.X + 550, backgroundBox.Y + 75), description, this.parentManager.game.ft_mainMenuFont); sb.DrawString(this.parentManager.game.ft_mainMenuFont, description, textDesPos, Color.White); // Draw current selection hand sb.Draw(parentManager.game.spr_glove, glovePos, Color.White); // End drawing: sb.End(); }
public PauseItem(Vector2 initPos, string initText, SpriteFont sf, S_Pause.pauseOptions activeValue) { this.text = initText; // Recenter based on text: this.screenPos = initPos; this.screenPosCentered = CenterString.getCenterStringVector(initPos, this.text, sf); this.activeValue = activeValue; this.font = sf; }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); // Draw Background: SpriteBatch sb = this.parentManager.game.spriteBatch; sb.Begin(); // buying star if (startAnimation) { // Draw the star starting dead center then moving up Vector2 starPos = new Vector2(MGP_Constants.SCREEN_MID_X - 100, MGP_Constants.SCREEN_MID_Y - 100 - moveYPos); sb.Draw(this.parentManager.game.spr_star, new Rectangle((int)starPos.X, (int)starPos.Y, 200, 200), Color.White); // draw the coins below the star moving down Vector2 coinPos = new Vector2(MGP_Constants.SCREEN_MID_X - 50, MGP_Constants.SCREEN_MID_Y + 35 + moveYPos); Vector2 coinText = coinPos + new Vector2(55, 0); // Draw text to the right of object sb.Draw(this.parentManager.game.spr_coin, coinPos, Color.White); sb.DrawString(this.parentManager.game.ft_mainMenuFont, "- 20", coinText, Color.Red); } // print message else { Vector2 messageScreen = new Vector2(buyStarPrompt.xPos, buyStarPrompt.yPos); Vector2 textPos = CenterString.getCenterStringVector(new Vector2(messageScreen.X + 300, messageScreen.Y + 75), buyStarPrompt.text, this.parentManager.game.ft_menuDescriptionFont); sb.Draw(this.parentManager.game.spr_messageBox, new Rectangle((int)messageScreen.X, (int)messageScreen.Y, 600, 150), new Color(0, 0, 128, 200)); sb.DrawString(this.parentManager.game.ft_menuDescriptionFont, buyStarPrompt.text, textPos, Color.White); } // Draw instruction to press select if (parentManager.round.currPlayer.isHuman && !startAnimation) { string text = "Select ... Continue"; Vector2 smTextPos = CenterString.getCenterStringVector(new Vector2(MGP_Constants.SCREEN_MID_X, 675), text, parentManager.game.ft_rollDice_lg); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X - 2, smTextPos.Y), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X + 2, smTextPos.Y), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X, smTextPos.Y - 2), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X, smTextPos.Y + 2), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, smTextPos, Color.White); } sb.End(); }
// Draw: public override void Draw(GameTime gameTime) { base.Draw(gameTime); SpriteBatch sb = this.parentManager.game.spriteBatch; sb.Begin(); // Background sb.Draw(background, new Vector2(0, 0), Color.White); // Background Box Vector2 backgroundBox = new Vector2(MGP_Constants.SCREEN_MID_X - boxWidth / 2, MGP_Constants.SCREEN_MID_Y - boxHeight / 2); sb.Draw(this.parentManager.game.spr_messageBox, new Rectangle((int)backgroundBox.X, (int)backgroundBox.Y, boxWidth, boxHeight), new Color(0, 0, 128, 200)); // Text string text; if (shownInstructions) { text = gameControls; sb.Draw(moveControl, moveControlPos, Color.White); sb.Draw(confirmSelection, confirmSelectionPos, Color.White); } else { text = gameInstructions; } // Text Vector2 textDesPos = CenterString.getCenterStringVector(new Vector2(MGP_Constants.SCREEN_MID_X, MGP_Constants.SCREEN_MID_Y), text, this.parentManager.game.ft_mainMenuFont); sb.DrawString(this.parentManager.game.ft_mainMenuFont, text, new Vector2(textDesPos.X - 2, textDesPos.Y), Color.Black); sb.DrawString(this.parentManager.game.ft_mainMenuFont, text, new Vector2(textDesPos.X + 2, textDesPos.Y), Color.Black); sb.DrawString(this.parentManager.game.ft_mainMenuFont, text, new Vector2(textDesPos.X, textDesPos.Y - 2), Color.Black); sb.DrawString(this.parentManager.game.ft_mainMenuFont, text, new Vector2(textDesPos.X, textDesPos.Y + 2), Color.Black); sb.DrawString(this.parentManager.game.ft_mainMenuFont, text, textDesPos, Color.White); // Screen Instructions Vector2 smTextPos = CenterString.getCenterStringVector(new Vector2(MGP_Constants.SCREEN_MID_X, 675), screenInstructions, parentManager.game.ft_rollDice_lg); sb.DrawString(parentManager.game.ft_rollDice_lg, screenInstructions, new Vector2(smTextPos.X - 2, smTextPos.Y), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, screenInstructions, new Vector2(smTextPos.X + 2, smTextPos.Y), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, screenInstructions, new Vector2(smTextPos.X, smTextPos.Y - 2), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, screenInstructions, new Vector2(smTextPos.X, smTextPos.Y + 2), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, screenInstructions, smTextPos, Color.White); sb.End(); }
} // end update // Draw: public override void Draw(GameTime gameTime) { base.Draw(gameTime); SpriteBatch sb = this.parentManager.game.spriteBatch; sb.Begin(); sb.Draw(this.parentManager.game.bg_chanceTime, new Vector2(xPos, yPos), Color.White); string t = "CHANCE TIME!"; Vector2 boldTextPos = CenterString.getCenterStringVector(TITLE_POS, t, this.parentManager.game.ft_confirmPlayer_Bold); Vector2 boldTextPosB = new Vector2(boldTextPos.X + 4, boldTextPos.Y + 4); sb.DrawString(this.parentManager.game.ft_confirmPlayer_Bold, t, boldTextPosB, Color.Black); sb.DrawString(this.parentManager.game.ft_confirmPlayer_Bold, t, boldTextPos, Color.White); if (finishTransition) { string text = "FINISHED!"; Vector2 finishPos = CenterString.getCenterStringVector(FINISH_POS, text, this.parentManager.game.ft_confirmPlayer_Bold); Vector2 finishPosB = new Vector2(finishPos.X + 4, finishPos.Y + 4); Vector2 finishPosBB = new Vector2(finishPos.X + 8, finishPos.Y + 8); sb.DrawString(this.parentManager.game.ft_confirmPlayer_Bold, text, finishPosBB, Color.Black); sb.DrawString(this.parentManager.game.ft_confirmPlayer_Bold, text, finishPosB, Color.SaddleBrown); sb.DrawString(this.parentManager.game.ft_confirmPlayer_Bold, text, finishPos, Color.Yellow); } sb.End(); // Draw Dice Entities: leftBlock.Draw(gameTime); middleBlock.Draw(gameTime); rightBlock.Draw(gameTime); // Draw meeples if (leftMeepleMove) { leftMeeple.Draw(gameTime); } if (rightMeepleMove) { rightMeeple.Draw(gameTime); } }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); SpriteBatch sb = this.parentManager.game.spriteBatch; sb.Begin(); // Key Input Sprite sb.Draw(this.parentManager.game.key_inputs, new Vector2(0, 0), Color.White); // screen instructions string text = "Cancel...Go back"; Vector2 smTextPos = CenterString.getCenterStringVector(new Vector2(MGP_Constants.SCREEN_MID_X, 675), text, parentManager.game.ft_rollDice_lg); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X - 2, smTextPos.Y), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X + 2, smTextPos.Y), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X, smTextPos.Y - 2), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X, smTextPos.Y + 2), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, smTextPos, Color.White); sb.End(); }
} // end update // Draw: public override void Draw(GameTime gameTime) { base.Draw(gameTime); // Draw numbers on dice SpriteBatch sb = this.parentManager.game.spriteBatch; parentManager.boardGame.testDice.Draw(gameTime); sb.Begin(); // Draw instructions if (currPlayer.isHuman) { string text = "Select...Hit Dice Block\nShift...Pause Game"; Vector2 smTextPos = CenterString.getCenterStringVector(new Vector2(MGP_Constants.SCREEN_MID_X, 600), text, parentManager.game.ft_rollDice_lg); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X - 2, smTextPos.Y), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X + 2, smTextPos.Y), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X, smTextPos.Y - 2), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X, smTextPos.Y + 2), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, smTextPos, Color.White); } sb.End(); } // End draw
public override void Draw(GameTime gameTime) { base.Draw(gameTime); // Draw Background: SpriteBatch sb = this.parentManager.game.spriteBatch; sb.Begin(); sb.Draw(this.parentManager.game.bg_titleScreen, new Vector2(xPos, yPos), Color.White); if (timer < maxTime) { string text = "AND THE WINNER IS..."; Vector2 boldTextPos = CenterString.getCenterStringVector(new Vector2(MGP_Constants.SCREEN_MID_X, MGP_Constants.SCREEN_MID_Y - 75), text, this.parentManager.game.ft_confirmPlayer_Bold); sb.DrawString(this.parentManager.game.ft_confirmPlayer_Bold, text, boldTextPos, Color.White); Vector2 textPos = CenterString.getCenterStringVector(new Vector2(MGP_Constants.SCREEN_MID_X, MGP_Constants.SCREEN_MID_Y - 75), text, this.parentManager.game.ft_confirmPlayer); sb.DrawString(this.parentManager.game.ft_confirmPlayer, text, textPos, Color.Black); Vector2 sm_textPos = CenterString.getCenterStringVector(new Vector2(MGP_Constants.SCREEN_MID_X, MGP_Constants.SCREEN_MID_Y - 75), text, this.parentManager.game.ft_confirmPlayer_sm); sb.DrawString(this.parentManager.game.ft_confirmPlayer_sm, text, sm_textPos, Color.Gold); } else { // Draw Star Vector2 starPos = new Vector2(MGP_Constants.SCREEN_MID_X - 150, MGP_Constants.SCREEN_MID_Y - 300); Texture2D star; if (timer % 30 < 6) { star = gsm.game.spr_star1; } else if (timer % 30 >= 6 && timer % 30 < 12) { star = gsm.game.spr_star2; } else if (timer % 30 >= 12 && timer % 30 < 18) { star = gsm.game.spr_star3; } else if (timer % 30 >= 18 && timer % 30 < 24) { star = gsm.game.spr_star4; } else { star = gsm.game.spr_star5; } sb.Draw(star, starPos, Color.White); // Draw Player's name Vector2 namePos = CenterString.getCenterStringVector(new Vector2(MGP_Constants.SCREEN_MID_X, MGP_Constants.SCREEN_MID_Y + 75), winner.type.ToString(), gsm.game.ft_confirmPlayer_Bold); sb.DrawString(gsm.game.ft_confirmPlayer_Bold, winner.type.ToString(), namePos, Color.White); Vector2 textPos = CenterString.getCenterStringVector(new Vector2(MGP_Constants.SCREEN_MID_X, MGP_Constants.SCREEN_MID_Y + 75), winner.type.ToString(), this.parentManager.game.ft_confirmPlayer); sb.DrawString(this.parentManager.game.ft_confirmPlayer, winner.type.ToString(), textPos, Color.Black); Vector2 sm_textPos = CenterString.getCenterStringVector(new Vector2(MGP_Constants.SCREEN_MID_X, MGP_Constants.SCREEN_MID_Y + 75), winner.type.ToString(), this.parentManager.game.ft_confirmPlayer_sm); sb.DrawString(this.parentManager.game.ft_confirmPlayer_sm, winner.type.ToString(), sm_textPos, Color.Gold); // Draw Player Meeple Vector2 meeplePos = new Vector2(namePos.X - 75, namePos.Y); sb.Draw(winner.meeple.sprite, new Rectangle((int)meeplePos.X, (int)meeplePos.Y, 72, 72), Color.White); string text = "Select...Return to main menu"; Vector2 smTextPos = CenterString.getCenterStringVector(new Vector2(MGP_Constants.SCREEN_MID_X, 675), text, parentManager.game.ft_rollDice_lg); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X - 2, smTextPos.Y), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X + 2, smTextPos.Y), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X, smTextPos.Y - 2), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X, smTextPos.Y + 2), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, smTextPos, Color.White); } sb.End(); }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); // Draw Background: SpriteBatch sb = this.parentManager.game.spriteBatch; sb.Begin(); sb.Draw(parentManager.game.bg_titleScreen, new Vector2(0, 0), Color.White); // Background Box Vector2 backgroundBox = new Vector2(MGP_Constants.SCREEN_MID_X, MGP_Constants.SCREEN_MID_Y); sb.Draw(this.parentManager.game.spr_messageBox, new Rectangle((int)backgroundBox.X - (int)boxDim[index].X / 2, (int)backgroundBox.Y - (int)boxDim[index].Y / 2, (int)boxDim[index].X, (int)boxDim[index].Y), new Color(0, 0, 128, 150)); // Description Header Vector2 textHeaderPos = CenterString.getCenterStringVector(new Vector2(backgroundBox.X - 1, backgroundBox.Y - ((int)boxDim[index].Y / 2 - 60)), aboutHeader[index], this.parentManager.game.ft_mainMenuFont); sb.DrawString(this.parentManager.game.ft_mainMenuFont, aboutHeader[index], textHeaderPos, Color.Black); textHeaderPos = CenterString.getCenterStringVector(new Vector2(backgroundBox.X, backgroundBox.Y - ((int)boxDim[index].Y / 2 - 61)), aboutHeader[index], this.parentManager.game.ft_mainMenuFont); sb.DrawString(this.parentManager.game.ft_mainMenuFont, aboutHeader[index], textHeaderPos, Color.Black); textHeaderPos = CenterString.getCenterStringVector(new Vector2(backgroundBox.X, backgroundBox.Y - ((int)boxDim[index].Y / 2 - 59)), aboutHeader[index], this.parentManager.game.ft_mainMenuFont); sb.DrawString(this.parentManager.game.ft_mainMenuFont, aboutHeader[index], textHeaderPos, Color.Black); textHeaderPos = CenterString.getCenterStringVector(new Vector2(backgroundBox.X + 1, backgroundBox.Y - ((int)boxDim[index].Y / 2 - 60)), aboutHeader[index], this.parentManager.game.ft_mainMenuFont); sb.DrawString(this.parentManager.game.ft_mainMenuFont, aboutHeader[index], textHeaderPos, Color.Black); textHeaderPos = CenterString.getCenterStringVector(new Vector2(backgroundBox.X, backgroundBox.Y - ((int)boxDim[index].Y / 2 - 60)), aboutHeader[index], this.parentManager.game.ft_mainMenuFont); sb.DrawString(this.parentManager.game.ft_mainMenuFont, aboutHeader[index], textHeaderPos, Color.White); // Description Text Vector2 textDesPos = CenterString.getCenterStringVector(new Vector2(backgroundBox.X - 1, backgroundBox.Y), aboutText[index], this.parentManager.game.ft_menuDescriptionFont); sb.DrawString(this.parentManager.game.ft_menuDescriptionFont, aboutText[index], textDesPos, Color.Black); textDesPos = CenterString.getCenterStringVector(new Vector2(backgroundBox.X, backgroundBox.Y - 1), aboutText[index], this.parentManager.game.ft_menuDescriptionFont); sb.DrawString(this.parentManager.game.ft_menuDescriptionFont, aboutText[index], textDesPos, Color.Black); textDesPos = CenterString.getCenterStringVector(new Vector2(backgroundBox.X + 1, backgroundBox.Y), aboutText[index], this.parentManager.game.ft_menuDescriptionFont); sb.DrawString(this.parentManager.game.ft_menuDescriptionFont, aboutText[index], textDesPos, Color.Black); textDesPos = CenterString.getCenterStringVector(new Vector2(backgroundBox.X, backgroundBox.Y + 1), aboutText[index], this.parentManager.game.ft_menuDescriptionFont); sb.DrawString(this.parentManager.game.ft_menuDescriptionFont, aboutText[index], textDesPos, Color.Black); textDesPos = CenterString.getCenterStringVector(new Vector2(backgroundBox.X, backgroundBox.Y), aboutText[index], this.parentManager.game.ft_menuDescriptionFont); sb.DrawString(this.parentManager.game.ft_menuDescriptionFont, aboutText[index], textDesPos, Color.White); // Buttons text string backText = "Cancel ... Back"; Vector2 backTextPos = CenterString.getCenterStringVector(new Vector2(backgroundBox.X, backgroundBox.Y + (boxDim[index].Y / 2 - 40)), backText, parentManager.game.ft_rollDice_lg); sb.DrawString(parentManager.game.ft_rollDice_lg, backText, new Vector2(backTextPos.X - 2, backTextPos.Y), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, backText, new Vector2(backTextPos.X + 2, backTextPos.Y), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, backText, new Vector2(backTextPos.X, backTextPos.Y - 2), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, backText, new Vector2(backTextPos.X, backTextPos.Y + 2), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, backText, backTextPos, Color.White); if (index < 2) { string text = ">>"; Vector2 smTextPos = CenterString.getCenterStringVector(new Vector2(backgroundBox.X + (boxDim[index].X / 2 - 40), backgroundBox.Y + (boxDim[index].Y / 2 - 35)), text, parentManager.game.ft_rollDice_lg); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X - 2, smTextPos.Y), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X + 2, smTextPos.Y), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X, smTextPos.Y - 2), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X, smTextPos.Y + 2), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, smTextPos, Color.White); } if (index > 0) { string text = "<<"; Vector2 smTextPos = CenterString.getCenterStringVector(new Vector2(backgroundBox.X - (boxDim[index].X / 2 - 40), backgroundBox.Y + (boxDim[index].Y / 2 - 35)), text, parentManager.game.ft_rollDice_lg); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X - 2, smTextPos.Y), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X + 2, smTextPos.Y), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X, smTextPos.Y - 2), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X, smTextPos.Y + 2), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, smTextPos, Color.White); } sb.End(); }
// ** CONSTRUCTOR ** public S_Pause(GameStateManager creator, float xPos, float yPos, KeyboardManager.playerIndex playerWhoPaused) : base(creator, xPos, yPos) { this.playerWhoPaused = playerWhoPaused; // Center title: pauseTitlePos = CenterString.getCenterStringVector(pauseTitlePos, "Paused", this.parentManager.game.ft_confirmPlayer_Bold); // pause items: pauseItems = new List <PauseItem>(); piPos = new Vector2(MGP_Constants.SCREEN_MID_X, MGP_Constants.SCREEN_MID_Y - piHeight * 2); // init position SpriteFont sf = parentManager.game.ft_confirmPlayer_s32; int numItems = 0; Vector2 startPos = new Vector2(piPos.X, piPos.Y + (numItems * piHeight)); PauseItem curItem = new PauseItem(startPos, "Resume", sf, S_Pause.pauseOptions.resume); pauseItems.Add(curItem); currentSelection = numItems; // first selection here numItems++; this.glove = new E_Glove(creator, new Vector2(curItem.screenPosCentered.X - gloveAdjustX, curItem.screenPosCentered.Y - gloveAdjustY)); curItem = new PauseItem(new Vector2(piPos.X, piPos.Y + (numItems * piHeight)), "View Board", sf, S_Pause.pauseOptions.viewBoard); pauseItems.Add(curItem); numItems++; curItem = new PauseItem(new Vector2(piPos.X, piPos.Y + (numItems * piHeight)), "Quit Match", sf, S_Pause.pauseOptions.quit); pauseItems.Add(curItem); numItems++; curItem = new PauseItem(new Vector2(piPos.X, piPos.Y + (numItems * piHeight)), "Exit Program", sf, S_Pause.pauseOptions.exitProgram); pauseItems.Add(curItem); numItems++; // Store all other States into a list of states that we will 'pause' statesToPause = new List <State>(); foreach (State s in creator.states) { // only change states that are already active (don't tamper with other states) if (s.active == true && s != parentManager.audioEngine) { statesToPause.Add(s); } } // Pause those selected states: foreach (State s in statesToPause) { // don't pause itself, but pause all other active states: if (s != this) { s.active = false; } } // Create the transparent black background: overlayTexture = new Texture2D(parentManager.game.GraphicsDevice, 1, 1, false, SurfaceFormat.Color); Color[] c = new Color[1]; int transparencyAmount = (int)(255f * 0.9f); c[0] = Color.FromNonPremultiplied(255, 255, 255, transparencyAmount); overlayTexture.SetData <Color>(c); overlay = new Rectangle(0, 0, MGP_Constants.SCREEN_WIDTH, MGP_Constants.SCREEN_HEIGHT); // Turn down the music a little: parentManager.audioEngine.setMusicVolume(MGP_Constants.PAUSE_MUSIC_VOLUME); }
} // end update function // Draw: public override void Draw(GameTime gameTime) { base.Draw(gameTime); SpriteBatch sb = this.parentManager.game.spriteBatch; sb.Begin(); // Draw Background: sb.Draw(this.parentManager.game.bg_titleScreen, new Vector2(xPos, yPos), Color.White); // Draw logo sb.Draw(this.parentManager.game.logo, new Rectangle(MGP_Constants.SCREEN_MID_X - 150, -50, 300, 200), Color.White); // Draw Buttons Color tColor; int i = 0; foreach (MenuItem item in items) { Vector2 pos = new Vector2(item.xPos, item.yPos); Rectangle cloudPos = new Rectangle((int)item.xPos - cloudWidth / 2, (int)item.yPos - cloudHeight / 2, cloudWidth, cloudHeight); Vector2 textPos = CenterString.getCenterStringVector(pos, item.text, this.parentManager.game.ft_mainMenuFont); // Cloud Background: sb.Draw(this.parentManager.game.spr_cloudIcon, cloudPos, Color.White); // Draw Text: if (i == currentMenuItem) { tColor = Color.Blue; } else { tColor = Color.Red; } sb.DrawString(this.parentManager.game.ft_mainMenuFont, item.text, textPos, tColor); i++; } // Draw current selection hand sb.Draw(parentManager.game.spr_glove, glovePos, Color.White); // Draw screen instructions if (this.active) { string text = "Directional Buttons ... Move selection"; Vector2 smTextPos = CenterString.getCenterStringVector(new Vector2(MGP_Constants.SCREEN_MID_X, 650), text, parentManager.game.ft_rollDice_lg); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X - 2, smTextPos.Y), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X + 2, smTextPos.Y), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X, smTextPos.Y - 2), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X, smTextPos.Y + 2), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, smTextPos, Color.White); text = "Select ... Confirm selection"; smTextPos = CenterString.getCenterStringVector(new Vector2(MGP_Constants.SCREEN_MID_X, 675), text, parentManager.game.ft_rollDice_lg); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X - 2, smTextPos.Y), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X + 2, smTextPos.Y), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X, smTextPos.Y - 2), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, new Vector2(smTextPos.X, smTextPos.Y + 2), Color.Black); sb.DrawString(parentManager.game.ft_rollDice_lg, text, smTextPos, Color.White); } // End drawing: sb.End(); }