Resize the Mygui widgets and its positions

Blender2Ogre

19-07-2012 03:32:29

hi everyone,
i ve been trying to implement a switch window resolution for a game project however , when i resize the ogre render window the Mygui items remain the same size and at the same position, is there any way that i can resized all the mygui items acording to the ogre render window size?
any help here is greatly appreciated!
Romulo Romero

IcetheCold7

19-07-2012 19:56:35

Hey Blender2Ogre,

I did a little googling, and a little playing with the code, and the best I can do, is have the Top Left starting positions of the widgets stay the same, while the widget resizes from the bottom right.

What I did, was made the UI all parented to an empty image

This is slightly modified code that I found somewhere on this forum by another user(i tried to find it...but it won't come up in a search :S )
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout" version="3.2.0">
<Widget type="ImageBox" skin="ImageBox" position="0 0 800 480" align="Centre" layer="Back" name="MainWin">
<Property key="Visible" value="true"/>
<Property key="Enabled" value="true"/>
<Property key="NeedMouse" value="true"/>
<Property key="NeedKey" value="true"/>
<Property key="InheritsAlpha" value="true"/>
<Widget type="EditBox" skin="EditBox" position="200 100 200 30" align="Stretch" name="LG_BG_UN_ED">
<Property key="Visible" value="true"/>
</Widget>
<Widget type="EditBox" skin="EditBox" position="200 140 200 30" align="Stretch" name="LG_BG_PW_ED">
<Property key="Visible" value="true"/>
</Widget>
<Widget type="Button" skin="CheckBox" position="520 405 25 25" align="Stretch" name="LG_BG_UN_CK">
<Property key="Visible" value="true"/>
</Widget>
</Widget>
</MyGUI>


Then, I loaded the layout, and made the Viewport a pointer in the class it belonged to, so that it could be accessed, and used this code from the same spot:
MyGUI::LayoutManager::getInstance().loadLayout("game.layout");
window = mGUI->findWidget<MyGUI::ImageBox>("MainWin");
window->setSize(vp->getActualWidth(),vp->getActualHeight());


Then I created a flag variable to see if the window had been resized, and used this code:
if(mResizeGUI)
{
window->setSize(vp->getActualWidth(),vp->getActualHeight());
}


However, like I said, all the widgets' positions remain stationary and just grow from the bottom right corner

Hope this helps,
-Ice

Blender2Ogre

19-07-2012 21:37:53

Hi dude,
thx for replying...ive been trying to use ur solution but i cant get it to work..
i got the code here ,can u modify it to get it to work?
any help is greatly appreciated dude..
heres the code:
main.cpp ->

#include <iostream>
#include "main.h"


ProperOgreApp::ProperOgreApp()
:mRoot(0),
cam(0),
sceneMgr(0),
mWindow(0),
mResourcesCfg(Ogre::StringUtil::BLANK),
mPluginsCfg(Ogre::StringUtil::BLANK),
mInputMgr(0),
mMouse(0),
mKeyboard(0),
mShouldChangeRS(false),
mNextRS(RSC_NONE)
{
}
ProperOgreApp::~ProperOgreApp()
{

}
bool ProperOgreApp::initOgre(bool shouldChangeRS = false, Ogre::String rsName = "")
{
if (shouldChangeRS && rsName.length() == NULL)
std::cout << "WHAT THE HECK ARE YOU DOING ? \n";
mRoot = OGRE_NEW Ogre::Root("plugins_d.cfg");
if (!shouldChangeRS && rsName.length() == NULL)
{
//bool shouldContinue = mRoot->showConfigDialog() || mRoot->restoreConfig();
bool shouldContinue = mRoot->showConfigDialog();
if (!shouldContinue)
{
exit(0);

}else

mRoot->initialise(false);
mWindow = mRoot->createRenderWindow("Main Wnd", 1024, 768, false);
}
else if (shouldChangeRS && rsName.length() != NULL)
{
// Restores configuration from saved state
// Returns true if a valid saved configuration is
// available, and false if no saved config is
// stored, or if there has been a problem
Ogre::ConfigFile cfg;
try
{
// Don't trim whitespace
cfg.load("ogre.cfg", "\t:=", false);
}
catch (Ogre::Exception& e)
{
if (e.getNumber() == Ogre::Exception::ERR_FILE_NOT_FOUND)
{
return false;
}
else
{
throw;
}
}
Ogre::ConfigFile::SectionIterator iSection = cfg.getSectionIterator();
Ogre::RenderSystem* rs = mRoot->getRenderSystemByName(rsName);
while (iSection.hasMoreElements())
{
const Ogre::String& renderSystem = iSection.peekNextKey();
const Ogre::ConfigFile::SettingsMultiMap& settings = *iSection.getNext();
if (!rs)
{
// Unrecognised render system
continue;
}
Ogre::ConfigFile::SettingsMultiMap::const_iterator i;
for (i = settings.begin(); i != settings.end(); ++i)
{

mRoot->setRenderSystem(rs);

}
}
if (!rs)
{
// Unrecognised render system
return false;
}
Ogre::String err = rs->validateConfigOptions();
if (err.length() > 0)
return false;
mRoot->setRenderSystem(rs);
mRoot->initialise(false);
mWindow = mRoot->createRenderWindow("Main Wnd", 1024, 768, false);
}

Ogre::String rs = mRoot->getRenderSystem()->getName();

if (rs == "OpenGL Rendering Subsystem")
mChosenRender = RSC_GL;
else
mChosenRender = RSC_DX;

Ogre::LogManager::getSingleton().getDefaultLog()->logMessage("Current Render System: " + mRoot->getRenderSystem()->getName());
return true;
}
void ProperOgreApp::initInput()
{
OIS::ParamList pl;
size_t windowHnd = 0;
std::ostringstream windowHndStr;
mWindow->getCustomAttribute("WINDOW", &windowHnd);
windowHndStr << windowHnd;
pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
mInputMgr = OIS::InputManager::createInputSystem(pl);
mKeyboard = static_cast<OIS::Keyboard*>(mInputMgr->createInputObject(OIS::OISKeyboard, false));
mMouse = static_cast<OIS::Mouse*>(mInputMgr->createInputObject( OIS::OISMouse, true ));
mMouse->setEventCallback(this);
mKeyboard->setEventCallback(this);
}
void ProperOgreApp::createScene()
{
sceneMgr = mRoot->createSceneManager(Ogre::ST_GENERIC, "Mgr");
cam = sceneMgr->createCamera("main Cam");
vp = mWindow->addViewport(cam);
cam->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));
cam->setPosition(0, 0, 300);
cam->lookAt(0, 0, -300);
// Load resources
// Load resource paths from config file
Ogre::ConfigFile cf;
cf.load("resources_d.cfg");
// Go through all sections & settings in the file
Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
Ogre::String secName, typeName, archName;
while (seci.hasMoreElements())
{
secName = seci.peekNextKey();
Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
Ogre::ConfigFile::SettingsMultiMap::iterator i;
for (i = settings->begin(); i != settings->end(); ++i)
{
typeName = i->first;
archName = i->second;
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
archName, typeName, secName);
}
}

Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
mPlatform = new MyGUI::OgrePlatform();
mPlatform->initialise(mWindow,sceneMgr);
mGUI = new MyGUI::Gui();
mGUI->initialise("MyGUI_Core.xml");
windowResized(mWindow);
MyGUI::ImageBox* Winmain = mGUI->createWidget<MyGUI::ImageBox>("",0, 0, 1024, 768, MyGUI::Align::Default, "Overlapped","GraphWindow");
MyGUI::ButtonPtr button = Winmain->createWidget<MyGUI::Button>("Button", 10, 10, 120, 26, MyGUI::Align::Stretch, "Main");
button->setCaption("Exit Game");
button->eventMouseButtonClick += MyGUI::newDelegate(this,&ProperOgreApp::quit);
MyGUI::WindowPtr window = Winmain->createWidget<MyGUI::Window>("WindowCSX", 300, 0, 390, 300, MyGUI::Align::Stretch, "Overlapped");
window->setCaption("3D Graphics Settings");
window->setMovable(false);
/*window->setSize(390,400);*/
window->setMaxSize(390,400);
window->setMinSize(390,400);
MyGUI::ComboBoxPtr combo = window->createWidget<MyGUI::ComboBox>("ComboBox",135,80,100,25, MyGUI::Align::Bottom, "Overlapped");
combo->setCaption("Resolution");
combo->addItem("640x480");
combo->addItem("800x600");
combo->addItem("1024x768");
combo->addItem("1280x600");
combo->addItem("1280x720");
combo->addItem("1280x760");
combo->addItem("1360x768");
combo->addItem("1366x768");
combo->setIndexSelected(2);
combo->setComboModeDrop(true);
combo->eventComboAccept += MyGUI::newDelegate(this, &ProperOgreApp::Resolution);

