#include <text32.h>
Public Member Functions | |
GfxText32 (SegManager *segMan, GfxCache *fonts) | |
reg_t | createFontBitmap (int16 width, int16 height, const Common::Rect &rect, const Common::String &text, const uint8 foreColor, const uint8 backColor, const uint8 skipColor, const GuiResourceId fontId, TextAlign alignment, const int16 borderColor, bool dimmed, const bool doScaling, const bool gc) |
reg_t | createFontBitmap (const CelInfo32 &celInfo, const Common::Rect &rect, const Common::String &text, const int16 foreColor, const int16 backColor, const GuiResourceId fontId, const int16 skipColor, const int16 borderColor, const bool dimmed, const bool gc) |
reg_t | createTitledFontBitmap (int16 width, int16 height, const Common::Rect &textRect, const Common::String &text, const uint8 foreColor, const uint8 backColor, const uint8 skipColor, const GuiResourceId fontId, const TextAlign alignment, const int16 borderColor, const Common::String &title, const uint8 titleForeColor, const uint8 titleBackColor, const GuiResourceId titleFontId, const bool doScaling, const bool gc) |
int | scaleUpWidth (int value) const |
int | scaleUpHeight (int value) const |
void | drawTextBox () |
void | drawTextBox (const Common::String &text) |
void | erase (const Common::Rect &rect, const bool doScaling) |
void | invertRect (const reg_t bitmap, const int16 bitmapStride, const Common::Rect &rect, const uint8 foreColor, const uint8 backColor, const bool doScaling) |
void | setFont (const GuiResourceId fontId) |
int16 | getScaledFontHeight () const |
uint16 | getCharWidth (const uint16 charIndex, const bool doScaling) const |
Common::Rect | getTextSize (const Common::String &text, const int16 maxWidth, bool doScaling) |
int16 | getTextWidth (const Common::String &text, const uint index, const uint length) |
int16 | getStringWidth (const Common::String &text) |
int16 | getTextCount (const Common::String &text, const uint index, const Common::Rect &textRect, const bool doScaling) |
int16 | getTextCount (const Common::String &text, const uint index, const GuiResourceId fontId, const Common::Rect &textRect, const bool doScaling) |
void | scrollLine (const Common::String &textLine, int numLines, uint8 color, TextAlign align, GuiResourceId fontId, ScrollDirection dir) |
bool | SwitchToFont1001OnKorean (const char *text) |
Static Public Member Functions | |
static void | init () |
Public Attributes | |
reg_t | _bitmap |
GfxFont * | _font |
Static Public Attributes | |
static int16 | _xResolution |
static int16 | _yResolution |
This class handles text calculation and rendering for SCI32 games. The text calculation system in SCI32 is nearly the same as SCI16, which means this class behaves similarly. Notably, GfxText32 maintains drawing parameters across multiple calls, instead of requiring all text parameters to be provided on every draw call.
|
static |
Initialises static GfxText32 members.
reg_t Sci::GfxText32::createFontBitmap | ( | int16 | width, |
int16 | height, | ||
const Common::Rect & | rect, | ||
const Common::String & | text, | ||
const uint8 | foreColor, | ||
const uint8 | backColor, | ||
const uint8 | skipColor, | ||
const GuiResourceId | fontId, | ||
TextAlign | alignment, | ||
const int16 | borderColor, | ||
bool | dimmed, | ||
const bool | doScaling, | ||
const bool | gc | ||
) |
Creates a plain font bitmap with a flat color background.
reg_t Sci::GfxText32::createFontBitmap | ( | const CelInfo32 & | celInfo, |
const Common::Rect & | rect, | ||
const Common::String & | text, | ||
const int16 | foreColor, | ||
const int16 | backColor, | ||
const GuiResourceId | fontId, | ||
const int16 | skipColor, | ||
const int16 | borderColor, | ||
const bool | dimmed, | ||
const bool | gc | ||
) |
Creates a font bitmap with a view background.
reg_t Sci::GfxText32::createTitledFontBitmap | ( | int16 | width, |
int16 | height, | ||
const Common::Rect & | textRect, | ||
const Common::String & | text, | ||
const uint8 | foreColor, | ||
const uint8 | backColor, | ||
const uint8 | skipColor, | ||
const GuiResourceId | fontId, | ||
const TextAlign | alignment, | ||
const int16 | borderColor, | ||
const Common::String & | title, | ||
const uint8 | titleForeColor, | ||
const uint8 | titleBackColor, | ||
const GuiResourceId | titleFontId, | ||
const bool | doScaling, | ||
const bool | gc | ||
) |
Creates a titled font bitmap with a flat color background.
void Sci::GfxText32::drawTextBox | ( | ) |
Draws the text to the bitmap.
void Sci::GfxText32::drawTextBox | ( | const Common::String & | text | ) |
Draws the given text to the bitmap.
void Sci::GfxText32::erase | ( | const Common::Rect & | rect, |
const bool | doScaling | ||
) |
Erases the given rect by filling with the background color.
void Sci::GfxText32::setFont | ( | const GuiResourceId | fontId | ) |
Sets the font to be used for rendering and calculation of text dimensions.
int16 Sci::GfxText32::getScaledFontHeight | ( | ) | const |
Gets the pixel height of the currently loaded font.
uint16 Sci::GfxText32::getCharWidth | ( | const uint16 | charIndex, |
const bool | doScaling | ||
) | const |
Gets the width of a character.
Common::Rect Sci::GfxText32::getTextSize | ( | const Common::String & | text, |
const int16 | maxWidth, | ||
bool | doScaling | ||
) |
Retrieves the width and height of a block of text.
int16 Sci::GfxText32::getTextWidth | ( | const Common::String & | text, |
const uint | index, | ||
const uint | length | ||
) |
Gets the pixel width of a substring of the currently loaded text, with scaling.
int16 Sci::GfxText32::getStringWidth | ( | const Common::String & | text | ) |
Retrieves the width of a line of text.
int16 Sci::GfxText32::getTextCount | ( | const Common::String & | text, |
const uint | index, | ||
const Common::Rect & | textRect, | ||
const bool | doScaling | ||
) |
Gets the number of characters of text
, starting from index
, that can be safely rendered into textRect
.
int16 Sci::GfxText32::getTextCount | ( | const Common::String & | text, |
const uint | index, | ||
const GuiResourceId | fontId, | ||
const Common::Rect & | textRect, | ||
const bool | doScaling | ||
) |
Gets the number of characters of text
, starting from index
, that can be safely rendered into textRect
using the given font.
void Sci::GfxText32::scrollLine | ( | const Common::String & | textLine, |
int | numLines, | ||
uint8 | color, | ||
TextAlign | align, | ||
GuiResourceId | fontId, | ||
ScrollDirection | dir | ||
) |
Scroll up/down one line. numLines
is the number of the lines in the textarea, and textLine
contains the text to draw as the newly visible line. Originally FontMgr::DrawOneLine and FontMgr::UpOneLine.
reg_t Sci::GfxText32::_bitmap |
The memory handle of the currently active bitmap.
|
static |
The size of the x-dimension of the coordinate system used by the text renderer. Static since it was global in SSCI.
|
static |
The size of the y-dimension of the coordinate system used by the text renderer. Static since it was global in SSCI.
GfxFont* Sci::GfxText32::_font |
The currently active font resource used to write text into the bitmap.