Page 1 of 1

Resize of MenuItems when changing the window size.

Posted: Sun Jan 04, 2009 20:37
by Nimos
Hi,

I am writing a game that uses SDL and OpenGL. I have encountered a problem when resizing (enlarging) the window. The menuitem background does not seem to resize for me although the items' text does. This causes the the last buttons to fall outside the menu and turn invisible. Also the visible ones have their text truncated.
Setting ClippedByParent to false helps me see them but they are still outside the menu background and every items' text is still truncated.

When resizing I use the method recommended in the tutorial about CEGUI with SDL and OpenGL:

case SDL_VIDEORESIZE:
renderer->grabTextures();
//your resize code here, including the SDL_SetVideoMode call
renderer->restoreTextures();
renderer->setDisplaySize(CEGUI::Size(e.resize.w, e.resize.h));
break;

Am I doing something wrong?

Regards
Nimos


Here is an excerpt of my XML-file:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>

<GUILayout >
    <Window Type="DefaultWindow" Name="Root" >
        <Property Name="InheritsAlpha" Value="False" />
        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
        <Window Type="TaharezLook/Menubar" Name="Root/FrameWindow/Menubar" >
                <Property Name="ItemSpacing" Value="10" />
                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                <Property Name="UnifiedAreaRect" Value="{{0.001,0},{0,0},{0.999,0},{0.05,0}}" />
                <Window Type="TaharezLook/MenuItem" Name="Root/FrameWindow/Menubar/Help" >
                    <Property Name="Text" Value="Help" />
                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                    <Property Name="UnifiedAreaRect" Value="{{0,74},{0,0},{0,100},{0,21}}" />
                    <Property Name="VerticalAlignment" Value="Centre" />
                    <Window Type="TaharezLook/PopupMenu" Name="Root/FrameWindow/Menubar/Help/AutoPopup" >
                        <Property Name="Visible" Value="False" />
                        <Property Name="FadeInTime" Value="0" />
                        <Property Name="FadeOutTime" Value="0" />
                        <Property Name="ItemSpacing" Value="2" />
                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                        <Property Name="ClippedByParent" Value="False" />
                        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{0,64},{0,72}}" />
                        <Property Name="AutoResizeEnabled" Value="True" />
                        <Window Type="TaharezLook/MenuItem" Name="Root/FrameWindow/Menubar/Help/Controls" >
                            <Property Name="Text" Value="Controls..." />
                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                            <Property Name="UnifiedAreaRect" Value="{{0,2},{0,2},{0,61},{0,23}}" />
                            <Property Name="ClippedByParent" Value="False" />
                        </Window>
                        <Window Type="TaharezLook/MenuItem" Name="Root/FrameWindow/Menubar/Help/About" >
                            <Property Name="Text" Value="About the game..." />
                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                            <Property Name="UnifiedAreaRect" Value="{{0,2},{0,25},{0,61},{0,46}}" />
                            <Property Name="ClippedByParent" Value="False" />
                        </Window>
                        <Window Type="TaharezLook/MenuItem" Name="Root/FrameWindow/Menubar/Help/Highscore" >
                            <Property Name="Text" Value="Show highscores..." />
                            <Property Name="Tooltip" Value="Shows the highscore lists." />
                            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                            <Property Name="UnifiedAreaRect" Value="{{0,2},{0,25},{0,61},{0,69}}" />
                            <Property Name="ClippedByParent" Value="False" />
                        </Window>
                    </Window>
                </Window>
            </Window>
   </Window>
</GUILayout>

Posted: Mon Jan 05, 2009 09:37
by CrazyEddie
Thanks for the report and the layout. We'll need to test this and get back to you, I think it's a potential bug or something, since what you're doing should be correct :)

CE.

Posted: Sat Jan 17, 2009 17:51
by Nimos
Although not very urgent, but perhaps a ticket should be created on this so it won't be forgotten?

Best Regards
Nimos

Posted: Sat Jan 17, 2009 20:47
by CrazyEddie
Hi,

I have added a ticket, thanks for the reminder :P

CE.