window->eventWindowButtonPressed += MyGUI::newDelegate(this, &ProperOgreApp::notifyWindowPressedMyGUI);
MyGUI::ButtonPtr Radio = window->createWidget<MyGUI::Button>("RadioButton" , 45, 25, 20, 20, MyGUI::Align::Stretch, "SharedLayer");
Radio->eventMouseButtonClick += MyGUI::newDelegate(this, &ProperOgreApp::DirectX);


MyGUI::TextBox* text = window->createWidget<MyGUI::TextBox>("TextBox", 30, 05, 70, 15, MyGUI::Align::Default, "Main");
text->setCaption("#ffffffDirectX");
text->setTextShadow(true);
MyGUI::ButtonPtr Radio2 = window->createWidget<MyGUI::Button>("RadioButton" , 310, 25, 20, 20, MyGUI::Align::Default, "SharedLayer");
Radio2->eventMouseButtonClick += MyGUI::newDelegate(this, &ProperOgreApp::OpenGL);

if (mChosenRender == RSC_DX)
Radio->setStateSelected(true);
else
Radio2->setStateSelected(true);
MyGUI::TextBox* text2 = window->createWidget<MyGUI::TextBox>("TextBox", 295, 05, 70, 15, MyGUI::Align::Default, "Main");
text2->setCaption("#ffffffOpenGL");
text2->setTextShadow(true);
MyGUI::ButtonPtr Radio3 = window->createWidget<MyGUI::Button>("RadioButton" , 310, 135, 20, 20, MyGUI::Align::Default, "SharedLayer");
Radio3->eventMouseButtonClick += MyGUI::newDelegate(this, &ProperOgreApp::FullScreen);
MyGUI::TextBox* text3 = window->createWidget<MyGUI::TextBox>("TextBox", 285, 115, 200, 15, MyGUI::Align::Default, "Main");
text3->setCaption("#ffffffFull Screen");
text3->setTextShadow(true);
MyGUI::ButtonPtr Radio4 = window->createWidget<MyGUI::Button>("RadioButton" , 45, 135, 20, 20, MyGUI::Align::Default, "SharedLayer");
Radio4->eventMouseButtonClick += MyGUI::newDelegate(this, &ProperOgreApp::WindowedMode);
MyGUI::TextBox* text4 = window->createWidget<MyGUI::TextBox>("TextBox", 05, 115, 200, 15, MyGUI::Align::Default, "Main");
text4->setCaption("#ffffffWindowed Mode");
text4->setTextShadow(true);
if (Radio4 || !Radio3)
{
Radio4->setStateSelected(true);


/*MyGUI::ResizingPolicy::Fill;*/
}else if (Radio3 || !Radio4)
{
Radio3->setStateSelected(true);
}
/*else
{
Radio4->setStateSelected(false);
Radio3->setStateSelected(true);


}*/

