[Orxonox-commit 3270] r7961 - in code/branches/kicklib: data/gui/scripts src/libraries/core

rgrieder at orxonox.net rgrieder at orxonox.net
Fri Feb 25 05:02:13 CET 2011


Author: rgrieder
Date: 2011-02-25 05:02:13 +0100 (Fri, 25 Feb 2011)
New Revision: 7961

Modified:
   code/branches/kicklib/data/gui/scripts/GUITools.lua
   code/branches/kicklib/data/gui/scripts/InitialiseGUI.lua
   code/branches/kicklib/data/gui/scripts/NotificationLayer.lua
   code/branches/kicklib/src/libraries/core/GUIManager.cc
Log:
Restored compatibility of our Lua code with CEGUI:
Some functions were renamed. I've done so too and added an alias at initialisation for older versions.
Caution: Credits and Quest menu don't yet work because CEGUI 0.7 has less Font functionality.

Modified: code/branches/kicklib/data/gui/scripts/GUITools.lua
===================================================================
--- code/branches/kicklib/data/gui/scripts/GUITools.lua	2011-02-25 02:07:17 UTC (rev 7960)
+++ code/branches/kicklib/data/gui/scripts/GUITools.lua	2011-02-25 04:02:13 UTC (rev 7961)
@@ -30,8 +30,8 @@
     local size = {}
 
     local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(window:getLookNFeel())
-    local height = window:getFont():getLineSpacing() + window:getUnclippedPixelRect():getHeight() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getHeight()
-    local width =  window:getFont():getTextExtent(window:getText()) + window:getUnclippedPixelRect():getWidth() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getWidth()
+    local height = window:getFont():getLineSpacing() + window:getUnclippedOuterRect():getHeight() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getHeight()
+    local width =  window:getFont():getTextExtent(window:getText()) + window:getUnclippedOuterRect():getWidth() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getWidth()
 
     table.insert(size, height)
     table.insert(size, width)
@@ -39,8 +39,8 @@
 end
 
 function getScrollingStepSize(window)
-    local height = window:getUnclippedPixelRect():getHeight()
-    local maxHeight = CEGUI.System:getSingleton():getGUISheet():getUnclippedPixelRect():getHeight()
+    local height = window:getUnclippedOuterRect():getHeight()
+    local maxHeight = CEGUI.System:getSingleton():getGUISheet():getUnclippedOuterRect():getHeight()
     local ratio = height/maxHeight
     return 0.008*ratio/0.3204
 end
@@ -48,7 +48,7 @@
 function getStaticTextWindowHeight(window)
     local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(window:getLookNFeel())
     local formattedArea = lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window)
-    local frameHeight = window:getUnclippedPixelRect():getHeight() - formattedArea:getHeight()
+    local frameHeight = window:getUnclippedOuterRect():getHeight() - formattedArea:getHeight()
     local lines = window:getFont():getFormattedLineCount(window:getText(), formattedArea, CEGUI.WordWrapLeftAligned)
     local height = lines * window:getFont():getLineSpacing() + frameHeight
     return height

Modified: code/branches/kicklib/data/gui/scripts/InitialiseGUI.lua
===================================================================
--- code/branches/kicklib/data/gui/scripts/InitialiseGUI.lua	2011-02-25 02:07:17 UTC (rev 7960)
+++ code/branches/kicklib/data/gui/scripts/InitialiseGUI.lua	2011-02-25 04:02:13 UTC (rev 7961)
@@ -6,27 +6,27 @@
 
 local scheme = orxonox.CommandExecutor:query("getConfig GUIManager guiScheme_")
 -- Load all required skins
