persona-3-dual
A DS demake of Persona 3
Loading...
Searching...
No Matches
TextSystem.hpp
Go to the documentation of this file.
1
6
7#pragma once
8
9#include "core/routerIDs.hpp"
10#include "types/TextTypes.hpp"
11#include <aegis/system.hpp>
12#include <memory>
13
14class TextSystem : public ae::System, public ae::Singleton<TextSystem>
15{
16 public:
17 void init() override
18 {
19 }
20
21 void shutdown() override
22 {
23 }
24
25 void update(ae::q20_12_t /*dt*/) override
26 {
27 }
28
42 void drawText(const std::string& text,
43 Font* font,
44 uint16_t* videoBuffer,
45 int x,
46 int y,
47 int color,
48 int letterSpacing,
49 int lineSpacing,
50 int spaceWidth,
51 int xBoundary);
52
70 void appearText(std::unique_ptr<Text>& appearingText,
71 const std::string& text,
72 Font* font,
73 uint16_t* videoBuffer,
74 int x,
75 int y,
76 int color,
77 int letterSpacing,
78 int lineSpacing,
79 int spaceWidth,
80 int maxX = 256,
81 int maxY = 0,
82 bool hyphenate = false);
83
89 void appearTextSkip(Text* appearingText);
90
96 bool appearTextPaused(Text* appearingText);
97
102 void appearTextNextPage(Text* appearingText);
103
109 bool appearTextDone(Text* appearingText);
110
123 void drawGlyph(const Glyph& glyph,
124 Font* font,
125 uint16_t* videoBuffer,
126 int x,
127 int y,
128 int color,
129 bool bold,
130 bool italic,
131 bool underline);
132
141 void clearArea(uint16_t* videoBuffer, int x, int y, int width, int height);
142
143 private:
144 friend class Singleton<TextSystem>;
145 friend class TextComponent;
146
149 int SLANT_FACTOR = 64;
150
155 void drawNextFromText(Text* text);
156
172 std::unique_ptr<Text> createText(const std::string& text,
173 Font* font,
174 uint16_t* videoBuffer,
175 int startX,
176 int startY,
177 int color,
178 int letterSpacing,
179 int lineSpacing,
180 int spaceWidth,
181 int maxX = 256,
182 int maxY = 0);
183
190 char getNextChar(Text* text);
191
199 void drawPixel(uint16_t* videoBuffer, int x, int y, int paletteValue);
200
211 void underlineGap(int startX, int y, int width, uint16_t* videoBuffer, int color);
212
219 void testBitmap(Font* font, uint16_t* videoBuffer);
220
226 void testPalette(uint16_t* videoBuffer);
227 // ---
228};
void init() override
char getNextChar(Text *text)
Get the next character from a given Text object.
bool appearTextDone(Text *appearingText)
Check if the text being rendered with appearText has finished appearing.
void clearArea(uint16_t *videoBuffer, int x, int y, int width, int height)
Clear a rectangular area of the text video buffer.
void underlineGap(int startX, int y, int width, uint16_t *videoBuffer, int color)
Underline a specificed area.
void shutdown() 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.
Definition TextSystem.cpp:7
void update(ae::q20_12_t) override
void drawPixel(uint16_t *videoBuffer, int x, int y, int paletteValue)
Draw a single pixel to the video buffer.
void appearTextNextPage(Text *appearingText)
Clear the text area and continue the paused text from the top of it.
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.
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.
void testPalette(uint16_t *videoBuffer)
Test function to draw the currently loaded palette to the screen.
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 appearTextSkip(Text *appearingText)
If a text is currently being rendered with appearText, this function will immediately render the rest...
void testBitmap(Font *font, uint16_t *videoBuffer)
Test function to draw the font bitmap to the screen.
bool appearTextPaused(Text *appearingText)
Check if the text being rendered with appearText is waiting for the next page.
int SLANT_FACTOR
128 = 1 pixel shift every 2 rows, 64 = 1 pixel shift every 4 rows
void drawNextFromText(Text *text)
Draw the next character from the text struct to the screen.
friend class TextComponent
Holds routerIDs used for systems.
Stores data for a font.
Definition TextTypes.hpp:69
Stores data for a single glyph (character) in a font.
Definition TextTypes.hpp:55
A struct that represents a block of text being rendered on the screen.
Definition TextTypes.hpp:98