MyGUI::PopupMenu* w = Winmain->createWidget<MyGUI::PopupMenu>("PopupMenu", 800, 0, 300, 143, MyGUI::Align::Stretch, "Main");
w->addItem("#ffffffExpandable Item >", MyGUI::MenuItemType::Popup);
MyGUI::MenuCtrl* child = w->createItemChildAt(0);
child->addItem("Common Item");
child->addItem("Expandable Item", MyGUI::MenuItemType::Popup);
MyGUI::MenuCtrl* child2 = child->createItemChildAt(1);
child2->addItem("Common Item");




// Create scene
Ogre::SceneNode* node = sceneMgr->getRootSceneNode()->createChildSceneNode("headNode");
Ogre::Entity* ent = sceneMgr->createEntity("headEntity", "ogrehead.mesh");
node->attachObject(ent);
sceneMgr->setAmbientLight(Ogre::ColourValue(1, 1, 1));
sceneMgr->setSkyDome(true, "Examples/CloudySky", 5, 8);
}
void ProperOgreApp::onUpdate()
{
mMouse->capture();
mKeyboard->capture();
if (mKeyboard->isKeyDown(OIS::KC_F1))
{
destroy();
initOgre(true, "OpenGL Rendering Subsystem");
initInput();
createScene();
}
else if (mKeyboard->isKeyDown(OIS::KC_F2))
{
destroy();
initOgre(true, "Direct3D9 Rendering Subsystem");
initInput();
createScene();
}

if (mShouldChangeRS && mNextRS != RSC_NONE)
{
destroy();
if (mNextRS == RSC_GL)
initOgre(true, "OpenGL Rendering Subsystem");
else
initOgre(true, "Direct3D9 Rendering Subsystem");
initInput();
createScene();


mShouldChangeRS = false;
mNextRS = RSC_NONE;
}

}
void ProperOgreApp::windowResized(Ogre::RenderWindow* rw)
{
unsigned int width, height, depth;
int left, top;
rw->getMetrics(width, height, depth, left, top);
const OIS::MouseState &ms = mMouse->getMouseState();
ms.width = width;
ms.height = height;
}
bool ProperOgreApp::keyPressed(const OIS::KeyEvent& arg)
{
MyGUI::InputManager::getInstance().injectKeyPress(MyGUI::KeyCode::Enum(arg.key), arg.text);
return true;
}
bool ProperOgreApp::keyReleased(const OIS::KeyEvent& arg)
{
MyGUI::InputManager::getInstance().injectKeyRelease(MyGUI::KeyCode::Enum(arg.key));
return true;
}
bool ProperOgreApp::mouseMoved(const OIS::MouseEvent& arg)
{
MyGUI::InputManager::getInstance().injectMouseMove(arg.state.X.abs, arg.state.Y.abs, arg.state.Z.abs);
return true;
}
bool ProperOgreApp::mousePressed(const OIS::MouseEvent& arg, OIS::MouseButtonID id)
{
MyGUI::InputManager::getInstance().injectMousePress(arg.state.X.abs, arg.state.Y.abs, MyGUI::MouseButton::Enum(id));
return true;
}
bool ProperOgreApp::mouseReleased(const OIS::MouseEvent& arg, OIS::MouseButtonID id)
{
MyGUI::InputManager::getInstance().injectMouseRelease(arg.state.X.abs, arg.state.Y.abs, MyGUI::MouseButton::Enum(id));
return true;
}
void ProperOgreApp::quit(MyGUI::WidgetPtr button)
{
if(button)
exit(0);
}
void ProperOgreApp::OpenGL(MyGUI::WidgetPtr buttonGL)
{
mShouldChangeRS = true;
mNextRS = RSC_GL;


}
void ProperOgreApp::DirectX(MyGUI::WidgetPtr buttonDX)
{
mShouldChangeRS = true;
mNextRS = RSC_DX;
}
void ProperOgreApp::WindowedMode(MyGUI::WidgetPtr window)
{
/*int width, height;
width = vp->getActualWidth();
height= vp->getActualHeight();
mWindow->setFullscreen(true, width, height);*/
if(mWindow->getWidth() == 640 && mWindow->getHeight() == 480)
{
mWindow->setFullscreen(false,640,480);
}
else if(mWindow->getWidth() == 800 && mWindow->getHeight() == 600)
{
mWindow->setFullscreen(false,800,600);
}
else if(mWindow->getWidth() == 1024 && mWindow->getHeight() == 768)
{
mWindow->setFullscreen(false,1024,768);
}
else if(mWindow->getWidth() == 1280 && mWindow->getHeight() == 600)
{
mWindow->setFullscreen(false,1280,600);
}
else if(mWindow->getWidth() == 1280 && mWindow->getHeight() == 720)
{
mWindow->setFullscreen(false,1280,720);
}
else if(mWindow->getWidth() == 1280 && mWindow->getHeight() == 760)
{
mWindow->setFullscreen(false,1280,760);
}
else if(mWindow->getWidth() == 1360 && mWindow->getHeight() == 768)
{
mWindow->setFullscreen(false,1360,768);
}
else if(mWindow->getWidth() == 1366 && mWindow->getHeight() == 768)
{
mWindow->setFullscreen(false,1366,768);
}

}

