aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics/text32.h
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/graphics/text32.h')
-rw-r--r--engines/sci/graphics/text32.h98
1 files changed, 44 insertions, 54 deletions
diff --git a/engines/sci/graphics/text32.h b/engines/sci/graphics/text32.h
index c8fafb287f..945cc81130 100644
--- a/engines/sci/graphics/text32.h
+++ b/engines/sci/graphics/text32.h
@@ -45,11 +45,11 @@ enum ScrollDirection {
class GfxFont;
/**
- * 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.
+ * 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.
*/
class GfxText32 {
private:
@@ -57,10 +57,10 @@ private:
GfxCache *_cache;
/**
- * The width and height of the currently active text
- * bitmap, in text-system coordinates.
+ * The width and height of the currently active text bitmap, in text-system
+ * coordinates.
*
- * @note These are unsigned in the actual engine.
+ * @note These are unsigned in SSCI.
*/
int16 _width, _height;
@@ -75,20 +75,19 @@ private:
uint8 _backColor;
/**
- * The transparent color of the text box. Used when
- * compositing the bitmap onto the screen.
+ * The transparent color of the text box. Used when compositing the bitmap
+ * onto the screen.
*/
uint8 _skipColor;
/**
- * The rect where the text is drawn within the bitmap.
- * This rect is clipped to the dimensions of the bitmap.
+ * The rect where the text is drawn within the bitmap. This rect is clipped
+ * to the dimensions of the bitmap.
*/
Common::Rect _textRect;
/**
- * The text being drawn to the currently active text
- * bitmap.
+ * The text being drawn to the currently active text bitmap.
*/
Common::String _text;
@@ -103,7 +102,8 @@ private:
int16 _borderColor;
/**
- * TODO: Document
+ * If true, text will be drawn using a dither that draws only every other
+ * pixel of the text.
*/
bool _dimmed;
@@ -123,19 +123,17 @@ private:
void drawText(const uint index, uint length);
/**
- * Gets the length of the longest run of text available
- * within the currently loaded text, starting from the
- * given `charIndex` and running for up to `maxWidth`
- * pixels. Returns the number of characters that can be
- * written, and mutates the value pointed to by
- * `charIndex` to point to the index of the next
- * character to render.
+ * Gets the length of the longest run of text available within the currently
+ * loaded text, starting from the given `charIndex` and running for up to
+ * `maxWidth` pixels. Returns the number of characters that can be written,
+ * and mutates the value pointed to by `charIndex` to point to the index of
+ * the next character to render.
*/
uint getLongest(uint *charIndex, const int16 maxWidth);
/**
- * Gets the pixel width of a substring of the currently
- * loaded text, without scaling.
+ * Gets the pixel width of a substring of the currently loaded text, without
+ * scaling.
*/
int16 getTextWidth(const uint index, uint length) const;
@@ -163,29 +161,27 @@ public:
reg_t _bitmap;
/**
- * The size of the x-dimension of the coordinate system
- * used by the text renderer. Static since it was global in SSCI.
+ * The size of the x-dimension of the coordinate system used by the text
+ * renderer. Static since it was global in SSCI.
*/
static int16 _xResolution;
/**
- * The size of the y-dimension of the coordinate system
- * used by the text renderer. Static since it was global in SSCI.
+ * The size of the y-dimension of the coordinate system used by the text
+ * renderer. Static since it was global in SSCI.
*/
static int16 _yResolution;
/**
- * The currently active font resource used to write text
- * into the bitmap.
+ * The currently active font resource used to write text into the bitmap.
*
- * @note SCI engine builds the font table directly
- * inside of FontMgr; we use GfxFont instead.
+ * @note SSCI builds the font table directly inside of FontMgr; we use
+ * GfxFont instead.
*/
GfxFont *_font;
/**
- * Creates a plain font bitmap with a flat color
- * background.
+ * Creates a plain font bitmap with a flat color background.
*/
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);
@@ -212,26 +208,22 @@ public:
/**
* Draws the given text to the bitmap.
*
- * @note The original engine holds a reference to a
- * shared string which lets the text be updated from
- * outside of the font manager. Instead, we give this
- * extra signature to send the text to draw.
- *
- * TODO: Use shared string instead?
+ * @note SSCI holds a reference to a shared string which lets the text be
+ * updated from outside of the font manager. Instead, we use this extra
+ * signature to send the text to draw.
*/
void drawTextBox(const Common::String &text);
/**
- * Erases the given rect by filling with the background
- * color.
+ * Erases the given rect by filling with the background color.
*/
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);
/**
- * Sets the font to be used for rendering and
- * calculation of text dimensions.
+ * Sets the font to be used for rendering and calculation of text
+ * dimensions.
*/
void setFont(const GuiResourceId fontId);
@@ -251,8 +243,8 @@ public:
Common::Rect getTextSize(const Common::String &text, const int16 maxWidth, bool doScaling);
/**
- * Gets the pixel width of a substring of the currently
- * loaded text, with scaling.
+ * Gets the pixel width of a substring of the currently loaded text, with
+ * scaling.
*/
int16 getTextWidth(const Common::String &text, const uint index, const uint length);
@@ -262,23 +254,21 @@ public:
int16 getStringWidth(const Common::String &text);
/**
- * Gets the number of characters of `text`, starting
- * from `index`, that can be safely rendered into
- * `textRect`.
+ * Gets the number of characters of `text`, starting from `index`, that can
+ * be safely rendered into `textRect`.
*/
int16 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` using the given font.
+ * Gets the number of characters of `text`, starting from `index`, that can
+ * be safely rendered into `textRect` using the given font.
*/
int16 getTextCount(const Common::String &text, const uint index, const GuiResourceId fontId, const Common::Rect &textRect, const bool doScaling);
/**
* 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.
+ * textarea, and `textLine` contains the text to draw as the newly visible
+ * line. Originally FontMgr::DrawOneLine and FontMgr::UpOneLine.
*/
void scrollLine(const Common::String &textLine, int numLines, uint8 color, TextAlign align, GuiResourceId fontId, ScrollDirection dir);
};