CL_TextStyler::draw - ClanLib Game SDK

Home | All Classes | Grouped Classes | Index | Search

# CL_TextStyler::draw

Draws text onto a graphics context.

    	int draw(
    		int x, int y, const std::string& str, CL_GraphicContext* context = 0);

    	int draw(
    		CL_Rect dest, const std::string& str, CL_GraphicContext* context = 0);

    	int draw(
    		int x, int y, std::string::const_iterator start, std::string::const_iterator end, CL_GraphicContext* context = 0);

    	int draw(
    		CL_Rect dest, std::string::const_iterator start, std::string::const_iterator end, CL_GraphicContext* context = 0);

Parameters:

x, y
  Anchor position of where to draw at. Actual rendering position depends on the alignment mode.
dest
  Rectangle to draw text in. The text will be word-wrapped against delimiters to fit inside the rectangle.
str
  The source string to parse and render.
start
  String position to begin rendering at, inclusive.
end
  String position to end rendering at, exclusive.
context
  Graphic context on which to render upon. If null, will use CL_Display's current graphic context.

Return value:

The number of glyphs that were drawn.

Detailed description:

You can specify a dest rectangle with a width or height of zero or less to disable word wrapping or height truncating, respectively.

See also:

CL_GraphicContext | CL_Rect | CL_Display | CL_TextStyler

Questions or comments, write to the ClanLib mailing list.