---schemeMgr:loadScheme("TaharezGreenLook.scheme")
-schemeMgr:loadScheme(scheme .. "Look.scheme")
---schemeMgr:loadScheme("TaharezLook.scheme")
---schemeMgr:loadScheme("WindowsLook.scheme")
---schemeMgr:loadScheme("VanillaLook.scheme")
---schemeMgr:loadScheme("SleekSpaceLook.scheme")
+--schemeMgr:create("TaharezGreenLook.scheme")
+schemeMgr:create(scheme .. "Look.scheme")
+--schemeMgr:create("TaharezLook.scheme")
+--schemeMgr:create("WindowsLook.scheme")
+--schemeMgr:create("VanillaLook.scheme")
+--schemeMgr:create("SleekSpaceLook.scheme")
 
 -- Connect skin specific window types with our own window types
 -- By loading a different file (if there is) you can change the skin
 -- of the menus or the HUD independently
---schemeMgr:loadScheme("TaharezGreenMenuWidgets.scheme")
+--schemeMgr:create("TaharezGreenMenuWidgets.scheme")
 --menuImageSet = "TaharezGreenLook"
---schemeMgr:loadScheme("TaharezGreenHUDWidgets.scheme")
+--schemeMgr:create("TaharezGreenHUDWidgets.scheme")
 --hudImageSet = "TaharezGreenLook"
-schemeMgr:loadScheme(scheme .. "MenuWidgets.scheme")
+schemeMgr:create(scheme .. "MenuWidgets.scheme")
 menuImageSet = scheme .. "Look"
-schemeMgr:loadScheme(scheme .. "HUDWidgets.scheme")
+schemeMgr:create(scheme .. "HUDWidgets.scheme")
 hudImageSet = scheme .. "Look"
 
 -- Just a remaining test hack
-schemeMgr:loadScheme("OrxonoxGUIScheme.scheme")
+schemeMgr:create("OrxonoxGUIScheme.scheme")
 
 local system = CEGUI.System:getSingleton()
 system:setDefaultMouseCursor(menuImageSet, "MouseArrow")

Modified: code/branches/kicklib/data/gui/scripts/NotificationLayer.lua
===================================================================
--- code/branches/kicklib/data/gui/scripts/NotificationLayer.lua	2011-02-25 02:07:17 UTC (rev 7960)
+++ code/branches/kicklib/data/gui/scripts/NotificationLayer.lua	2011-02-25 04:02:13 UTC (rev 7961)
@@ -483,7 +483,7 @@
     local singleItemHeight = listbox:getTotalItemsHeight()
     local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(queue:getLookNFeel())
     local formattedArea = lookAndFeel:getNamedArea("ItemRenderingArea"):getArea():getPixelRect(queue)
-    local frameHeight = queue:getUnclippedPixelRect():getHeight() - formattedArea:getHeight()
+    local frameHeight = queue:getUnclippedOuterRect():getHeight() - formattedArea:getHeight()
     listbox:removeItem(item)
     return frameHeight + singleItemHeight*size
 end

Modified: code/branches/kicklib/src/libraries/core/GUIManager.cc
===================================================================
--- code/branches/kicklib/src/libraries/core/GUIManager.cc	2011-02-25 02:07:17 UTC (rev 7960)
+++ code/branches/kicklib/src/libraries/core/GUIManager.cc	2011-02-25 04:02:13 UTC (rev 7961)
@@ -172,6 +172,9 @@
         // Create the CEGUI system singleton
 #if CEGUI_VERSION_MAJOR < 1 && CEGUI_VERSION_MINOR < 7
         guiSystem_ = new System(guiRenderer_, resourceProvider_, 0, scriptModule_);
+        // Add functions that have been renamed in newer versions
+        luaState_->doString("CEGUI.SchemeManager.create = CEGUI.SchemeManager.loadScheme");
+        luaState_->doString("CEGUI.Window.getUnclippedOuterRect = CEGUI.Window.getUnclippedPixelRect");
 #else
         guiSystem_ = &System::create(*guiRenderer_, resourceProvider_, 0, imageCodec_, scriptModule_);
 #endif




More information about the Orxonox-commit mailing list