Code: Select all
using namespace CEGUI;
SchemeManager::getSingleton().createFromFile("TaharezLook.scheme");
System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage("TaharezLook/MouseArrow");
WindowManager& winMgr = WindowManager::getSingleton();
DefaultWindow* d_root = (DefaultWindow*)winMgr.createWindow("DefaultWindow", "Root");
Font& defaultFont = FontManager::getSingleton().createFromFile("DejaVuSans-10.font");
System::getSingleton().getDefaultGUIContext().setDefaultFont(&defaultFont);
System::getSingleton().getDefaultGUIContext().setRootWindow(d_root);
FrameWindow* wnd = (FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "DemoWindow");
d_root->addChild(wnd);
wnd->setPosition(UVector2(cegui_reldim(0.25f),cegui_reldim(0.25f)));
wnd->setSize(USize(cegui_reldim(0.5f), cegui_reldim( 0.5f)));
wnd->setMaxSize(USize(cegui_reldim(1.0f), cegui_reldim( 1.0f)));
wnd->setMinSize(USize(cegui_reldim(0.1f), cegui_reldim( 0.1f)));
wnd->setText("Hello World!");
I want to render in the center,but it is on the top-left corner of the display,who can tell why?