Exemplo n.º 1
0
        public override void Draw(Graphics2D g)
        {
            Point2I pos = new Point2I(8, 24);

            if (GameControl.Player.Y < ((GameSettings.VIEW_HEIGHT) / 2 + 8))
            {
                pos.Y = 96;
            }
            // TODO: Apply Player position based on view
            g.FillRectangle(new Rectangle2I(pos, new Point2I(144, 8 + 16 * linesPerWindow)), Color.Black);

            // Draw the finished writting lines.
            for (int i = 0; i < windowLine; i++)
            {
                if (state == TextReaderState.PushingLine && timer >= 2)
                {
                    g.DrawLetterString(GameData.FONT_LARGE, wrappedString.Lines[currentLine - windowLine + i], pos + new Point2I(8, 6 + 16 * i + 8), TextColor);
                }
                else
                {
                    g.DrawLetterString(GameData.FONT_LARGE, wrappedString.Lines[currentLine - windowLine + i], pos + new Point2I(8, 6 + 16 * i), TextColor);
                }
            }
            // Draw the currently writting line.
            g.DrawLetterString(GameData.FONT_LARGE, wrappedString.Lines[currentLine].Substring(0, currentChar), pos + new Point2I(8, 6 + 16 * windowLine), TextColor);

            // Draw the next line arrow.
            if ((state == TextReaderState.PressToContinue || state == TextReaderState.PressToEndParagraph) && arrowTimer >= 16)
            {
                g.DrawSprite(GameData.SPR_HUD_TEXT_NEXT_ARROW, pos + new Point2I(136, 16 * linesPerWindow));
            }
        }
Exemplo n.º 2
0
        // Draws the scrolling item description at the bottom of the screen.
        public void DrawDescription(Graphics2D g)
        {
            int position  = textPosition - textStart;
            int textIndex = position / 8;

            if (position < 0)
            {
                // Round down always.
                textIndex = (position - 7) / 8;
                position  = ((position - 7) / 8) * 8;
            }
            else
            {
                position = (position / 8) * 8;
            }

            int          startIndex = GMath.Max(0, textIndex);
            int          endIndex   = GMath.Clamp(textIndex + 16, 0, description.Length);
            LetterString text       = description.Substring(startIndex, endIndex - startIndex);

            if (position < 0)
            {
                g.DrawLetterString(GameData.FONT_LARGE, text, new Point2I(16 - (position / 8) * 8, 108), new Color(16, 40, 88));
            }
            else
            {
                g.DrawLetterString(GameData.FONT_LARGE, text, new Point2I(16, 108), new Color(16, 40, 88));
            }
        }