Kulik wrote:MorbidAngel is right, this should be done with the scale component.
Also, there is no such thing as pixel size scale.
Hey,
I know this should be done with the scale component, but the thing is that the guy who made all the layouts made in this way and should be great to not remake all, basically, what I want is that if I reduce the screen resoulotion then all elements should decrease as much.
If it's possible to make it like this, I appreciate the help.
Idea is something like this (test for x position), I try change position depending on resolutions, any help is welcome to get the result I'm looking for.
Code: Select all
namespace
{
const float defaultSize = 1024;
std::unordered_map<CEGUI::Window*, CEGUI::UVector2> winSettings;
}
/**
* Window event for resizing window.
* @param Screen width in pixels.
* @param Screen height in pixels.
*/
void Core::windowResized(int width, int height)
{
// notify CEGUI.
float diff = (width - defaultSize);
auto iter = CEGUI::WindowManager::getSingleton().getIterator();
while(!iter.isAtEnd()) {
CEGUI::Window *window = iter.getCurrentValue();
if( window != mSheet ) {
auto it = winSettings.find(window);
if( it == std::end(winSettings) ) {
winSettings[window] = window->getPosition();
}
window->setPosition(winSettings[window] + CEGUI::UVector2(CEGUI::UDim(0, diff), CEGUI::UDim(0,0)));
}
iter++;
}
//notifyDisplay
CEGUI::System::getSingleton().notifyDisplaySizeChanged(CEGUI::Size(width, height));
}