[Orxonox-commit 999] r5720 - in code/branches/libraries2/src: modules modules/overlays orxonox/objects/quest orxonox/objects/quest/notifications orxonox/objects/worldentities/triggers orxonox/overlays orxonox/sound
landauf at orxonox.net
landauf at orxonox.net
Mon Aug 31 17:03:29 CEST 2009
Author: landauf
Date: 2009-08-31 17:03:29 +0200 (Mon, 31 Aug 2009)
New Revision: 5720
Added:
code/branches/libraries2/src/modules/overlays/
code/branches/libraries2/src/modules/overlays/CMakeLists.txt
code/branches/libraries2/src/modules/overlays/FadeoutText.cc
code/branches/libraries2/src/modules/overlays/FadeoutText.h
code/branches/libraries2/src/modules/overlays/GUIOverlay.cc
code/branches/libraries2/src/modules/overlays/GUIOverlay.h
code/branches/libraries2/src/modules/overlays/OverlayText.cc
code/branches/libraries2/src/modules/overlays/OverlayText.h
code/branches/libraries2/src/modules/overlays/OverlaysPrereqs.h
code/branches/libraries2/src/modules/overlays/debug/
code/branches/libraries2/src/modules/overlays/hud/
code/branches/libraries2/src/modules/overlays/stats/
Removed:
code/branches/libraries2/src/orxonox/overlays/FadeoutText.cc
code/branches/libraries2/src/orxonox/overlays/FadeoutText.h
code/branches/libraries2/src/orxonox/overlays/GUIOverlay.cc
code/branches/libraries2/src/orxonox/overlays/GUIOverlay.h
code/branches/libraries2/src/orxonox/overlays/OverlayText.cc
code/branches/libraries2/src/orxonox/overlays/OverlayText.h
code/branches/libraries2/src/orxonox/overlays/OverlaysPrereqs.h
code/branches/libraries2/src/orxonox/overlays/debug/
code/branches/libraries2/src/orxonox/overlays/hud/
code/branches/libraries2/src/orxonox/overlays/stats/
Modified:
code/branches/libraries2/src/modules/CMakeLists.txt
code/branches/libraries2/src/orxonox/objects/quest/QuestEffectBeacon.cc
code/branches/libraries2/src/orxonox/objects/quest/QuestEffectBeacon.h
code/branches/libraries2/src/orxonox/objects/quest/notifications/NotificationOverlay.h
code/branches/libraries2/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc
code/branches/libraries2/src/orxonox/overlays/CMakeLists.txt
code/branches/libraries2/src/orxonox/sound/SoundBase.cc
code/branches/libraries2/src/orxonox/sound/SoundManager.cc
Log:
moved overlays to modules
Modified: code/branches/libraries2/src/modules/CMakeLists.txt
===================================================================
--- code/branches/libraries2/src/modules/CMakeLists.txt 2009-08-31 14:45:12 UTC (rev 5719)
+++ code/branches/libraries2/src/modules/CMakeLists.txt 2009-08-31 15:03:29 UTC (rev 5720)
@@ -20,3 +20,4 @@
################ Sub Directories ################
ADD_SUBDIRECTORY(gamestates)
+ADD_SUBDIRECTORY(overlays)
Copied: code/branches/libraries2/src/modules/overlays/CMakeLists.txt (from rev 5714, code/branches/libraries2/src/orxonox/overlays/CMakeLists.txt)
===================================================================
--- code/branches/libraries2/src/modules/overlays/CMakeLists.txt (rev 0)
+++ code/branches/libraries2/src/modules/overlays/CMakeLists.txt 2009-08-31 15:03:29 UTC (rev 5720)
@@ -0,0 +1,19 @@
+SET_SOURCE_FILES(OVERLAYS_SRC_FILES
+ OverlayText.cc
+ FadeoutText.cc
+ GUIOverlay.cc
+)
+
+ADD_SUBDIRECTORY(debug)
+ADD_SUBDIRECTORY(hud)
+ADD_SUBDIRECTORY(stats)
+
+ORXONOX_ADD_LIBRARY(overlays
+ MODULE
+ FIND_HEADER_FILES
+ DEFINE_SYMBOL
+ "OVERLAYS_SHARED_BUILD"
+ LINK_LIBRARIES
+ orxonox
+ SOURCE_FILES ${OVERLAYS_SRC_FILES}
+)
Copied: code/branches/libraries2/src/modules/overlays/FadeoutText.cc (from rev 5714, code/branches/libraries2/src/orxonox/overlays/FadeoutText.cc)
===================================================================
--- code/branches/libraries2/src/modules/overlays/FadeoutText.cc (rev 0)
+++ code/branches/libraries2/src/modules/overlays/FadeoutText.cc 2009-08-31 15:03:29 UTC (rev 5720)
@@ -0,0 +1,116 @@
+/*
+ * 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:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "FadeoutText.h"
+
+#include <OgreTextAreaOverlayElement.h>
+#include "util/Math.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ CreateFactory(FadeoutText);
+
+ FadeoutText::FadeoutText(BaseObject* creator) : OverlayText(creator)
+ {
+ RegisterObject(FadeoutText);
+
+ this->delay_ = 3.0f;
+ this->fadeouttime_ = 1.0f;
+
+ this->bFadingOut_ = false;
+ this->fadeouttimer_.setTimer(3.0f, false, this, createExecutor(createFunctor(&FadeoutText::fadeout)));
+ this->fadeouttimer_.stopTimer();
+
+ this->initialAlpha_ = 1.0f;
+ }
+
+ void FadeoutText::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(FadeoutText, XMLPort, xmlelement, mode);
+
+ XMLPortParam(FadeoutText, "delay", setDelay, getDelay, xmlelement, mode);
+ XMLPortParam(FadeoutText, "fadeout", setFadeouttime, getFadeouttime, xmlelement, mode);
+ }
+
+ void FadeoutText::tick(float dt)
+ {
+ if (this->bFadingOut_)
+ {
+ ColourValue colour = this->getColour();
+
+ if (colour.a > 0)
+ {
+ float alpha = colour.a;
+
+ alpha -= dt / this->fadeouttime_;
+ if (alpha < 0)
+ alpha = 0;
+ colour.a = alpha;
+
+ this->text_->setColour(colour);
+ }
+ else
+ {
+ this->text_->setCaption("");
+ this->reset();
+ }
+ }
+ }
+
+ void FadeoutText::fadeout()
+ {
+ this->bFadingOut_ = true;
+ }
+
+ void FadeoutText::reset()
+ {
+ this->bFadingOut_ = false;
+
+ ColourValue colour = this->getColour();
+ colour.a = this->initialAlpha_;
+ this->text_->setColour(colour);
+ }
+
+ void FadeoutText::changedColour()
+ {
+ OverlayText::changedColour();
+
+ this->initialAlpha_ = this->getColour().a;
+ }
+
+ void FadeoutText::changedCaption()
+ {
+ OverlayText::changedCaption();
+
+ this->reset();
+ this->fadeouttimer_.setInterval(this->delay_);
+ this->fadeouttimer_.startTimer();
+ }
+}
Copied: code/branches/libraries2/src/modules/overlays/FadeoutText.h (from rev 5714, code/branches/libraries2/src/orxonox/overlays/FadeoutText.h)
===================================================================
--- code/branches/libraries2/src/modules/overlays/FadeoutText.h (rev 0)
+++ code/branches/libraries2/src/modules/overlays/FadeoutText.h 2009-08-31 15:03:29 UTC (rev 5720)
@@ -0,0 +1,75 @@
+/*
+ * 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:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _FadeoutText_H__
+#define _FadeoutText_H__
+
+#include "overlays/OverlaysPrereqs.h"
+
+#include "tools/Timer.h"
+#include "tools/interfaces/Tickable.h"
+#include "overlays/OverlayText.h"
+
+namespace orxonox
+{
+ class _OverlaysExport FadeoutText : public OverlayText, public Tickable
+ {
+ public:
+ FadeoutText(BaseObject* creator);
+ virtual ~FadeoutText() {}
+
+ virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
+ virtual void tick(float dt);
+
+ inline void setDelay(float delay)
+ { this->delay_ = delay; }
+ inline float getDelay() const
+ { return this->delay_; }
+
+ inline void setFadeouttime(float fadeouttime)
+ { this->fadeouttime_ = fadeouttime; }
+ inline float getFadeouttime() const
+ { return this->fadeouttime_; }
+
+ private:
+ virtual void changedColour();
+ virtual void changedCaption();
+
+ void fadeout();
+ void reset();
+
+ float delay_;
+ float fadeouttime_;
+
+ bool bFadingOut_;
+ Timer<FadeoutText> fadeouttimer_;
+
+ float initialAlpha_;
+ };
+}
+#endif /* _FadeoutText_H__ */
Copied: code/branches/libraries2/src/modules/overlays/GUIOverlay.cc (from rev 5714, code/branches/libraries2/src/orxonox/overlays/GUIOverlay.cc)
===================================================================
--- code/branches/libraries2/src/modules/overlays/GUIOverlay.cc (rev 0)
+++ code/branches/libraries2/src/modules/overlays/GUIOverlay.cc 2009-08-31 15:03:29 UTC (rev 5720)
@@ -0,0 +1,87 @@
+/*
+ * 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 <string>
+#include <sstream>
+
+#include "core/input/InputManager.h"
+#include "core/CoreIncludes.h"
+#include "core/GUIManager.h"
+#include "core/XMLPort.h"
+#include "objects/infos/PlayerInfo.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())
+ {
+ std::string str;
+ std::stringstream out;
+ out << reinterpret_cast<long>(this);
+ str = out.str();
+ GUIManager::getInstance().executeCode("showCursor()");
+ InputManager::getInstance().enterState("guiMouseOnly");
+ GUIManager::getInstance().executeCode("showGUI(\"" + this->guiName_ + "\", " + str + ")");
+ }
+ else
+ {
+ GUIManager::getInstance().executeCode("hideGUI(\"" + this->guiName_ + "\")");
+ GUIManager::getInstance().executeCode("hideCursor()");
+ InputManager::getInstance().leaveState("guiMouseOnly");
+ }
+ }
+
+ void GUIOverlay::setGUIName(const std::string& name)
+ {
+ this->guiName_ = name;
+ GUIManager::getInstance().setPlayer(name, orxonox_cast<PlayerInfo*>(this->getOwner()));
+ }
+}
Copied: code/branches/libraries2/src/modules/overlays/GUIOverlay.h (from rev 5714, code/branches/libraries2/src/orxonox/overlays/GUIOverlay.h)
===================================================================
--- code/branches/libraries2/src/modules/overlays/GUIOverlay.h (rev 0)
+++ code/branches/libraries2/src/modules/overlays/GUIOverlay.h 2009-08-31 15:03:29 UTC (rev 5720)
@@ -0,0 +1,58 @@
+/*
+ * 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 "overlays/OverlaysPrereqs.h"
+
+#include <string>
+#include "overlays/OrxonoxOverlay.h"
+
+namespace orxonox
+{
+ class _OverlaysExport GUIOverlay : public OrxonoxOverlay
+ {
+ public:
+
+ GUIOverlay(BaseObject* creator);
+ virtual ~GUIOverlay();
+
+ virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
+
+ void setGUIName(const std::string& name);
+ inline const std::string& getGUIName() const { return this->guiName_; }
+
+ virtual void changedVisibility();
+
+ private:
+ std::string guiName_;
+ };
+}
+
+#endif
Copied: code/branches/libraries2/src/modules/overlays/OverlayText.cc (from rev 5714, code/branches/libraries2/src/orxonox/overlays/OverlayText.cc)
===================================================================
--- code/branches/libraries2/src/modules/overlays/OverlayText.cc (rev 0)
+++ code/branches/libraries2/src/modules/overlays/OverlayText.cc 2009-08-31 15:03:29 UTC (rev 5720)
@@ -0,0 +1,170 @@
+/*
+ * 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:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OverlayText.h"
+
+#include <OgreOverlayManager.h>
+#include <OgrePanelOverlayElement.h>
+#include <OgreTextAreaOverlayElement.h>
+#include <boost/static_assert.hpp>
+
+#include "util/StringUtils.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+
+namespace orxonox
+{
+ CreateFactory(OverlayText);
+
+ BOOST_STATIC_ASSERT((int)Ogre::TextAreaOverlayElement::Left == (int)OverlayText::Left);
+ BOOST_STATIC_ASSERT((int)Ogre::TextAreaOverlayElement::Center == (int)OverlayText::Center);
+ BOOST_STATIC_ASSERT((int)Ogre::TextAreaOverlayElement::Right == (int)OverlayText::Right);
+
+ OverlayText::OverlayText(BaseObject* creator)
+ : OrxonoxOverlay(creator)
+ {
+ RegisterObject(OverlayText);
+
+ this->text_ = static_cast<Ogre::TextAreaOverlayElement*>(Ogre::OverlayManager::getSingleton()
+ .createOverlayElement("TextArea", "OverlayText_text_" + getUniqueNumberString()));
+ this->text_->setCharHeight(1.0);
+
+ this->setFont("Monofur");
+ this->setColour(ColourValue(1.0, 1.0, 1.0, 1.0));
+ this->setCaption("");
+ this->setTextSize(1.0f);
+ this->setAlignmentString("left");
+
+ this->background_->addChild(this->text_);
+ }
+
+ OverlayText::~OverlayText()
+ {
+ if (this->isInitialized())
+ Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->text_);
+ }
+
+ void OverlayText::XMLPort(Element& xmlElement, XMLPort::Mode mode)
+ {
+ SUPER(OverlayText, XMLPort, xmlElement, mode);
+
+ XMLPortParam(OverlayText, "font", setFont, getFont, xmlElement, mode);
+ XMLPortParam(OverlayText, "colour", setColour, getColour, xmlElement, mode);
+ XMLPortParam(OverlayText, "caption", setCaption, getCaption, xmlElement, mode);
+ XMLPortParam(OverlayText, "textsize", setTextSize, getTextSize, xmlElement, mode);
+ XMLPortParam(OverlayText, "align", setAlignmentString, getAlignmentString, xmlElement, mode);
+ XMLPortParam(OverlayText, "spacewidth", setSpaceWidth, getSpaceWidth, xmlElement, mode);
+ }
+
+ void OverlayText::setAlignmentString(const std::string& alignment)
+ {
+ if (alignment == "right")
+ this->setAlignment(OverlayText::Right);
+ else if (alignment == "center")
+ this->setAlignment(OverlayText::Center);
+ else // "left" and default
+ this->setAlignment(OverlayText::Left);
+ }
+
+ std::string OverlayText::getAlignmentString() const
+ {
+ Ogre::TextAreaOverlayElement::Alignment alignment = this->text_->getAlignment();
+
+ switch (alignment)
+ {
+ case Ogre::TextAreaOverlayElement::Right:
+ return "right";
+ case Ogre::TextAreaOverlayElement::Center:
+ return "center";
+ case Ogre::TextAreaOverlayElement::Left:
+ return "left";
+ default:
+ assert(false); return "";
+ }
+ }
+
+ void OverlayText::sizeChanged()
+ {
+ if (this->rotState_ == Horizontal)
+ this->overlay_->setScale(size_.y * sizeCorrection_.y, size_.y * sizeCorrection_.y);
+ else if (this->rotState_ == Vertical)
+ this->overlay_->setScale(size_.y / (sizeCorrection_.y * sizeCorrection_.y), size_.y * sizeCorrection_.y);
+ else
+ this->overlay_->setScale(size_.y, size_.y);
+
+ positionChanged();
+ }
+
+ void OverlayText::setCaption(const std::string& caption)
+ {
+ this->text_->setCaption(caption);
+ this->changedCaption();
+ }
+ std::string OverlayText::getCaption() const
+ {
+ return this->text_->getCaption();
+ }
+
+ void OverlayText::setFont(const std::string& font)
+ {
+ if (font != "")
+ this->text_->setFontName(font);
+ }
+ const std::string& OverlayText::getFont() const
+ {
+ return this->text_->getFontName();
+ }
+
+ void OverlayText::setSpaceWidth(float width)
+ {
+ this->text_->setSpaceWidth(width);
+ }
+ float OverlayText::getSpaceWidth() const
+ {
+ return this->text_->getSpaceWidth();
+ }
+
+ void OverlayText::setColour(const ColourValue& colour)
+ {
+ this->text_->setColour(colour); this->changedColour();
+ }
+ const ColourValue& OverlayText::getColour() const
+ {
+ return this->text_->getColour();
+ }
+
+ void OverlayText::setAlignment(OverlayText::Alignment alignment)
+ {
+ this->text_->setAlignment(static_cast<Ogre::TextAreaOverlayElement::Alignment>(alignment));
+ }
+ OverlayText::Alignment OverlayText::getAlignment() const
+ {
+ return static_cast<OverlayText::Alignment>(this->text_->getAlignment());
+ }
+}
Copied: code/branches/libraries2/src/modules/overlays/OverlayText.h (from rev 5714, code/branches/libraries2/src/orxonox/overlays/OverlayText.h)
===================================================================
--- code/branches/libraries2/src/modules/overlays/OverlayText.h (rev 0)
+++ code/branches/libraries2/src/modules/overlays/OverlayText.h 2009-08-31 15:03:29 UTC (rev 5720)
@@ -0,0 +1,85 @@
+/*
+ * 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:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _OverlayText_H__
+#define _OverlayText_H__
+
+#include "overlays/OverlaysPrereqs.h"
+
+#include <string>
+#include "util/Math.h"
+#include "util/OgreForwardRefs.h"
+#include "overlays/OrxonoxOverlay.h"
+
+namespace orxonox
+{
+ class _OverlaysExport OverlayText : public OrxonoxOverlay
+ {
+ public:
+ enum Alignment
+ {
+ Left,
+ Right,
+ Center
+ };
+
+ OverlayText(BaseObject* creator);
+ virtual ~OverlayText();
+
+ virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
+
+ void setCaption(const std::string& caption);
+ std::string getCaption() const;
+
+ void setFont(const std::string& font);
+ const std::string& getFont() const;
+
+ void setSpaceWidth(float width);
+ float getSpaceWidth() const;
+
+ void setColour(const ColourValue& colour);
+ const ColourValue& getColour() const;
+
+ void setAlignment(OverlayText::Alignment alignment);
+ OverlayText::Alignment getAlignment() const;
+
+ void setAlignmentString(const std::string& alignment);
+ std::string getAlignmentString() const;
+
+ inline void setTextSize(float size) { this->setSize(Vector2(size, size)); }
+ inline float getTextSize() const { return this->getSize().y; }
+
+ protected:
+ virtual void sizeChanged();
+ virtual void changedColour() {}
+ virtual void changedCaption() {}
+
+ Ogre::TextAreaOverlayElement* text_;
+ };
+}
+#endif /* _OverlayText_H__ */
Copied: code/branches/libraries2/src/modules/overlays/OverlaysPrereqs.h (from rev 5714, code/branches/libraries2/src/orxonox/overlays/OverlaysPrereqs.h)
===================================================================
--- code/branches/libraries2/src/modules/overlays/OverlaysPrereqs.h (rev 0)
+++ code/branches/libraries2/src/modules/overlays/OverlaysPrereqs.h 2009-08-31 15:03:29 UTC (rev 5720)
@@ -0,0 +1,88 @@
+/*
+ * 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:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @brief Contains all the necessary forward declarations for all classes and structs.
+*/
+
+#ifndef _OverlaysPrereqs_H__
+#define _OverlaysPrereqs_H__
+
+#include "OrxonoxConfig.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(ORXONOX_STATIC_BUILD)
+# ifdef OVERLAYS_SHARED_BUILD
+# define _OverlaysExport __declspec(dllexport)
+# else
+# if defined( __MINGW32__ )
+# define _OverlaysExport
+# else
+# define _OverlaysExport __declspec(dllimport)
+# endif
+# endif
+#elif defined ( ORXONOX_GCC_VISIBILITY )
+# define _OverlaysExport __attribute__ ((visibility("default")))
+#else
+# define _OverlaysExport
+#endif
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+ class BarColour;
+ class DebugFPSText;
+ class DebugRTRText;
+ class GUIOverlay;
+ class HUDBar;
+ class HUDNavigation;
+ class HUDRadar;
+ class HUDSpeedBar;
+ class HUDHealthBar;
+ class HUDTimer;
+ class OrxonoxOverlay;
+ class OverlayGroup;
+ class OverlayText;
+ class FadeoutText;
+ class GametypeStatus;
+ class AnnounceMessage;
+ class KillMessage;
+ class DeathMessage;
+
+ class CreateLines;
+ class Scoreboard;
+ class Stats;
+}
+
+#endif /* _OverlaysPrereqs_H__ */
Modified: code/branches/libraries2/src/orxonox/objects/quest/QuestEffectBeacon.cc
===================================================================
--- code/branches/libraries2/src/orxonox/objects/quest/QuestEffectBeacon.cc 2009-08-31 14:45:12 UTC (rev 5719)
+++ code/branches/libraries2/src/orxonox/objects/quest/QuestEffectBeacon.cc 2009-08-31 15:03:29 UTC (rev 5720)
@@ -36,8 +36,8 @@
#include "core/CoreIncludes.h"
#include "core/XMLPort.h"
#include "core/EventIncludes.h"
-#include "orxonox/objects/worldentities/pawns/Pawn.h"
-#include "orxonox/objects/worldentities/triggers/PlayerTrigger.h"
+#include "objects/worldentities/pawns/Pawn.h"
+#include "objects/worldentities/triggers/PlayerTrigger.h"
#include "QuestEffect.h"
namespace orxonox
@@ -51,7 +51,7 @@
QuestEffectBeacon::QuestEffectBeacon(BaseObject* creator) : StaticEntity(creator)
{
RegisterObject(QuestEffectBeacon);
-
+
this->status_ = QuestEffectBeaconStatus::Active;
this->times_ = INFINITE_TIME;
}
@@ -62,7 +62,7 @@
QuestEffectBeacon::~QuestEffectBeacon()
{
}
-
+
/**
@brief
Method for creating a QuestEffectBeacon object through XML.
@@ -73,10 +73,10 @@
XMLPortParam(QuestEffectBeacon, "times", setTimes, getTimes, xmlelement, mode);
XMLPortObject(QuestEffectBeacon, QuestEffect, "effects", addEffect, getEffect, xmlelement, mode);
-
+
COUT(3) << "New QuestEffectBeacon created." << std::endl;
}
-
+
/**
@brief
Processes an event for this QuestEffectBeacon.
@@ -84,10 +84,10 @@
void QuestEffectBeacon::processEvent(Event& event)
{
SUPER(QuestEffectBeacon, processEvent, event);
-
+
ORXONOX_SET_SUBCLASS_EVENT(QuestEffectBeacon, "execute", execute, event, PlayerTrigger);
}
-
+
/**
@brief
Executes the QuestEffectBeacon.
@@ -108,7 +108,7 @@
COUT(3) << "The QuestEffectBeacon is inactive." << std::endl;
return false;
}
-
+
if(!trigger->isForPlayer()) //!< The PlayerTrigger is not exclusively for ControllableEntities which means we cannot extract one.
{
return false;
@@ -122,10 +122,10 @@
COUT(2) << "The QuestEffectBeacon was triggered by an entity other than a Pawn." << std::endl;
return false;
}
-
+
//! Extract the PlayerInfo from the ControllableEntity.
PlayerInfo* player = pawn->getPlayer();
-
+
if(player == NULL)
{
COUT(3) << "The PlayerInfo* is NULL." << std::endl;
@@ -143,7 +143,7 @@
return false;
}
-
+
/**
@brief
Set the status of the QuestEffectBeacon.
@@ -158,17 +158,17 @@
{
return false;
}
-
+
if(activate)
{
this->status_ = QuestEffectBeaconStatus::Active;
return true;
}
-
+
this->status_ = QuestEffectBeaconStatus::Inactive;
return true;
}
-
+
/**
@brief
Decrement the number of times the QuestEffectBeacon can be executed.
@@ -185,16 +185,16 @@
{
return true;
}
-
+
this->times_ = this->times_ - 1; //!< Decrement number of times the QuestEffectBeacon can be executed.
if(this->getTimes() == 0) //!< Set the QuestEffectBeacon to inactive when the number of times it can be executed is reduced to 0.
{
this->status_ = QuestEffectBeaconStatus::Inactive;
}
-
+
return true;
}
-
+
/**
@brief
Set the number of times the QuestEffectBeacon can be executed.
@@ -211,11 +211,11 @@
{
return false;
}
-
+
this->times_ = n;
return true;
}
-
+
/**
@brief
Adds a QuestEffect to the QuestEffectBeacon.
@@ -237,7 +237,7 @@
COUT(3) << "A QuestEffect was added to a QuestEffectBeacon." << std::endl;
return true;
}
-
+
/**
@brief
Returns the QuestEffect at the given index.
Modified: code/branches/libraries2/src/orxonox/objects/quest/QuestEffectBeacon.h
===================================================================
--- code/branches/libraries2/src/orxonox/objects/quest/QuestEffectBeacon.h 2009-08-31 14:45:12 UTC (rev 5719)
+++ code/branches/libraries2/src/orxonox/objects/quest/QuestEffectBeacon.h 2009-08-31 15:03:29 UTC (rev 5720)
@@ -37,7 +37,7 @@
#include "objects/quest/QuestPrereqs.h"
#include <list>
-#include "orxonox/objects/worldentities/StaticEntity.h"
+#include "objects/worldentities/StaticEntity.h"
namespace orxonox
{
Modified: code/branches/libraries2/src/orxonox/objects/quest/notifications/NotificationOverlay.h
===================================================================
--- code/branches/libraries2/src/orxonox/objects/quest/notifications/NotificationOverlay.h 2009-08-31 14:45:12 UTC (rev 5719)
+++ code/branches/libraries2/src/orxonox/objects/quest/notifications/NotificationOverlay.h 2009-08-31 15:03:29 UTC (rev 5720)
@@ -38,7 +38,7 @@
#include "objects/quest/QuestPrereqs.h"
#include <string>
-#include "orxonox/overlays/OverlayText.h"
+#include "overlays/OverlayText.h"
namespace orxonox
{
Modified: code/branches/libraries2/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc
===================================================================
--- code/branches/libraries2/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc 2009-08-31 14:45:12 UTC (rev 5719)
+++ code/branches/libraries2/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc 2009-08-31 15:03:29 UTC (rev 5720)
@@ -30,7 +30,7 @@
#include "core/CoreIncludes.h"
#include "core/XMLPort.h"
-#include "orxonox/objects/worldentities/pawns/Pawn.h"
+#include "objects/worldentities/pawns/Pawn.h"
namespace orxonox
{
Modified: code/branches/libraries2/src/orxonox/overlays/CMakeLists.txt
===================================================================
--- code/branches/libraries2/src/orxonox/overlays/CMakeLists.txt 2009-08-31 14:45:12 UTC (rev 5719)
+++ code/branches/libraries2/src/orxonox/overlays/CMakeLists.txt 2009-08-31 15:03:29 UTC (rev 5720)
@@ -2,25 +2,3 @@
OrxonoxOverlay.cc
OverlayGroup.cc
)
-
-SET_SOURCE_FILES(OVERLAYS_SRC_FILES
- OverlayText.cc
- FadeoutText.cc
- GUIOverlay.cc
-)
-
-ADD_SUBDIRECTORY(debug)
-ADD_SUBDIRECTORY(hud)
-ADD_SUBDIRECTORY(stats)
-
-ORXONOX_ADD_LIBRARY(overlays
- MODULE
- FIND_HEADER_FILES
- DEFINE_SYMBOL
- "OVERLAYS_SHARED_BUILD"
- PCH_FILE
- ../OrxonoxPrecompiledHeaders.h
- LINK_LIBRARIES
- orxonox
- SOURCE_FILES ${OVERLAYS_SRC_FILES}
-)
Deleted: code/branches/libraries2/src/orxonox/overlays/FadeoutText.cc
===================================================================
--- code/branches/libraries2/src/orxonox/overlays/FadeoutText.cc 2009-08-31 14:45:12 UTC (rev 5719)
+++ code/branches/libraries2/src/orxonox/overlays/FadeoutText.cc 2009-08-31 15:03:29 UTC (rev 5720)
@@ -1,116 +0,0 @@
-/*
- * 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:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "FadeoutText.h"
-
-#include <OgreTextAreaOverlayElement.h>
-#include "util/Math.h"
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-
-namespace orxonox
-{
- CreateFactory(FadeoutText);
-
- FadeoutText::FadeoutText(BaseObject* creator) : OverlayText(creator)
- {
- RegisterObject(FadeoutText);
-
- this->delay_ = 3.0f;
- this->fadeouttime_ = 1.0f;
-
- this->bFadingOut_ = false;
- this->fadeouttimer_.setTimer(3.0f, false, this, createExecutor(createFunctor(&FadeoutText::fadeout)));
- this->fadeouttimer_.stopTimer();
-
- this->initialAlpha_ = 1.0f;
- }
-
- void FadeoutText::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(FadeoutText, XMLPort, xmlelement, mode);
-
- XMLPortParam(FadeoutText, "delay", setDelay, getDelay, xmlelement, mode);
- XMLPortParam(FadeoutText, "fadeout", setFadeouttime, getFadeouttime, xmlelement, mode);
- }
-
- void FadeoutText::tick(float dt)
- {
- if (this->bFadingOut_)
- {
- ColourValue colour = this->getColour();
-
- if (colour.a > 0)
- {
- float alpha = colour.a;
-
- alpha -= dt / this->fadeouttime_;
- if (alpha < 0)
- alpha = 0;
- colour.a = alpha;
-
- this->text_->setColour(colour);
- }
- else
- {
- this->text_->setCaption("");
- this->reset();
- }
- }
- }
-
- void FadeoutText::fadeout()
- {
- this->bFadingOut_ = true;
- }
-
- void FadeoutText::reset()
- {
- this->bFadingOut_ = false;
-
- ColourValue colour = this->getColour();
- colour.a = this->initialAlpha_;
- this->text_->setColour(colour);
- }
-
- void FadeoutText::changedColour()
- {
- OverlayText::changedColour();
-
- this->initialAlpha_ = this->getColour().a;
- }
-
- void FadeoutText::changedCaption()
- {
- OverlayText::changedCaption();
-
- this->reset();
- this->fadeouttimer_.setInterval(this->delay_);
- this->fadeouttimer_.startTimer();
- }
-}
Deleted: code/branches/libraries2/src/orxonox/overlays/FadeoutText.h
===================================================================
--- code/branches/libraries2/src/orxonox/overlays/FadeoutText.h 2009-08-31 14:45:12 UTC (rev 5719)
+++ code/branches/libraries2/src/orxonox/overlays/FadeoutText.h 2009-08-31 15:03:29 UTC (rev 5720)
@@ -1,75 +0,0 @@
-/*
- * 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:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _FadeoutText_H__
-#define _FadeoutText_H__
-
-#include "overlays/OverlaysPrereqs.h"
-
-#include "tools/Timer.h"
-#include "tools/interfaces/Tickable.h"
-#include "overlays/OverlayText.h"
-
-namespace orxonox
-{
- class _OverlaysExport FadeoutText : public OverlayText, public Tickable
- {
- public:
- FadeoutText(BaseObject* creator);
- virtual ~FadeoutText() {}
-
- virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
- virtual void tick(float dt);
-
- inline void setDelay(float delay)
- { this->delay_ = delay; }
- inline float getDelay() const
- { return this->delay_; }
-
- inline void setFadeouttime(float fadeouttime)
- { this->fadeouttime_ = fadeouttime; }
- inline float getFadeouttime() const
- { return this->fadeouttime_; }
-
- private:
- virtual void changedColour();
- virtual void changedCaption();
-
- void fadeout();
- void reset();
-
- float delay_;
- float fadeouttime_;
-
- bool bFadingOut_;
- Timer<FadeoutText> fadeouttimer_;
-
- float initialAlpha_;
- };
-}
-#endif /* _FadeoutText_H__ */
Deleted: code/branches/libraries2/src/orxonox/overlays/GUIOverlay.cc
===================================================================
--- code/branches/libraries2/src/orxonox/overlays/GUIOverlay.cc 2009-08-31 14:45:12 UTC (rev 5719)
+++ code/branches/libraries2/src/orxonox/overlays/GUIOverlay.cc 2009-08-31 15:03:29 UTC (rev 5720)
@@ -1,87 +0,0 @@
-/*
- * 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 <string>
-#include <sstream>
-
-#include "core/input/InputManager.h"
-#include "core/CoreIncludes.h"
-#include "core/GUIManager.h"
-#include "core/XMLPort.h"
-#include "objects/infos/PlayerInfo.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())
- {
- std::string str;
- std::stringstream out;
- out << reinterpret_cast<long>(this);
- str = out.str();
- GUIManager::getInstance().executeCode("showCursor()");
- InputManager::getInstance().enterState("guiMouseOnly");
- GUIManager::getInstance().executeCode("showGUI(\"" + this->guiName_ + "\", " + str + ")");
- }
- else
- {
- GUIManager::getInstance().executeCode("hideGUI(\"" + this->guiName_ + "\")");
- GUIManager::getInstance().executeCode("hideCursor()");
- InputManager::getInstance().leaveState("guiMouseOnly");
- }
- }
-
- void GUIOverlay::setGUIName(const std::string& name)
- {
- this->guiName_ = name;
- GUIManager::getInstance().setPlayer(name, orxonox_cast<PlayerInfo*>(this->getOwner()));
- }
-}
Deleted: code/branches/libraries2/src/orxonox/overlays/GUIOverlay.h
===================================================================
--- code/branches/libraries2/src/orxonox/overlays/GUIOverlay.h 2009-08-31 14:45:12 UTC (rev 5719)
+++ code/branches/libraries2/src/orxonox/overlays/GUIOverlay.h 2009-08-31 15:03:29 UTC (rev 5720)
@@ -1,58 +0,0 @@
-/*
- * 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 "overlays/OverlaysPrereqs.h"
-
-#include <string>
-#include "OrxonoxOverlay.h"
-
-namespace orxonox
-{
- class _OverlaysExport GUIOverlay : public OrxonoxOverlay
- {
- public:
-
- GUIOverlay(BaseObject* creator);
- virtual ~GUIOverlay();
-
- virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
-
- void setGUIName(const std::string& name);
- inline const std::string& getGUIName() const { return this->guiName_; }
-
- virtual void changedVisibility();
-
- private:
- std::string guiName_;
- };
-}
-
-#endif
Deleted: code/branches/libraries2/src/orxonox/overlays/OverlayText.cc
===================================================================
--- code/branches/libraries2/src/orxonox/overlays/OverlayText.cc 2009-08-31 14:45:12 UTC (rev 5719)
+++ code/branches/libraries2/src/orxonox/overlays/OverlayText.cc 2009-08-31 15:03:29 UTC (rev 5720)
@@ -1,170 +0,0 @@
-/*
- * 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:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-#include "OverlayText.h"
-
-#include <OgreOverlayManager.h>
-#include <OgrePanelOverlayElement.h>
-#include <OgreTextAreaOverlayElement.h>
-#include <boost/static_assert.hpp>
-
-#include "util/StringUtils.h"
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-
-
-namespace orxonox
-{
- CreateFactory(OverlayText);
-
- BOOST_STATIC_ASSERT((int)Ogre::TextAreaOverlayElement::Left == (int)OverlayText::Left);
- BOOST_STATIC_ASSERT((int)Ogre::TextAreaOverlayElement::Center == (int)OverlayText::Center);
- BOOST_STATIC_ASSERT((int)Ogre::TextAreaOverlayElement::Right == (int)OverlayText::Right);
-
- OverlayText::OverlayText(BaseObject* creator)
- : OrxonoxOverlay(creator)
- {
- RegisterObject(OverlayText);
-
- this->text_ = static_cast<Ogre::TextAreaOverlayElement*>(Ogre::OverlayManager::getSingleton()
- .createOverlayElement("TextArea", "OverlayText_text_" + getUniqueNumberString()));
- this->text_->setCharHeight(1.0);
-
- this->setFont("Monofur");
- this->setColour(ColourValue(1.0, 1.0, 1.0, 1.0));
- this->setCaption("");
- this->setTextSize(1.0f);
- this->setAlignmentString("left");
-
- this->background_->addChild(this->text_);
- }
-
- OverlayText::~OverlayText()
- {
- if (this->isInitialized())
- Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->text_);
- }
-
- void OverlayText::XMLPort(Element& xmlElement, XMLPort::Mode mode)
- {
- SUPER(OverlayText, XMLPort, xmlElement, mode);
-
- XMLPortParam(OverlayText, "font", setFont, getFont, xmlElement, mode);
- XMLPortParam(OverlayText, "colour", setColour, getColour, xmlElement, mode);
- XMLPortParam(OverlayText, "caption", setCaption, getCaption, xmlElement, mode);
- XMLPortParam(OverlayText, "textsize", setTextSize, getTextSize, xmlElement, mode);
- XMLPortParam(OverlayText, "align", setAlignmentString, getAlignmentString, xmlElement, mode);
- XMLPortParam(OverlayText, "spacewidth", setSpaceWidth, getSpaceWidth, xmlElement, mode);
- }
-
- void OverlayText::setAlignmentString(const std::string& alignment)
- {
- if (alignment == "right")
- this->setAlignment(OverlayText::Right);
- else if (alignment == "center")
- this->setAlignment(OverlayText::Center);
- else // "left" and default
- this->setAlignment(OverlayText::Left);
- }
-
- std::string OverlayText::getAlignmentString() const
- {
- Ogre::TextAreaOverlayElement::Alignment alignment = this->text_->getAlignment();
-
- switch (alignment)
- {
- case Ogre::TextAreaOverlayElement::Right:
- return "right";
- case Ogre::TextAreaOverlayElement::Center:
- return "center";
- case Ogre::TextAreaOverlayElement::Left:
- return "left";
- default:
- assert(false); return "";
- }
- }
-
- void OverlayText::sizeChanged()
- {
- if (this->rotState_ == Horizontal)
- this->overlay_->setScale(size_.y * sizeCorrection_.y, size_.y * sizeCorrection_.y);
- else if (this->rotState_ == Vertical)
- this->overlay_->setScale(size_.y / (sizeCorrection_.y * sizeCorrection_.y), size_.y * sizeCorrection_.y);
- else
- this->overlay_->setScale(size_.y, size_.y);
-
- positionChanged();
- }
-
- void OverlayText::setCaption(const std::string& caption)
- {
- this->text_->setCaption(caption);
- this->changedCaption();
- }
- std::string OverlayText::getCaption() const
- {
- return this->text_->getCaption();
- }
-
- void OverlayText::setFont(const std::string& font)
- {
- if (font != "")
- this->text_->setFontName(font);
- }
- const std::string& OverlayText::getFont() const
- {
- return this->text_->getFontName();
- }
-
- void OverlayText::setSpaceWidth(float width)
- {
- this->text_->setSpaceWidth(width);
- }
- float OverlayText::getSpaceWidth() const
- {
- return this->text_->getSpaceWidth();
- }
-
- void OverlayText::setColour(const ColourValue& colour)
- {
- this->text_->setColour(colour); this->changedColour();
- }
- const ColourValue& OverlayText::getColour() const
- {
- return this->text_->getColour();
- }
-
- void OverlayText::setAlignment(OverlayText::Alignment alignment)
- {
- this->text_->setAlignment(static_cast<Ogre::TextAreaOverlayElement::Alignment>(alignment));
- }
- OverlayText::Alignment OverlayText::getAlignment() const
- {
- return static_cast<OverlayText::Alignment>(this->text_->getAlignment());
- }
-}
Deleted: code/branches/libraries2/src/orxonox/overlays/OverlayText.h
===================================================================
--- code/branches/libraries2/src/orxonox/overlays/OverlayText.h 2009-08-31 14:45:12 UTC (rev 5719)
+++ code/branches/libraries2/src/orxonox/overlays/OverlayText.h 2009-08-31 15:03:29 UTC (rev 5720)
@@ -1,85 +0,0 @@
-/*
- * 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:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _OverlayText_H__
-#define _OverlayText_H__
-
-#include "overlays/OverlaysPrereqs.h"
-
-#include <string>
-#include "util/Math.h"
-#include "util/OgreForwardRefs.h"
-#include "OrxonoxOverlay.h"
-
-namespace orxonox
-{
- class _OverlaysExport OverlayText : public OrxonoxOverlay
- {
- public:
- enum Alignment
- {
- Left,
- Right,
- Center
- };
-
- OverlayText(BaseObject* creator);
- virtual ~OverlayText();
-
- virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
-
- void setCaption(const std::string& caption);
- std::string getCaption() const;
-
- void setFont(const std::string& font);
- const std::string& getFont() const;
-
- void setSpaceWidth(float width);
- float getSpaceWidth() const;
-
- void setColour(const ColourValue& colour);
- const ColourValue& getColour() const;
-
- void setAlignment(OverlayText::Alignment alignment);
- OverlayText::Alignment getAlignment() const;
-
- void setAlignmentString(const std::string& alignment);
- std::string getAlignmentString() const;
-
- inline void setTextSize(float size) { this->setSize(Vector2(size, size)); }
- inline float getTextSize() const { return this->getSize().y; }
-
- protected:
- virtual void sizeChanged();
- virtual void changedColour() {}
- virtual void changedCaption() {}
-
- Ogre::TextAreaOverlayElement* text_;
- };
-}
-#endif /* _OverlayText_H__ */
Deleted: code/branches/libraries2/src/orxonox/overlays/OverlaysPrereqs.h
===================================================================
--- code/branches/libraries2/src/orxonox/overlays/OverlaysPrereqs.h 2009-08-31 14:45:12 UTC (rev 5719)
+++ code/branches/libraries2/src/orxonox/overlays/OverlaysPrereqs.h 2009-08-31 15:03:29 UTC (rev 5720)
@@ -1,88 +0,0 @@
-/*
- * 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:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @brief Contains all the necessary forward declarations for all classes and structs.
-*/
-
-#ifndef _OverlaysPrereqs_H__
-#define _OverlaysPrereqs_H__
-
-#include "OrxonoxConfig.h"
-
-//-----------------------------------------------------------------------
-// Shared library settings
-//-----------------------------------------------------------------------
-#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(ORXONOX_STATIC_BUILD)
-# ifdef OVERLAYS_SHARED_BUILD
-# define _OverlaysExport __declspec(dllexport)
-# else
-# if defined( __MINGW32__ )
-# define _OverlaysExport
-# else
-# define _OverlaysExport __declspec(dllimport)
-# endif
-# endif
-#elif defined ( ORXONOX_GCC_VISIBILITY )
-# define _OverlaysExport __attribute__ ((visibility("default")))
-#else
-# define _OverlaysExport
-#endif
-
-//-----------------------------------------------------------------------
-// Forward declarations
-//-----------------------------------------------------------------------
-
-namespace orxonox
-{
- class BarColour;
- class DebugFPSText;
- class DebugRTRText;
- class GUIOverlay;
- class HUDBar;
- class HUDNavigation;
- class HUDRadar;
- class HUDSpeedBar;
- class HUDHealthBar;
- class HUDTimer;
- class OrxonoxOverlay;
- class OverlayGroup;
- class OverlayText;
- class FadeoutText;
- class GametypeStatus;
- class AnnounceMessage;
- class KillMessage;
- class DeathMessage;
-
- class CreateLines;
- class Scoreboard;
- class Stats;
-}
-
-#endif /* _OverlaysPrereqs_H__ */
Modified: code/branches/libraries2/src/orxonox/sound/SoundBase.cc
===================================================================
--- code/branches/libraries2/src/orxonox/sound/SoundBase.cc 2009-08-31 14:45:12 UTC (rev 5719)
+++ code/branches/libraries2/src/orxonox/sound/SoundBase.cc 2009-08-31 15:03:29 UTC (rev 5720)
@@ -36,10 +36,10 @@
#include "util/Math.h"
#include "core/Core.h"
#include "core/Resource.h"
-#include "orxonox/objects/worldentities/WorldEntity.h"
+#include "objects/worldentities/WorldEntity.h"
#include "SoundManager.h"
-namespace orxonox
+namespace orxonox
{
SoundBase::SoundBase(WorldEntity* entity)
{
Modified: code/branches/libraries2/src/orxonox/sound/SoundManager.cc
===================================================================
--- code/branches/libraries2/src/orxonox/sound/SoundManager.cc 2009-08-31 14:45:12 UTC (rev 5719)
+++ code/branches/libraries2/src/orxonox/sound/SoundManager.cc 2009-08-31 15:03:29 UTC (rev 5720)
@@ -31,8 +31,8 @@
#include <AL/alut.h>
#include "util/Math.h"
-#include "orxonox/CameraManager.h"
-#include "orxonox/objects/worldentities/Camera.h"
+#include "CameraManager.h"
+#include "objects/worldentities/Camera.h"
#include "SoundBase.h"
namespace orxonox
@@ -145,7 +145,7 @@
Vector3 up = orient.xAxis(); // just a wild guess
Vector3 at = orient.zAxis();
- ALfloat orientation[6] = { at.x, at.y, at.z,
+ ALfloat orientation[6] = { at.x, at.y, at.z,
up.x, up.y, up.z };
alListenerfv(AL_POSITION, orientation);
@@ -157,7 +157,7 @@
for(std::list<SoundBase*>::iterator i = this->soundlist_.begin(); i != this->soundlist_.end(); i++)
(*i)->update();
}
-
+
/**
* Check if sound is available
*/
More information about the Orxonox-commit
mailing list