Page 1 of 1

i can't get the width and height, help

Posted: Thu Oct 28, 2004 06:47
by yizhong
/////////////////////////////////////////////////////////////////////////////////////

CEGUI::Renderer* rend = CEGUI::System::getSingleton().getRenderer();

rend->getWidth();
rend->getHeight();

/////////////////////////////////////////////////////////////////////////////////////

can't get the correct 'Width' and 'Height';

CEGUI::DirectX9Renderer* rend = (CEGUI::DirectX9Renderer*)CEGUI::System::getSingleton().getRenderer();

also can't get right. help~

this code come from 'ogre demo4' :?:

i can't get the width and height, help

Posted: Thu Oct 28, 2004 08:45
by Emmeran
what do you get? I use the upper version without problems

u can also use this instead:

Code: Select all

   mViewport = mWindow->addViewport(mCamera);

         //(...)

   mScreenX = mViewport->getActualWidth();
   mScreenY = mViewport->getActualHeight();


do this when you initialise your program and make mScreenX and mScreenY global aviable

i can't get the width and height, help

Posted: Sun Oct 31, 2004 01:18
by gcarlton
One thing is that the renderer (and all of CEGUI) returns the display size, even when rendering in windowed mode. So if the display is set to 800x600 and the app is running in a 300x200 window, the gui size is 800x600 (even though it squashes the rendering into that 300x200 window).

This sounds odd, but it works ok. The only place I ran into trouble was passing absolute mouse coordinates into CEGUI - I had to scale them accordingly.

i can't get the width and height, help

Posted: Sun Oct 31, 2004 08:15
by CrazyEddie
You should get the correct initial size for the display or window (at least under Ogre, I'll admit I'm not 100% sure about the other renderers). If the display or widow size changes, then the system will still report the initial size :) There is a mechanism for changes to the display or window size to propogate through the system, but much of it is not wired up properly yet.

CE.