Beispiel #1
0
        /*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);
            }
        }