public void draw(SpriteBatchWrapper sprites) { if (!this.listening) return; this.drawGlassPane(sprites); Vector2 center = sprites.getCenterOfScreen(); int boxWidth = 500; int boxHeight = 150; int boxX = (int)(center.X - (boxWidth / 2)); int boxY = (int)(center.Y - (boxHeight / 2)); this.drawBox(sprites, boxWidth, boxHeight, boxX, boxY); if (null != this.message) { int msgHeight = sprites.getHeightOfText(this.message, 1.0f, MESSAGE_FONT_NAME); int msgWidth = sprites.getWidthOfText(this.message, 1.0f, MESSAGE_FONT_NAME); int msgY = boxY + (boxHeight / 4) - (msgHeight / 2); int msgX = (int) center.X - (msgWidth / 2); sprites.drawTextAt(this.message, msgX, msgY, 1.0f, Color.LightGray, MESSAGE_FONT_NAME); } this.drawTextBox(sprites, center, boxWidth); }
public void draw(SpriteBatchWrapper sprites, GraphicsDevice device) { sprites.drawBackground(background); Vector2 center = sprites.getCenterOfScreen(); int totalHeight = 0; foreach (MenuItem item in this.items) { totalHeight += item.getHeight(); } int y = (int)sprites.getCenterOfScreen().Y - (totalHeight/2); foreach (MenuItem item in this.items) { item.drawFromCenter(sprites, (int)center.X, y); y += item.getHeight(); } }