diff options
-rw-r--r-- | engines/draci/font.cpp | 22 | ||||
-rw-r--r-- | engines/draci/font.h | 4 |
2 files changed, 23 insertions, 3 deletions
diff --git a/engines/draci/font.cpp b/engines/draci/font.cpp index d9e84899b7..cfc09cb5ef 100644 --- a/engines/draci/font.cpp +++ b/engines/draci/font.cpp @@ -205,20 +205,20 @@ void Font::drawChar(Surface *dst, uint8 chr, int tx, int ty) const { * @brief Draw a string to a Draci::Surface * * @param dst Pointer to the destination surface - * @param str String to draw + * @param str Buffer containing string data + * @param len Length of the data * @param x Horizontal offset on the surface * @param y Vertical offset on the surface * @param spacing Space to leave between individual characters. Defaults to 0. */ -void Font::drawString(Surface *dst, const Common::String &str, +void Font::drawString(Surface *dst, const byte *str, uint len int x, int y, int spacing) const { assert(dst != NULL); assert(x >= 0); assert(y >= 0); int curx = x; - uint len = str.size(); for (unsigned int i = 0; i < len; ++i) { @@ -233,6 +233,22 @@ void Font::drawString(Surface *dst, const Common::String &str, } /** + * @brief Draw a string to a Draci::Surface + * + * @param dst Pointer to the destination surface + * @param str String to draw + * @param x Horizontal offset on the surface + * @param y Vertical offset on the surface + * @param spacing Space to leave between individual characters. Defaults to 0. + */ + +void Font::drawString(Surface *dst, const Common::String &str, + int x, int y, int spacing) const { + + drawString(dst, str, str.size(), x, y, spacing); +} + +/** * @brief Calculate the width of a string when drawn in the current font * * @param str String to draw diff --git a/engines/draci/font.h b/engines/draci/font.h index a805a99016..c108a4493e 100644 --- a/engines/draci/font.h +++ b/engines/draci/font.h @@ -62,8 +62,12 @@ public: uint8 getMaxCharWidth() const { return _maxCharWidth; }; uint8 getCharWidth(byte chr) const; void drawChar(Surface *dst, uint8 chr, int tx, int ty) const; + + void drawString(Surface *dst, const byte *str, uint len, int x, int y, + int spacing = 0) const; void drawString(Surface *dst, const Common::String &str, int x, int y, int spacing = 0) const; + int getStringWidth(const Common::String &str, int spacing = 0) const; void setColour(uint8 colour); |