aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorDenis Kasak2009-07-01 01:02:48 +0000
committerDenis Kasak2009-07-01 01:02:48 +0000
commit49e1a07f277d48b5e597730af76e9247bfff58b8 (patch)
treee253521dedb23895806d046f0030ae5198328307 /engines
parent85a5871873499a2965dd5badffd224a7560f9b60 (diff)
downloadscummvm-rg350-49e1a07f277d48b5e597730af76e9247bfff58b8.tar.gz
scummvm-rg350-49e1a07f277d48b5e597730af76e9247bfff58b8.tar.bz2
scummvm-rg350-49e1a07f277d48b5e597730af76e9247bfff58b8.zip
Added Font::drawString overload that takes in a pointer to a byte buffer and a length instead of a Common::String. Changed the former drawString to be a wrapper for the new one.
svn-id: r41980
Diffstat (limited to 'engines')
-rw-r--r--engines/draci/font.cpp22
-rw-r--r--engines/draci/font.h4
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);