[Orxonox-commit 340] r2957 - in trunk/src/orxonox: gamestates gui overlays
bknecht at orxonox.net
bknecht at orxonox.net
Thu May 7 17:05:45 CEST 2009
Author: bknecht
Date: 2009-05-07 17:05:45 +0200 (Thu, 07 May 2009)
New Revision: 2957
Added:
trunk/src/orxonox/overlays/GUIOverlay.cc
trunk/src/orxonox/overlays/GUIOverlay.h
Modified:
trunk/src/orxonox/gamestates/GSMainMenu.cc
trunk/src/orxonox/gui/GUIManager.cc
trunk/src/orxonox/overlays/CMakeLists.txt
Log:
hack to include gui into hud
Modified: trunk/src/orxonox/gamestates/GSMainMenu.cc
===================================================================
--- trunk/src/orxonox/gamestates/GSMainMenu.cc 2009-05-07 14:44:12 UTC (rev 2956)
+++ trunk/src/orxonox/gamestates/GSMainMenu.cc 2009-05-07 15:05:45 UTC (rev 2957)
@@ -66,7 +66,7 @@
this->camera_ = this->scene_->getSceneManager()->createCamera("mainMenu/Camera");
// show main menu
- GUIManager::getInstance().showGUI("mainmenu");
+ GUIManager::getInstance().showGUI("mainmenu_2");
GUIManager::getInstance().setCamera(this->camera_);
GraphicsManager::getInstance().setCamera(this->camera_);
Modified: trunk/src/orxonox/gui/GUIManager.cc
===================================================================
--- trunk/src/orxonox/gui/GUIManager.cc 2009-05-07 14:44:12 UTC (rev 2956)
+++ trunk/src/orxonox/gui/GUIManager.cc 2009-05-07 15:05:45 UTC (rev 2957)
@@ -186,11 +186,11 @@
{
try
{
- // call main Lua script
- this->scriptModule_->executeScriptFile("loadGUI_2.lua", "GUI");
// set datapath for GUI data
lua_pushfstring(this->scriptModule_->getLuaState(), Core::getMediaPathString().c_str());
lua_setglobal(this->scriptModule_->getLuaState(), "datapath");
+ // call main Lua script
+ this->scriptModule_->executeScriptFile("loadGUI_3.lua", "GUI");
}
catch (CEGUI::Exception& ex)
{
Modified: trunk/src/orxonox/overlays/CMakeLists.txt
===================================================================
--- trunk/src/orxonox/overlays/CMakeLists.txt 2009-05-07 14:44:12 UTC (rev 2956)
+++ trunk/src/orxonox/overlays/CMakeLists.txt 2009-05-07 15:05:45 UTC (rev 2957)
@@ -2,6 +2,7 @@
OrxonoxOverlay.cc
OverlayGroup.cc
OverlayText.cc
+ GUIOverlay.cc
)
ADD_SUBDIRECTORY(console)
Added: trunk/src/orxonox/overlays/GUIOverlay.cc
===================================================================
--- trunk/src/orxonox/overlays/GUIOverlay.cc (rev 0)
+++ trunk/src/orxonox/overlays/GUIOverlay.cc 2009-05-07 15:05:45 UTC (rev 2957)
@@ -0,0 +1,64 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Benjamin Knecht
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "GUIOverlay.h"
+#include "OrxonoxStableHeaders.h"
+
+#include "../gui/GUIManager.h"
+
+namespace orxonox
+{
+ CreateFactory(GUIOverlay);
+
+ GUIOverlay::GUIOverlay(BaseObject* creator) : OrxonoxOverlay(creator)
+ {
+ RegisterObject(GUIOverlay);
+ }
+
+ GUIOverlay::~GUIOverlay()
+ {
+ }
+
+ void GUIOverlay::XMLPort(Element& xmlElement, XMLPort::Mode mode)
+ {
+ SUPER(GUIOverlay, XMLPort, xmlElement, mode);
+
+ XMLPortParam(GUIOverlay, "guiname", setGUIName, getGUIName, xmlElement, mode);
+ }
+
+ void GUIOverlay::changedVisibility()
+ {
+ SUPER(GUIOverlay, changedVisibility);
+
+ if (this->isVisible())
+ GUIManager::getInstancePtr()->executeCode("showGUI(\"" + this->guiName_ + "\", " + this + ")");
+ else
+ GUIManager::getInstancePtr()->executeCode("hideGUI(\"" + this->guiName_ + "\")");
+ }
+
+}
\ No newline at end of file
Added: trunk/src/orxonox/overlays/GUIOverlay.h
===================================================================
--- trunk/src/orxonox/overlays/GUIOverlay.h (rev 0)
+++ trunk/src/orxonox/overlays/GUIOverlay.h 2009-05-07 15:05:45 UTC (rev 2957)
@@ -0,0 +1,61 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Benjamin Knecht
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _GUIOverlay_H__
+#define _GUIOverlay_H__
+
+
+#include "OrxonoxOverlay.h"
+#include "OrxonoxPrereqs.h"
+
+#include <OgrePrerequisites.h>
+
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport GUIOverlay : public OrxonoxOverlay
+ {
+ public:
+
+ GUIOverlay(BaseObject* creator);
+ virtual ~GUIOverlay();
+
+ virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
+
+ inline void setGUIName(const std::string& name) { this->guiName_ = name; }
+ inline const std::string& getGUIName() const { return this->guiName_; }
+
+ virtual void changedVisibility();
+
+ private:
+ std::string guiName_;
+ };
+}
+
+#endif
More information about the Orxonox-commit
mailing list