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(this.background); sprites.drawTextAt("Highscore: " + this.stageName, 50, 30, 1.0f, Color.White, "hud/ingametext"); //sprites.drawTextCentered(this.stageName + " - Highscore", -9, Color.Black); this.drawScores(sprites); this.nameInput.draw(sprites); }
/*public virtual void drawInLine(SpriteBatchWrapper sprites, int line) { sprites.drawTextCentered(this.title, line, this.selected ? Color.Orange : Color.GhostWhite); }*/ public virtual void drawFromCenter(SpriteBatchWrapper sprites, int x, int y) { int width = sprites.getWidthOfText(this.title, 1.0f, FONTNAME); int textureWidth = this.texture.bounds.Width; if (textureWidth < width + 20) { textureWidth = width + 20; } sprites.drawTextureAt( this.texture.texture, textureWidth, this.texture.bounds.Height, x - textureWidth/2, y); int textY = y + (int)(this.texture.bounds.Height * .3); sprites.drawTextAt( this.title, x - width / 2, textY, 1.0f, this.selected ? Color.Orange : Color.GhostWhite, FONTNAME); }
private void drawScores(SpriteBatchWrapper sprites) { int i = 0; foreach (Scoring score in this.scores.getSortedRange(0, 8)) { int baseline = 120 + (60 * i++); sprites.drawTextureAt( this.lineBackground.texture, this.lineBackground.Width, this.lineBackground.Height, 220, baseline); Color textColor = score.isNew ? Color.AliceBlue : Color.Black; int textbase = baseline + 18; sprites.drawTextAt("" + i, 270, textbase, 1.0f, textColor, "hud/highscoreline", SpriteBatchWrapper.Direction.RIGHT); sprites.drawTextAt(score.name, 300, textbase, 1.0f, textColor, "hud/highscoreline", SpriteBatchWrapper.Direction.LEFT); sprites.drawTextAt("" + score.score, 970, textbase, 1.0f, textColor, "hud/highscoreline", SpriteBatchWrapper.Direction.RIGHT); } }
private void drawTextBox(SpriteBatchWrapper sprites, Vector2 center, int boxWidth) { int textboxWidth = (boxWidth * 8) / 10; int textHeight = sprites.getHeightOfText("Foo", 1.0f, INPUT_FONT_NAME); int textBoxHeight = textHeight + (textHeight / 5); int textboxX = (int) center.X - ((boxWidth * 4) / 10); int textX = textboxX + 15; int textboxY = (int) center.Y; int textY = textboxY + (textHeight / 10); int visibleChars = 32; sprites.drawColorAt(Color.Black, 1.0f, textboxWidth, textBoxHeight, textboxX, textboxY); String textToDraw = this.text; bool cutoff = this.text.Length > visibleChars; if (cutoff) { textToDraw = this.text.Substring( this.text.Length - visibleChars); sprites.drawColorAt(Color.Orange, 1.0f, 5, textBoxHeight, textboxX, textboxY); } if (this.showCursor) { textToDraw += "_"; } sprites.drawTextAt(textToDraw, textX, textY, 1.0f, Color.Orange, INPUT_FONT_NAME); }
public void draw(SpriteBatchWrapper sprites, GraphicsDevice device) { if (this.exit) return; //this.textures.drawAsBackground(this.backgroundTexture, sprites); this.background.draw(sprites); if (null != this.currentSequence && this.currentSequence.isEnemyShown(this.song.timeRunningInMeasures)) { this.enemy.draw(sprites); } else { this.player.draw(sprites); } sprites.drawDebugText(this.progress.errorInLastSequence, "Missed:", this.missed, "Wrong:", this.wrong); /*sprites.drawDebugText( "Measures: ", this.song.timeRunningInMeasures, "Current Seq: ", this.currentSequence, "Last Move:", this.lastMove, "\n\rScore: ", this.progress.score);*/ sprites.drawTextAt( "Score: " + this.progress.score, -225, 15, 1.05f, Color.Black, "hud/ingametext", SpriteBatchWrapper.Direction.CENTER); sprites.drawTextAt( "Score: " + this.progress.score, -225, 15, 1.0f, Color.Orange, "hud/ingametext", SpriteBatchWrapper.Direction.CENTER); this.ui.draw(sprites); }