void ProperOgreApp::FullScreen(MyGUI::WidgetPtr fullscreen)
{
//int width, height;
//width = vp->getActualWidth();
//height= vp->getActualHeight();
//
//mWindow->setFullscreen(true, width, height);


if(mWindow->getWidth() == 640 && mWindow->getHeight() == 480)
{
mWindow->setFullscreen(true,640,480);
}
else if(mWindow->getWidth() == 800 && mWindow->getHeight() == 600)
{
mWindow->setFullscreen(true,800,600);
}
else if(mWindow->getWidth() == 1024 && mWindow->getHeight() == 768)
{
mWindow->setFullscreen(true,1024,768);
}
else if(mWindow->getWidth() == 1280 && mWindow->getHeight() == 600)
{
mWindow->setFullscreen(true,1280,600);
}
else if(mWindow->getWidth() == 1280 && mWindow->getHeight() == 720)
{
mWindow->setFullscreen(true,1280,720);
}
else if(mWindow->getWidth() == 1280 && mWindow->getHeight() == 760)
{
mWindow->setFullscreen(true,1280,760);
}
else if(mWindow->getWidth() == 1360 && mWindow->getHeight() == 768)
{
mWindow->setFullscreen(true,1360,768);
}
else if(mWindow->getWidth() == 1366 && mWindow->getHeight() == 768)
{
mWindow->setFullscreen(true,1366,768);
}
}
void ProperOgreApp::Resolution(MyGUI::ComboBox* buttonRes, size_t index)
{
if (index == 0 && !mWindow->isFullScreen())
{

mWindow->setFullscreen(false, 640, 480);
window = mGUI->findWidget<MyGUI::ImageBox>("GraphWindow");
window->setSize(vp->getActualWidth(),vp->getActualHeight());

/* MyGUI::WindowPtr window = mGUI->findWidget<MyGUI::Window>("GraphWindow");
window->getActionScale();*/
/*mGUI->_resizeWindow();*/
/*mWindow->setFullscreen(false,640,480);
mWindow->update();
buttonRes->setAlign(MyGUI::Align::Center);*/

}
else if (index == 1 && !mWindow->isFullScreen())
{
mWindow->setFullscreen(false,800,600);


}
else if (index == 2 && !mWindow->isFullScreen())
{
mWindow->setFullscreen(false,1024,768);

}
else if (index == 3 && !mWindow->isFullScreen())
{
mWindow->setFullscreen(false,1280,600);
}
else if (index == 4 && !mWindow->isFullScreen())
{
mWindow->setFullscreen(false,1280,720);
}
else if (index == 5 && !mWindow->isFullScreen())
{
mWindow->setFullscreen(false,1280,760);
}
else if (index == 6 && !mWindow->isFullScreen())
{
mWindow->setFullscreen(false,1360,768);
}
else if (index == 7 && !mWindow->isFullScreen())
{
mWindow->setFullscreen(false,1366,768);
}
else if (index == 0 && mWindow->isFullScreen())
{

mWindow->setFullscreen(true, 640, 480);
/*mWindow->setFullscreen(false,640,480);
mWindow->update();
buttonRes->setAlign(MyGUI::Align::Center);*/

}
else if (index == 1 && mWindow->isFullScreen())
{
mWindow->setFullscreen(true,800,600);


}
else if (index == 2 && mWindow->isFullScreen())
{
mWindow->setFullscreen(true,1024,768);

}
else if (index == 3 && mWindow->isFullScreen())
{
mWindow->setFullscreen(true,1280,600);
}
else if (index == 4 && mWindow->isFullScreen())
{
mWindow->setFullscreen(true,1280,720);
}
else if (index == 5 && mWindow->isFullScreen())
{
mWindow->setFullscreen(true,1280,760);
}
else if (index == 6 && mWindow->isFullScreen())
{
mWindow->setFullscreen(true,1360,768);
}
else if (index == 7 && mWindow->isFullScreen())
{
mWindow->setFullscreen(true,1366,768);
}
}
void ProperOgreApp::notifyWindowPressedMyGUI(MyGUI::WindowPtr _widget, const std::string& _name)
{
MyGUI::WindowPtr window = _widget->castType<MyGUI::Window>();
if (_name == "close") window->destroySmooth();
else if (_name == "minimized") {
// hide window and show button in your taskbar
}
else if (_name == "maximized") {
// maximized window
}

}
bool ProperOgreApp::render()
{
while(true)
{
// Pump window messages for nice behaviour
Ogre::WindowEventUtilities::messagePump();
onUpdate();
if(mWindow->isClosed())
{
return false;
}
// Render a frame
if(!mRoot->renderOneFrame()) return false;
}
}
void ProperOgreApp::destroy()
{
mInputMgr->destroyInputObject( mMouse );
mInputMgr->destroyInputObject( mKeyboard );
OIS::InputManager::destroyInputSystem(mInputMgr);
mInputMgr = 0;
mGUI->shutdown();
delete mGUI;
mGUI = 0;
mPlatform->shutdown();
delete mPlatform;
mPlatform = 0;
mWindow->destroy();
mWindow = 0;
delete mRoot;


}



