|
persona-3-dual
A DS demake of Persona 3
|
#include <TextSystem.hpp>


Public Member Functions | |
| void | init () override |
| void | shutdown () override |
| void | update (ae::q20_12_t) override |
| void | drawText (const std::string &text, Font *font, uint16_t *videoBuffer, int x, int y, int color, int letterSpacing, int lineSpacing, int spaceWidth, int xBoundary) |
| Draw text to the screen. | |
| void | appearText (std::unique_ptr< Text > &appearingText, const std::string &text, Font *font, uint16_t *videoBuffer, int x, int y, int color, int letterSpacing, int lineSpacing, int spaceWidth, int maxX=256, int maxY=0, bool hyphenate=false) |
| Create a Text object and renders each character with a delay to simulate typing effect. | |
| void | appearTextSkip (Text *appearingText) |
| If a text is currently being rendered with appearText, this function will immediately render the rest of the text without delay. | |
| bool | appearTextPaused (Text *appearingText) |
| Check if the text being rendered with appearText is waiting for the next page. | |
| void | appearTextNextPage (Text *appearingText) |
| Clear the text area and continue the paused text from the top of it. | |
| bool | appearTextDone (Text *appearingText) |
| Check if the text being rendered with appearText has finished appearing. | |
| void | drawGlyph (const Glyph &glyph, Font *font, uint16_t *videoBuffer, int x, int y, int color, bool bold, bool italic, bool underline) |
| Draw a single glyph to the screen. | |
| void | clearArea (uint16_t *videoBuffer, int x, int y, int width, int height) |
| Clear a rectangular area of the text video buffer. | |
Private Member Functions | |
| void | drawNextFromText (Text *text) |
| Draw the next character from the text struct to the screen. | |
| std::unique_ptr< Text > | createText (const std::string &text, Font *font, uint16_t *videoBuffer, int startX, int startY, int color, int letterSpacing, int lineSpacing, int spaceWidth, int maxX=256, int maxY=0) |
| Create a Text object and initialize its properties. | |
| char | getNextChar (Text *text) |
| Get the next character from a given Text object. | |
| void | drawPixel (uint16_t *videoBuffer, int x, int y, int paletteValue) |
| Draw a single pixel to the video buffer. | |
| void | underlineGap (int startX, int y, int width, uint16_t *videoBuffer, int color) |
| Underline a specificed area. | |
| void | testBitmap (Font *font, uint16_t *videoBuffer) |
| Test function to draw the font bitmap to the screen. | |
| void | testPalette (uint16_t *videoBuffer) |
| Test function to draw the currently loaded palette to the screen. | |
Private Attributes | |
| int | APPEAR_DELAY = 2 |
| int | SLANT_FACTOR = 64 |
| 128 = 1 pixel shift every 2 rows, 64 = 1 pixel shift every 4 rows | |
Friends | |
| class | Singleton< TextSystem > |
| class | TextComponent |
Definition at line 14 of file TextSystem.hpp.
| void TextSystem::appearText | ( | std::unique_ptr< Text > & | appearingText, |
| const std::string & | text, | ||
| Font * | font, | ||
| uint16_t * | videoBuffer, | ||
| int | x, | ||
| int | y, | ||
| int | color, | ||
| int | letterSpacing, | ||
| int | lineSpacing, | ||
| int | spaceWidth, | ||
| int | maxX = 256, | ||
| int | maxY = 0, | ||
| bool | hyphenate = false ) |
Create a Text object and renders each character with a delay to simulate typing effect.
| appearingText | The current apperance of the text |
| text | The text to render. |
| font | Pointer to the font to use for rendering. |
| videoBuffer | Pointer to the video buffer to draw to. |
| x | The x-coordinate to start drawing the text. |
| y | The y-coordinate to start drawing the text. |
| color | The color to use for the text. |
| letterSpacing | Pixels of horizontal space to add after each glyph. |
| lineSpacing | Pixels of vertical space to add after each line, on top of the font's line height. |
| spaceWidth | Pixels of horizontal space a ' ' character takes up. |
| maxX | Right edge (exclusive) used for word wrapping. |
| maxY | Bottom edge of the text area. When a line would not fit above it, the text pauses until appearTextNextPage() is called. 0 disables pagination. |
| hyphenate | Enable character-based splitting of overlong words (dialogue only). |
Definition at line 34 of file TextSystem.cpp.

| bool TextSystem::appearTextDone | ( | Text * | appearingText | ) |
Check if the text being rendered with appearText has finished appearing.
| appearingText | The current apperance of the text |
Definition at line 101 of file TextSystem.cpp.
| void TextSystem::appearTextNextPage | ( | Text * | appearingText | ) |
Clear the text area and continue the paused text from the top of it.
| appearingText | The current apperance of the text |
Definition at line 83 of file TextSystem.cpp.

| bool TextSystem::appearTextPaused | ( | Text * | appearingText | ) |
Check if the text being rendered with appearText is waiting for the next page.
| appearingText | The current apperance of the text |
Definition at line 78 of file TextSystem.cpp.

| void TextSystem::appearTextSkip | ( | Text * | appearingText | ) |
If a text is currently being rendered with appearText, this function will immediately render the rest of the text without delay.
| appearingText | The current apperance of the text |
Definition at line 63 of file TextSystem.cpp.

