mprestia
12-05-2010 22:09:45
Hello,
I am using the Layout Manager to create layouts for my game and noticed an interesting bug. As an example, I will use the following layout:
When I save this layout and reload it, everything works fine. However, if I change the layout to relative coordinates within the Layout Manager, I get the following result:
When I save this layout and reload it, the button in the window is moved and resized.
I did some digging and discovered that when the Layout Manager is converting the button coord (50 50 50 50) to relative coordinates, the view size used for conversion is the size of the client widget of the window instead of the size of the actual window. When I reload the layout, the relative coordinates are converted to pixel coordinates using the size of the window instead of the window's client widget, distorting the button position and size, giving the resulting button coord of (52 61 52 61).
Has anyone else found this problem? If so, have you found a fix?
I am going to continue digging and will post updates if I make any progress.
I am using the Layout Manager to create layouts for my game and noticed an interesting bug. As an example, I will use the following layout:
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout">
<Widget type="Window" skin="WindowCS" position="100 100 200 200" layer="Back" name="window">
<Widget type="Button" skin="Button" position="50 50 50 50"/>
</Widget>
</MyGUI>
When I save this layout and reload it, everything works fine. However, if I change the layout to relative coordinates within the Layout Manager, I get the following result:
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout">
<Widget type="Window" skin="WindowCS" position_real="0.0976563 0.130208 0.195313 0.260417" layer="Back" name="window">
<Widget type="Button" skin="Button" position_real="0.263158 0.306748 0.263158 0.306748"/>
</Widget>
</MyGUI>
When I save this layout and reload it, the button in the window is moved and resized.
I did some digging and discovered that when the Layout Manager is converting the button coord (50 50 50 50) to relative coordinates, the view size used for conversion is the size of the client widget of the window instead of the size of the actual window. When I reload the layout, the relative coordinates are converted to pixel coordinates using the size of the window instead of the window's client widget, distorting the button position and size, giving the resulting button coord of (52 61 52 61).
Has anyone else found this problem? If so, have you found a fix?
I am going to continue digging and will post updates if I make any progress.