int main()
{
ProperOgreApp* app = new ProperOgreApp;
app->initOgre();
app->initInput();
app->createScene();




while(app->render());
app->destroy();

delete app;
return 0;
}


main.h ->
#ifndef MAIN_H
#define MAIN_H
#include <Ogre.h>
#include <OIS.h>
#include "MyGUI.h"
#include "MyGUI_OgrePlatform.h"

enum RenderSystemChoice
{
RSC_GL,
RSC_DX,
RSC_NONE
};

class ProperOgreApp : public OIS::KeyListener, public OIS::MouseListener
{
public:
ProperOgreApp();
~ProperOgreApp();

bool initOgre(bool shouldChangeRS, Ogre::String rsName);
void initInput();
void createScene();
void onUpdate();
void windowResized(Ogre::RenderWindow* rw);
bool keyPressed(const OIS::KeyEvent& arg);
bool keyReleased(const OIS::KeyEvent& arg);
bool mouseMoved(const OIS::MouseEvent& arg);
bool mousePressed(const OIS::MouseEvent& arg, OIS::MouseButtonID id);
bool mouseReleased(const OIS::MouseEvent& arg, OIS::MouseButtonID id);
void quit(MyGUI::WidgetPtr button);
void OpenGL(MyGUI::WidgetPtr buttonGL);
void DirectX(MyGUI::WidgetPtr buttonDX);
void WindowedMode(MyGUI::WidgetPtr Windowed);
void FullScreen(MyGUI::WidgetPtr Fullscreen);
void Resolution(MyGUI::ComboBox* buttonRes, size_t index);
void notifyWindowPressedMyGUI(MyGUI::WindowPtr _widget, const std::string& _name);
bool render();
void destroy();
private:
Ogre::Root* mRoot;
Ogre::RenderWindow* mWindow;
Ogre::SceneManager* sceneMgr;
Ogre::Camera* cam;
Ogre::String mResourcesCfg;
Ogre::String mPluginsCfg;
OIS::Keyboard* mKeyboard;
OIS::Mouse* mMouse;
OIS::InputManager* mInputMgr;
MyGUI::Gui* mGUI;
MyGUI::OgrePlatform* mPlatform;
bool mShouldChangeRS;
RenderSystemChoice mNextRS;
RenderSystemChoice mChosenRender;
/*int mFrameCount;*/
MyGUI::RenderManager* mrm;
Ogre::SceneNode* node;
Ogre::Viewport* vp;
MyGUI::ImageBox* window;


/*char name[16];
Ogre::Entity* ent;*/

};
#endif


thx in advance,
Romulo Romero

IcetheCold7

19-07-2012 23:16:19

Romulo,

I've been looking this over for a bit, and plugged in the code where I figured it would fit, and I can't make it work either.

I've tried my layout file also, inplace of your mygui set, and it still didn't work, there must be something else.

I might keep plugging away, but I just don't think my minimal experience is going to do it.

-Ice

Blender2Ogre

20-07-2012 03:18:16

yeah i know, ive been trying to do it manually by changing the size and position from each resolution which kind og sucks so much...it must have a better way of like..automatically resize all widgets but unfortunately this forums doesnt seem to work too well..but dude i appreaciate your efforts..i look forward for any reply!
kind regards,
Romulo Romero

IcetheCold7

20-07-2012 18:06:44

Well, if you were going to go through the effort anyway, you could do a percentage based system.

Set variables that will hold the current resolution, and then set the position of everything based off that, so:

that exit button, that would be set at like .1 (or 10% of the length of the screen)
then that window you had in the middle, might start at about 40%(.4) and so on, so then it would just look like:

void MyGUI::Window::setPosition ( int _left, int _top )

button->setPosition( (0.1 * vp->getActualWidth() ), (0.05 * vp->getActualHeight() ) )

and so on for all the things you want to reposition, and the same I would assume would work out for resizing too.

Hope you find something that works for you soon, I hate getting hung up on programming projects :P
-Ice

Blender2Ogre

20-07-2012 22:04:50

hi IceTheCold7,
first of all thanks for your attention to my thread and for the solutions provided, and well what i am doing looks similar to that..which sucks i wish Mygui could do the job itself but as you can see no moderators replies so far not even from the developers ...but thanks again for your solutions i will try that out and see how it works out :D
and bout the hanging up well..i dont give up so easily hahaha, but i oftenly feel like that but i pull out the strength from somewhere else haha..keep replying dude as you may find other ways of doing it!
All the best,
Romulo Romero