[Closed/Unconstructive] setPosition does not work
Posted: Tue Aug 12, 2014 06:26
hello everyone , today i write my first cegui program,but in my program the function "setPostion" seem to be not in effect,here is my code:
I want to render in the center,but it is on the top-left corner of the display,who can tell why?
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?