[Scummvm-cvs-logs] SF.net SVN: scummvm:[55143] scummvm/trunk/graphics/font.h
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Fri Jan 7 13:43:00 CET 2011
Revision: 55143
http://scummvm.svn.sourceforge.net/scummvm/?rev=55143&view=rev
Author: lordhoto
Date: 2011-01-07 12:43:00 +0000 (Fri, 07 Jan 2011)
Log Message:
-----------
GRAPHICS: Some basic documentation for Font.
Modified Paths:
--------------
scummvm/trunk/graphics/font.h
Modified: scummvm/trunk/graphics/font.h
===================================================================
--- scummvm/trunk/graphics/font.h 2011-01-07 12:26:01 UTC (rev 55142)
+++ scummvm/trunk/graphics/font.h 2011-01-07 12:43:00 UTC (rev 55143)
@@ -38,9 +38,9 @@
/** Text alignment modes */
enum TextAlign {
kTextAlignInvalid,
- kTextAlignLeft, ///< Text should be aligned to the left
- kTextAlignCenter, ///< Text should be centered
- kTextAlignRight ///< Text should be aligned to the right
+ kTextAlignLeft, ///< Text should be aligned to the left
+ kTextAlignCenter, ///< Text should be centered
+ kTextAlignRight ///< Text should be aligned to the right
};
/**
@@ -53,12 +53,46 @@
Font() {}
virtual ~Font() {}
+ /**
+ * Query the height of the font.
+ *
+ * @return font height.
+ */
virtual int getFontHeight() const = 0;
+
+ /**
+ * Query the maximum width of the font.
+ *
+ * @return maximum font width.
+ */
virtual int getMaxCharWidth() const = 0;
+ /**
+ * Query the width of a specific character.
+ *
+ * @param chr The character to query the width of.
+ * @return The character's width.
+ */
virtual int getCharWidth(byte chr) const = 0;
+
+ /**
+ * Draw a character at a specific point on a surface.
+ *
+ * Note that the point describes the top left edge point of the
+ * character's bounding box.
+ *
+ * The Font implemenation should take care of not drawing outside of the
+ * specified surface.
+ *
+ * @param dst The surface to drawn on.
+ * @param chr The character to draw.
+ * @param x The x coordinate where to draw the character.
+ * @param y The y coordinate where to draw the character.
+ * @param color The color of the character.
+ */
virtual void drawChar(Surface *dst, byte chr, int x, int y, uint32 color) const = 0;
+ // TODO: Add doxygen comments to this
void drawString(Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, TextAlign align = kTextAlignLeft, int deltax = 0, bool useEllipsis = true) const;
/**
@@ -74,15 +108,17 @@
* It returns the maximal width of any of the new lines (i.e. a value which is less
* or equal to maxWidth).
*
- * @param str the string to word wrap
- * @param maxWidth the maximum width a line may have
- * @param lines the string list to which the text lines from str are appended
+ * @param str the string to word wrap
+ * @param maxWidth the maximum width a line may have
+ * @param lines the string list to which the text lines from str are appended
* @return the maximal width of any of the lines added to lines
*/
int wordWrapText(const Common::String &str, int maxWidth, Common::Array<Common::String> &lines) const;
};
-
+/**
+ * A SCUMM style font.
+ */
class ScummFont : public Font {
public:
virtual int getFontHeight() const { return 8; }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list