Dynamic GUI size
Posted: 2012-03-07, 18:43
Hi @ll,
i was trying to make my GUI set its Size dynamically by using the Console variables
i was trying to make my GUI set its Size dynamically by using the Console variables
dlg_clWindowSizex
and dlg_clWindowSizeY
but I got the following Problems:
- constant screen size in
GuiSys/Gui.hpp
:and when I try to make it static and set it in the Gui C'tor, I get unused-variable warnings. Could this be easily rewritten to set the real size instad of using constants?Code: Select all
const float VIRTUAL_SCREEN_SIZE_X=1024.0f; const float VIRTUAL_SCREEN_SIZE_Y=768.0f;
- Is it really the best way to get the Window Size from the Console variables or is there a better way? Maybe the wxWindow knows hob big it is currently... maybe we can build a
WindowT:OnScreenSizeChange()
Method where the GUI elements with dynamic size may be redrawn. I already managed dynamic GUI sizing and positioning by using the console varibles from the cgui scripts... here my little helper method:and it can be simply used e.g. like this:Code: Select all
function GetGuiSize() return ci.GetValue("dlg_clWindowSizeX"), ci.SetValue("dlg_clWindowSizeY"); end
self:set("rect", 0, 0, GetGuiSize());
and this works perfectly!