SDL implementation of TypeCase.
More...
#include <SdlTypeCase.h>
|
| SdlTypeCase (SdlDisplay &display, const UiFont &font, int width, int height) |
| Constructor. More...
|
|
| SdlTypeCase (const SdlTypeCase &)=delete |
|
virtual | ~SdlTypeCase () |
|
MR_UInt32 | CountTextures () const override |
| Count the number of active backing textures. More...
|
|
SdlTypeCase & | operator= (const SdlTypeCase &)=delete |
|
void | Prepare (const std::string &s, TypeLine *rects=nullptr) override |
| Prepare a string to be rendered. More...
|
|
void | Render (const TypeLine &s, const Color color, int x, int y, boost::optional< size_t > caret={}) override |
| Render a string. More...
|
|
void | RenderTexture (MR_UInt32 idx, int x, int y, double scale=1.0) override |
| Renders the backing texture (for debugging purposes). More...
|
|
| TypeCase (const UiFont &font, int width, int height) |
| Constructor. More...
|
|
| TypeCase (const TypeCase &)=delete |
|
virtual | ~TypeCase () |
|
int | GetHeight () const |
| Retrieve the height of each of the backing textures. More...
|
|
int | GetWidth () const |
| Retrieve the width of each of the backing textures. More...
|
|
TypeCase & | operator= (const TypeCase &)=delete |
|
SDL implementation of TypeCase.
- Author
- Michael Imamura
HoverRace::Display::SDL::SdlTypeCase::SdlTypeCase |
( |
SdlDisplay & |
display, |
|
|
const UiFont & |
font, |
|
|
int |
width, |
|
|
int |
height |
|
) |
| |
Constructor.
- Parameters
-
display | The SDL display for rendering. |
font | The font. |
width | The width of the backing texture. |
height | The height of the backing texture. |
HoverRace::Display::SDL::SdlTypeCase::SdlTypeCase |
( |
const SdlTypeCase & |
| ) |
|
|
delete |
HoverRace::Display::SDL::SdlTypeCase::~SdlTypeCase |
( |
| ) |
|
|
virtual |
Adds a glyph to the backing textures.
- Parameters
-
[in,out] | ent | The glyph entry to initialize. |
| s | A single UTF-8 character. |
| cp | The Unicode code point represented by the character. |
| added | Buffer of added glyphs. |
- Returns
- The same glyph entry that was passed in.
MR_UInt32 HoverRace::Display::SDL::SdlTypeCase::CountTextures |
( |
| ) |
const |
|
overridevirtual |
GlyphEntry & HoverRace::Display::SDL::SdlTypeCase::FindGlyph |
( |
const std::string & |
s, |
|
|
MR_UInt32 |
cp, |
|
|
std::string & |
added |
|
) |
| |
|
private |
Finds a glyph in the backing textures, creating it if necessary.
- Parameters
-
s | A single UTF-8 character. |
cp | The Unicode code point represented by the character. |
added | Buffer of added glyphs. |
- Returns
- The entry for the glyph.
void HoverRace::Display::SDL::SdlTypeCase::Prepare |
( |
const std::string & |
s, |
|
|
TypeLine * |
rects = nullptr |
|
) |
| |
|
overridevirtual |
Prepare a string to be rendered.
If rects
is omitted, then this can be used to preemptively add characters to the type case before they are used later.
- Parameters
-
| s | The text string that will be rendered. |
[out] | rects | Optional destination buffer for the prepared text. |
Implements HoverRace::Display::TypeCase.
void HoverRace::Display::SDL::SdlTypeCase::Render |
( |
const TypeLine & |
s, |
|
|
const Color |
color, |
|
|
int |
x, |
|
|
int |
y, |
|
|
boost::optional< size_t > |
caret = {} |
|
) |
| |
|
overridevirtual |
Render a string.
Only characters which have been previously added via AddChars() will be rendered.
- Parameters
-
s | The string to render. |
color | The color of the string. |
x | The screen X coordinate of the upper-left corner. |
y | The screen Y coordinate of the upper-left corner. |
caret | The optional caret position. |
Implements HoverRace::Display::TypeCase.
void HoverRace::Display::SDL::SdlTypeCase::RenderTexture |
( |
MR_UInt32 |
idx, |
|
|
int |
x, |
|
|
int |
y, |
|
|
double |
scale = 1.0 |
|
) |
| |
|
overridevirtual |
Renders the backing texture (for debugging purposes).
- Parameters
-
idx | The texture index. |
x | The x coordinate. |
y | The y coordinate. |
scale | The scaling factor. |
Implements HoverRace::Display::TypeCase.
MR_UInt32 HoverRace::Display::SDL::SdlTypeCase::curMap |
|
private |
int HoverRace::Display::SDL::SdlTypeCase::curX |
|
private |
int HoverRace::Display::SDL::SdlTypeCase::curY |
|
private |
SdlDisplay& HoverRace::Display::SDL::SdlTypeCase::display |
|
protected |
std::array<std::unique_ptr<glyphPage_t>, 256> HoverRace::Display::SDL::SdlTypeCase::glyphs |
|
private |
std::vector<std::unique_ptr<SdlDynamicTexture> > HoverRace::Display::SDL::SdlTypeCase::maps |
|
private |
The documentation for this class was generated from the following files: