Drawing custom text
Posted: Mon May 26, 2008 16:27
Hello,
I am attempting to get the CEGUI system to draw custom text that is not necessarily "on" a CEGUI::Window object. I read about the preferred use of a RenderCache, so I have been trying to use that. I first tried:
and then I tried the same thing, except inheriting from CEGUI::Window, and putting the cacheText() call in an overloaded populateRenderCache() function (d_renderCache.cacheText(...); ).
Only the first draws the text (the second appears to do nothing), but there are a few problems. First, it does not draw the text right away - it only draws it when something changes... i.e., I move a window, or I hover over a button, etc. Second, the text is not nearly as "clear" as the other text (such as text on a button), even when using the same font (in this case, Commonwealth-10.font).
Another (minor) problem is when I try CEGUI::TextFormatting::Centred (or any of the other members of CEGUI::TextFormatting), I get the error
which is why I have put (CEGUI::TextFormatting)2 instead.
Is there a better way to draw text? Or am I just doing it in the wrong way?
Thanks in advance for any help!
Kevin
I am attempting to get the CEGUI system to draw custom text that is not necessarily "on" a CEGUI::Window object. I read about the preferred use of a RenderCache, so I have been trying to use that. I first tried:
Code: Select all
CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
CEGUI::Window* wnd = wmgr.createWindow("DefaultWindow", "root");
wnd->getRenderCache().cacheText("this is some text", CEGUI::FontManager::getSingleton().getFont("Commonwealth-10"), (CEGUI::TextFormatting)2, CEGUI::Rect(100, 100, 500, 500), 0, CEGUI::ColourRect(CEGUI::colour(1.0f, 0.0f, 0.0f)));
and then I tried the same thing, except inheriting from CEGUI::Window, and putting the cacheText() call in an overloaded populateRenderCache() function (d_renderCache.cacheText(...); ).
Only the first draws the text (the second appears to do nothing), but there are a few problems. First, it does not draw the text right away - it only draws it when something changes... i.e., I move a window, or I hover over a button, etc. Second, the text is not nearly as "clear" as the other text (such as text on a button), even when using the same font (in this case, Commonwealth-10.font).
Another (minor) problem is when I try CEGUI::TextFormatting::Centred (or any of the other members of CEGUI::TextFormatting), I get the error
Code: Select all
error C2039: 'Centred' : is not a member of 'CEGUI::TextFormatting'
which is why I have put (CEGUI::TextFormatting)2 instead.
Is there a better way to draw text? Or am I just doing it in the wrong way?
Thanks in advance for any help!
Kevin