| void TextSystem::clearArea | ( | uint16_t * | videoBuffer, |
| int | x, | ||
| int | y, | ||
| int | width, | ||
| int | height ) |
Clear a rectangular area of the text video buffer.
| videoBuffer | Pointer to the video buffer to clear. |
| x | The x-coordinate of the top-left corner of the area to clear. |
| y | The y-coordinate of the top-left corner of the area to clear. |
| width | The width of the area to clear. |
| height | The height of the area to clear. |
Definition at line 174 of file TextSystem.cpp.


|
private |
Create a Text object and initialize its properties.
| text | The text content for the Text object. |
| font | Pointer to the font to use for rendering the text. |
| videoBuffer | Pointer to the video buffer to draw to. |
| startX | The x-coordinate to start drawing the text. |
| startY | The y-coordinate to start drawing the text. |
| color | The color to use for the text. |
| letterSpacing | Pixels of horizontal space to add after each glyph. |
| lineSpacing | Pixels of vertical space to add after each line, on top of the font's line height. |
| spaceWidth | Pixels of horizontal space a ' ' character takes up. |
| maxX | Right edge (exclusive) used for word wrapping. |
| maxY | Bottom edge used for pagination. 0 disables pagination. |
Definition at line 324 of file TextSystem.cpp.

| void TextSystem::drawGlyph | ( | const Glyph & | glyph, |
| Font * | font, | ||
| uint16_t * | videoBuffer, | ||
| int | x, | ||
| int | y, | ||
| int | color, | ||
| bool | bold, | ||
| bool | italic, | ||
| bool | underline ) |
Draw a single glyph to the screen.
| glyph | The glyph to draw. |
| font | Pointer to the font that contains the glyph. |
| videoBuffer | Pointer to the video buffer to draw to. |
| x | The x-coordinate to start drawing the glyph. |
| y | The y-coordinate to start drawing the glyph. |
| color | The color to use for the glyph. |
| bold | Whether to use the bold version of the bitmap. |
| italic | Whether the glyph should be sheared to simulate italic text. |
| underline | Whether the glyph should be underlined. |
Distance from baseline
Integer math equivalent of distY * (SLANT_FACTOR/256)
Position the underline just below the glyph
Definition at line 115 of file TextSystem.cpp.


|
private |
Draw the next character from the text struct to the screen.
Handle Newline
Don't add a space at the beginning of a line
Handle special instructions for text formatting
Color change
Reset to base color
bg palette only has 256 colors
If the glyph width is 0, skip it (char has not been defined in the font)
Pause on the current character; it is drawn once the next page starts
Definition at line 214 of file TextSystem.cpp.


|
private |
Draw a single pixel to the video buffer.
| videoBuffer | Pointer to the video buffer to draw to. |
| x | The x-coordinate of the pixel to draw. |
| y | The y-coordinate of the pixel to draw. |
| paletteValue | The color index in the palette to use for the pixel. |
Definition at line 368 of file TextSystem.cpp.

| void TextSystem::drawText | ( | const std::string & | text, |
| Font * | font, | ||
| uint16_t * | videoBuffer, | ||
| int | x, | ||
| int | y, | ||
| int | color, | ||
| int | letterSpacing, | ||
| int | lineSpacing, | ||
| int | spaceWidth, | ||
| int | xBoundary ) |
Draw text to the screen.
| text | The text to draw. |
| font | Pointer to the font to use for rendering. |
| videoBuffer | Pointer to the video buffer to draw to. |
| x | The x-coordinate to start drawing the text. |
| y | The y-coordinate to start drawing the text. |
| color | The color to use for the text. |
| letterSpacing | Pixels of horizontal space to add after each glyph. |
| lineSpacing | Pixels of vertical space to add after each line, on top of the font's line height. |
| spaceWidth | Pixels of horizontal space a ' ' character takes up. |
| xBoundary | Right edge (exclusive) used for word wrapping. |
Definition at line 7 of file TextSystem.cpp.

|
private |
Get the next character from a given Text object.
| text | Pointer to the Text object to extract the next character from. |
Return a special value indicating no more characters
Definition at line 359 of file TextSystem.cpp.

|
inlineoverride |
Definition at line 17 of file TextSystem.hpp.
|
inlineoverride |
Definition at line 21 of file TextSystem.hpp.
|
private |
Test function to draw the font bitmap to the screen.
| font | Pointer to the font to test. |
| videoBuffer | Pointer to the video buffer to draw to. |
Definition at line 394 of file TextSystem.cpp.

|
private |
Test function to draw the currently loaded palette to the screen.
| videoBuffer | Pointer to the video buffer to draw to. |
Definition at line 410 of file TextSystem.cpp.

|
private |
Underline a specificed area.
| startX | The starting x-coordinate of the area to underline. |
| y | The y-coordinate of the area to underline. |
| width | The width of the area to underline. |
| videoBuffer | Pointer to the video buffer to draw to. |
| color | The color to use for the underline. |
This function draws a horizontal line of the specified width at the specified y-coordinate, starting from the specified x-coordinate. It should be used to underline gaps in the text, that are not handled by the regular text rendering, i.e. the gaps between letters or spaces.
Definition at line 382 of file TextSystem.cpp.


|
inlineoverride |
Definition at line 25 of file TextSystem.hpp.
|
friend |
Definition at line 141 of file TextSystem.hpp.
|
friend |
Definition at line 145 of file TextSystem.hpp.
|
private |
Definition at line 147 of file TextSystem.hpp.
|
private |
128 = 1 pixel shift every 2 rows, 64 = 1 pixel shift every 4 rows
Definition at line 149 of file TextSystem.hpp.