Hi there,
I'm not sure to ask this question here ore on the Ogre forum but I don't now if its related to CEGUI or Ogre so I'll ask both.
I've implemented a window resize function for the SDL so that I'm able to resize the Ogre window. Then I have two basic problems:
The view of my camera also gets resized. But I want to have the effect of only "making my window bigger and see more of the scene", not zooming in.
The second problem and I think its related to this one is the CEGUI elements change there size. But they should retain their current size no matter how the window around gets resized. There are special settings for CEGUI (like AutoScale= False) and so on but nothing changed this behavior and because of the view problem maybe I'm doing something wrong in Ogre.
I hope I described my problem so that it's understandable what I mean.
Thanks for you help!
Ben
Resizing SDL Ogre window without resizing CEGUI elements
Moderators: CEGUI MVP, CEGUI Team
- lindquist
- CEGUI Team (Retired)
- Posts: 770
- Joined: Mon Jan 24, 2005 21:20
- Location: Copenhagen, Denmark
Re: Resizing SDL Ogre window without resizing CEGUI elements
remember to call setDisplaySize of your renderer module with your new "screen" resolution. If you do this and have auto scaling disabled for both your imagesets and fonts you should get the result you're looking for.
Re: Resizing SDL Ogre window without resizing CEGUI elements
Hi there,
I finally added the setDisplaySize method to the Ogre renderer and then after calling it -> it works fine!
Thanks for your help...
Ben
I finally added the setDisplaySize method to the Ogre renderer and then after calling it -> it works fine!
Thanks for your help...
Ben
Re: Resizing SDL Ogre window without resizing CEGUI elements
Well, I found another problem when I define a window like this:
<Window Type="TaharezLook/FrameWindow" Name="MoveWindow">
<Property Name="AbsolutePosition" Value="x:100.0 y:100.0" />
<Property Name="AbsoluteMinSize" Value="w:400.0 h:300.0" />
<Property Name="AbsoluteMaxSize" Value="w:400.0 h:300.0" />
<Property Name="Text" Value="Move Window" />
</Window>
Everything seems to be fine, I can resize my render window and the CEGUI window is at position 100 x 100 with the size of 400 x 300 and I can't resize the CEGUI window. That's what I want.
But when I move the CEGUI window with the mouse and then resize the render window afterwards it seems that CEGUI forgot the above settings and the CEGUI window gets adjusted in size with the render window.
Any solutions to this or do I have to change somthing in the properties?
Thanks,
Ben
<Window Type="TaharezLook/FrameWindow" Name="MoveWindow">
<Property Name="AbsolutePosition" Value="x:100.0 y:100.0" />
<Property Name="AbsoluteMinSize" Value="w:400.0 h:300.0" />
<Property Name="AbsoluteMaxSize" Value="w:400.0 h:300.0" />
<Property Name="Text" Value="Move Window" />
</Window>
Everything seems to be fine, I can resize my render window and the CEGUI window is at position 100 x 100 with the size of 400 x 300 and I can't resize the CEGUI window. That's what I want.
But when I move the CEGUI window with the mouse and then resize the render window afterwards it seems that CEGUI forgot the above settings and the CEGUI window gets adjusted in size with the render window.
Any solutions to this or do I have to change somthing in the properties?
Thanks,
Ben
- lindquist
- CEGUI Team (Retired)
- Posts: 770
- Joined: Mon Jan 24, 2005 21:20
- Location: Copenhagen, Denmark
Re: Resizing SDL Ogre window without resizing CEGUI elements
The window changes size and not just the imagery used to render it?
Re: Resizing SDL Ogre window without resizing CEGUI elements
Well, I have buttons in the app and just added one to the child window. They don't get resized so it should not be the images.
As I said, everything is fine until I move the window. My sugestion is that the absolute position of the window gets changed and then it does not observe the min and max size hints?
As I said, everything is fine until I move the window. My sugestion is that the absolute position of the window gets changed and then it does not observe the min and max size hints?
Re: Resizing SDL Ogre window without resizing CEGUI elements
Ok, I found the problem and a solution to it.
If you look at the CEGUIWindow source, you will find different variables for the Min/Max size property and the internal Min/Max size variables (ie. Window::d_absMinSizeProperty; for the property but d_maxSize as the window internal variable)
So if you set the property value the internal window value does not get affected.
At each resize the Window::setWindowArea_impl function is called and there the size is restricted to the internal values.
So if you add the following to your code it will work:
m_pkWin = (CEGUI::Window*) CEGUI::WindowManager::getSingleton().getWindow(
(CEGUI::utf8*) "TransformWindow" );
int nWidth = atoi(m_pkWin->getProperty("AbsoluteWidth" ).c_str());
int nHeight = atoi(m_pkWin->getProperty("AbsoluteHeight" ).c_str());
CEGUI::Size size(nWidth, nHeight);
m_pkWin->setMetricsMode(CEGUI::Absolute);
m_pkWin->setSize(size);
m_pkWin->setMinimumSize(size);
m_pkWin->setMaximumSize(size);
And your Window layout should look like:
<Window Type="RealTVLook/FrameWindow" Name="TransformWindow">
<Property Name="AbsolutePosition" Value="x:50.0 y:100.0" />
<Property Name="AbsoluteSize" Value="w:300.0 h:300.0" />
...
This ensures that if you resize your app window the CEGUI elements won't be resized.
To the CEGUI team: I haven't looked for the layout parsing routines but somehow the property "AbsoluteSize" has to affect the internal window values. Maybe you think of this in the next version (If I'm not wrong here and just doing something nasty)...
Cheers,
Ben
If you look at the CEGUIWindow source, you will find different variables for the Min/Max size property and the internal Min/Max size variables (ie. Window::d_absMinSizeProperty; for the property but d_maxSize as the window internal variable)
So if you set the property value the internal window value does not get affected.
At each resize the Window::setWindowArea_impl function is called and there the size is restricted to the internal values.
So if you add the following to your code it will work:
m_pkWin = (CEGUI::Window*) CEGUI::WindowManager::getSingleton().getWindow(
(CEGUI::utf8*) "TransformWindow" );
int nWidth = atoi(m_pkWin->getProperty("AbsoluteWidth" ).c_str());
int nHeight = atoi(m_pkWin->getProperty("AbsoluteHeight" ).c_str());
CEGUI::Size size(nWidth, nHeight);
m_pkWin->setMetricsMode(CEGUI::Absolute);
m_pkWin->setSize(size);
m_pkWin->setMinimumSize(size);
m_pkWin->setMaximumSize(size);
And your Window layout should look like:
<Window Type="RealTVLook/FrameWindow" Name="TransformWindow">
<Property Name="AbsolutePosition" Value="x:50.0 y:100.0" />
<Property Name="AbsoluteSize" Value="w:300.0 h:300.0" />
...
This ensures that if you resize your app window the CEGUI elements won't be resized.
To the CEGUI team: I haven't looked for the layout parsing routines but somehow the property "AbsoluteSize" has to affect the internal window values. Maybe you think of this in the next version (If I'm not wrong here and just doing something nasty)...
Cheers,
Ben
Re: Resizing SDL Ogre window without resizing CEGUI elements
I think it would be nice if the demos all used setDisplaySize().
That was one of the first things I noticed about CEGUI based on the demos -- that everthing looked horrible when the window was resized. It would be nice if at least one demo used setDisplaySize() with absolute sizing. Then first time users can see, ah ok it is possible to make my gui resize without everythign getting all blurry or distorted.
Is there an easy way to accomplish global absolute sizing? I mean without going and editing every single size property in the xml files.
That was one of the first things I noticed about CEGUI based on the demos -- that everthing looked horrible when the window was resized. It would be nice if at least one demo used setDisplaySize() with absolute sizing. Then first time users can see, ah ok it is possible to make my gui resize without everythign getting all blurry or distorted.
Is there an easy way to accomplish global absolute sizing? I mean without going and editing every single size property in the xml files.
-
- Just popping in
- Posts: 15
- Joined: Thu Nov 06, 2008 18:44
-
- Just popping in
- Posts: 11
- Joined: Sat Jul 18, 2009 23:43
Re: Resizing SDL Ogre window without resizing CEGUI elements
Hello guys,
I have the same problem as Ben811 in the first post, but all your advises didn't work for me.
Whenever the SDL/OpenGL window is scaled, the CEGUI elements are being scaled as well, whereas I want them to stay fixed in size.
I already did:
// init section:
Imageset *imageset = ImagesetManager::getSingleton().getImageset("TaharezLook");
imageset->setAutoScalingEnabled(false);
// sdl resize part:
case SDL_VIDEORESIZE:
screen = SDL_SetVideoMode(e.resize.w, e.resize.h, colorDepth, SDL_OPENGL|SDL_RESIZABLE);
ceguiRenderer->setDisplaySize(CEGUI::Size(e.resize.w, e.resize.h));
break;
But still the window is scaled
Is there anything that I'm missing?
Thanks in advance!
I have the same problem as Ben811 in the first post, but all your advises didn't work for me.
Whenever the SDL/OpenGL window is scaled, the CEGUI elements are being scaled as well, whereas I want them to stay fixed in size.
I already did:
// init section:
Imageset *imageset = ImagesetManager::getSingleton().getImageset("TaharezLook");
imageset->setAutoScalingEnabled(false);
// sdl resize part:
case SDL_VIDEORESIZE:
screen = SDL_SetVideoMode(e.resize.w, e.resize.h, colorDepth, SDL_OPENGL|SDL_RESIZABLE);
ceguiRenderer->setDisplaySize(CEGUI::Size(e.resize.w, e.resize.h));
break;
But still the window is scaled
Is there anything that I'm missing?
Thanks in advance!
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Resizing SDL Ogre window without resizing CEGUI elements
When the host viewport size changes and you notify this to CEGUI, there are two things at work which relate to 'resizing' of UI elements. The first concerns the resizing of the imagery elements that the CEGUI windows and widgets re made up of - this is what is controlled by the auto scaling setting. The second thing that happens is that CEGUI windows (and subsequently any attached child windows) may get resized according to the scale portion of their size - if you do not want this, just make sure your window sizes are all using only the 'offset' part of the size UDim dimensions; these act as absolute pixel sizes so do not change in response to the parent element (in this case the screen or host window) having changed size.
If you're uncertain about the unified dimension system employed by CEGUI, there are various posts on the forum, articles on the wiki and references in the docs that cover that subject.
CE.
If you're uncertain about the unified dimension system employed by CEGUI, there are various posts on the forum, articles on the wiki and references in the docs that cover that subject.
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
-
- Just popping in
- Posts: 11
- Joined: Sat Jul 18, 2009 23:43
Re: Resizing SDL Ogre window without resizing CEGUI elements
Thanks eddie, that was exactly the solution: Absolute positioning.
Ray McCooney
Ray McCooney
Return to “Modifications / Integrations / Customisations”
Who is online
Users browsing this forum: No registered users and 1 guest