i can't get the width and height, help

Forum for general chit-chat or off-topic discussion.

Moderators: CEGUI MVP, CEGUI Team

User avatar
yizhong
Just popping in
Just popping in
Posts: 14
Joined: Wed Jan 12, 2005 12:06

i can't get the width and height, help

Postby yizhong » Thu Oct 28, 2004 06:47

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

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' :?:

User avatar
Emmeran
Quite a regular
Quite a regular
Posts: 46
Joined: Wed Jan 12, 2005 12:06
Location: Germany, near Nuremberg
Contact:

i can't get the width and height, help

Postby Emmeran » Thu Oct 28, 2004 08:45

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

User avatar
gcarlton
Just can't stay away
Just can't stay away
Posts: 149
Joined: Wed Jan 12, 2005 12:06

i can't get the width and height, help

Postby gcarlton » Sun Oct 31, 2004 01:18

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.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

i can't get the width and height, help

Postby CrazyEddie » Sun Oct 31, 2004 08:15

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.


Return to “Offtopic Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests