[SOLVED]Using align in mygui problem

nevarim

20-08-2011 17:31:03

hi all

i have some problemson mygui layout:

this is on layouteditor


this is on game


p.s. image is stretched from a 4:3 monitor to a 16/9 monitor

here's layout file
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout" version="3.2.0">
<Widget type="ImageBox" skin="ImageBox" position="0 0 1280 1024" align="Default" layer="Back" name="LG_BG">
<Property key="Visible" value="true"/>
<Property key="Enabled" value="true"/>
<Property key="ImageTexture" value="backgroung_login.png"/>
<Property key="NeedMouse" value="true"/>
<Property key="NeedKey" value="true"/>
<Property key="InheritsAlpha" value="true"/>
<Widget type="EditBox" skin="EditBox" position="565 255 410 23" align="Stretch" name="LG_BG_UN_ED">
<Property key="Visible" value="true"/>
</Widget>
<Widget type="EditBox" skin="EditBox" position="565 330 410 23" align="Stretch" name="LG_BG_PW_ED">
<Property key="Visible" value="true"/>
</Widget>
<Widget type="Button" skin="CheckBox" position="720 405 25 25" align="Stretch" name="LG_BG_UN_CK">
<Property key="Visible" value="true"/>
</Widget>
</Widget>
</MyGUI>



here's code for to use it




MyGUI::OgrePlatform* mPlatform = new MyGUI::OgrePlatform();
mPlatform->initialise(mWindow, mSceneMgr); // mWindow is Ogre::RenderWindow*, mSceneManager is Ogre::SceneManager*
mGUI = new MyGUI::Gui();
mGUI->initialise();

const OIS::MouseState &mouseState = mMouse->getMouseState(); // mMouse is type of OIS::Mouse*
mouseState.width = 1024; // your rendering area width
mouseState.height = 768; // your rendering area height


MyGUI::LayoutManager::getInstance().loadLayout("login.layout");
MyGUI::StaticImagePtr window = mGUI->findWidget<MyGUI::ImageBox>("LG_BG");
window->setSize(vp->getActualWidth(),vp->getActualHeight());



where i made error for to see in correct mode editbox for username e password??
any idea?
thanks

Nevarim

nevarim

21-08-2011 15:27:40

any hint? :D

nevarim

22-08-2011 09:04:44

i resolved in a past release with align relative, but it seems tht this release hasn't this alignment option, is right?

thanks
Nevarim

nevarim

23-08-2011 13:48:10

:D i know thai i'm a bore but im crashing head for a trouble that i resolver month ago :(

nevarim

25-08-2011 09:04:56

in old version relative position is used well, in 3.2 there isn't a compatible usage?

thanks

Nevarim

nevarim

25-08-2011 21:52:57

any other hint?*crushing head on wall*

Neva

nevarim

31-08-2011 08:55:29

I apologize for the insistence but....


any news? :( :( :( :( :(

thanks

Neva

nevarim

01-09-2011 11:49:58

anyone can help me? at the moment i canno use other resolution than 1280 X 1024 that is resolution used in building layout :(


thanks

Neva

p.s. is need other details telle me that i give it

Altren

01-09-2011 18:56:55

Sorry for a slow reply.
You should not use Stretch. Use parent panel with centre align and place all child widgets on it - this will give you fixed ratio and widgets in centre. If you need them to be bigger on biggre resolutions, then create parent panel with all child widgets with stretch align, but parent with default align, and then resize and place it manually when your app starts.

nevarim

01-09-2011 21:29:31

Sorry for a slow reply.
You should not use Stretch. Use parent panel with centre align and place all child widgets on it - this will give you fixed ratio and widgets in centre. If you need them to be bigger on biggre resolutions, then create parent panel with all child widgets with stretch align, but parent with default align, and then resize and place it manually when your app starts.



for my layout parent panel is imagebox right?

<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout" version="3.2.0">
<Widget type="ImageBox" skin="ImageBox" position="0 0 1280 1024" align="Centre" layer="Back" name="LG_BG">
<Property key="Visible" value="true"/>
<Property key="Enabled" value="true"/>
<Property key="ImageTexture" value="backgroung_login.png"/>
<Property key="NeedMouse" value="true"/>
<Property key="NeedKey" value="true"/>
<Property key="InheritsAlpha" value="true"/>
<Widget type="EditBox" skin="EditBox" position="565 255 410 23" align="Stretch" name="LG_BG_UN_ED">
<Property key="Visible" value="true"/>
</Widget>
<Widget type="EditBox" skin="EditBox" position="565 330 410 23" align="Stretch" name="LG_BG_PW_ED">
<Property key="Visible" value="true"/>
</Widget>
<Widget type="Button" skin="CheckBox" position="720 405 25 25" align="Stretch" name="LG_BG_UN_CK">
<Property key="Visible" value="true"/>
</Widget>
</Widget>
</MyGUI>


so? (i haven't try it, i can try tomorrow evening)

Neva

p.s. sorry for my continuous reply but i haven't find solution and tried many method :(

nevarim

04-09-2011 13:05:26

solved, usong those function :D

int bc_gui_utilities::repositionleft(int x,Ogre::Viewport *tvp)
{
x=(x*tvp->getActualWidth())/1280;
return x;
}
int bc_gui_utilities::repositiontop(int y,Ogre::Viewport *tvp)
{
y=(y*tvp->getActualHeight())/1024;
return y;
}
int bc_gui_utilities::resizeleft(int x,Ogre::Viewport *tvp)
{
x=(x*tvp->getActualWidth())/1280;
return x;
}
int bc_gui_utilities::resizetop(int y,Ogre::Viewport *tvp)
{
y=(y*tvp->getActualHeight())/1024;
return y;
}