[Orxonox-commit 3273] r7964 - in code/branches/kicklib/data: gui/scripts tcl
rgrieder at orxonox.net
rgrieder at orxonox.net
Sat Feb 26 06:46:37 CET 2011
Author: rgrieder
Date: 2011-02-26 06:46:36 +0100 (Sat, 26 Feb 2011)
New Revision: 7964
Modified:
code/branches/kicklib/data/gui/scripts/GUITools.lua
code/branches/kicklib/data/tcl/init.tcl
Log:
Trying to port last bit of our Lua code to CEGUI 0.7.
But the piece of code now doesn't work with either version ^^ (though you can only see it in Credits and Quest)
Damian, I might need your assistance again :P
Modified: code/branches/kicklib/data/gui/scripts/GUITools.lua
===================================================================
--- code/branches/kicklib/data/gui/scripts/GUITools.lua 2011-02-26 05:44:25 UTC (rev 7963)
+++ code/branches/kicklib/data/gui/scripts/GUITools.lua 2011-02-26 05:46:36 UTC (rev 7964)
@@ -45,11 +45,18 @@
return 0.008*ratio/0.3204
end
+function getStaticTextArea(static_text)
+ local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(static_text:getLookNFeel())
+
+ return lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(static_text)
+end
+
function getStaticTextWindowHeight(window)
- local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(window:getLookNFeel())
- local formattedArea = lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window)
+ -- Get the area the text is formatted and drawn into.
+ local formattedArea = getStaticTextArea(window)
+ -- Calculate the pixel height of the frame by subtracting the height of the area above from the total height of the window.
local frameHeight = window:getUnclippedOuterRect():getHeight() - formattedArea:getHeight()
- local lines = window:getFont():getFormattedLineCount(window:getText(), formattedArea, CEGUI.WordWrapLeftAligned)
- local height = lines * window:getFont():getLineSpacing() + frameHeight
+
+ local height = math.floor(CEGUI.PropertyHelper.stringToFloat(window:getProperty("VertExtent")) + frameHeight) + 1
return height
end
Modified: code/branches/kicklib/data/tcl/init.tcl
===================================================================
--- code/branches/kicklib/data/tcl/init.tcl 2011-02-26 05:44:25 UTC (rev 7963)
+++ code/branches/kicklib/data/tcl/init.tcl 2011-02-26 05:46:36 UTC (rev 7964)
@@ -133,7 +133,7 @@
# change the working directory to the media path
-cd $::orxonox::mediapath
+#cd $::orxonox::mediapath
# Redefines puts to write directly into the Orxonox console if the channel is stdout or stderr.
More information about the Orxonox-commit
mailing list