[Orxonox-commit 4439] r9110 - code/branches/newlevel2012/src/modules/towerdefense
mentzerf at orxonox.net
mentzerf at orxonox.net
Fri Apr 20 16:45:47 CEST 2012
Author: mentzerf
Date: 2012-04-20 16:45:46 +0200 (Fri, 20 Apr 2012)
New Revision: 9110
Added:
code/branches/newlevel2012/src/modules/towerdefense/CMakeLists.txt
code/branches/newlevel2012/src/modules/towerdefense/TowerDefenseCenterpoint.cc
code/branches/newlevel2012/src/modules/towerdefense/TowerDefenseCenterpoint.h
code/branches/newlevel2012/src/modules/towerdefense/TowerDefensePrereqs.cc
Log:
+ Added CMakeLists.txt
+ Added basic centerpoint class
Added: code/branches/newlevel2012/src/modules/towerdefense/CMakeLists.txt
===================================================================
--- code/branches/newlevel2012/src/modules/towerdefense/CMakeLists.txt (rev 0)
+++ code/branches/newlevel2012/src/modules/towerdefense/CMakeLists.txt 2012-04-20 14:45:46 UTC (rev 9110)
@@ -0,0 +1,12 @@
+SET_SOURCE_FILES(TOWERDEFENSE_SRC_FILES
+ TowerDefenseCenterpoint.cc
+ TowerDefense.cc
+)
+
+ORXONOX_ADD_LIBRARY(TowerDefense
+ MODULE
+ FIND_HEADER_FILES
+ LINK_LIBRARIES
+ orxonox
+ SOURCE_FILES ${TOWERDEFENSE_SRC_FILES}
+)
Added: code/branches/newlevel2012/src/modules/towerdefense/TowerDefenseCenterpoint.cc
===================================================================
--- code/branches/newlevel2012/src/modules/towerdefense/TowerDefenseCenterpoint.cc (rev 0)
+++ code/branches/newlevel2012/src/modules/towerdefense/TowerDefenseCenterpoint.cc 2012-04-20 14:45:46 UTC (rev 9110)
@@ -0,0 +1,97 @@
+/*
+ * 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:
+ * ...
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file TowerDefenseCenterpoint.cc
+ @brief Implementation of the TowerDefenseCenterpoint class.
+*/
+
+#include "TowerDefenseCenterpoint.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "TowerDefense.h"
+
+namespace orxonox
+{
+ CreateFactory(TowerDefenseCenterpoint);
+
+ /**
+ @brief
+ Constructor. Registers and initializes the object and checks whether the gametype is actually TowerDefense.
+ */
+ TowerDefenseCenterpoint::TowerDefenseCenterpoint(BaseObject* creator) : StaticEntity(creator)
+ {
+ RegisterObject(TowerDefenseCenterpoint);
+
+ this->width_ = 10;
+ this->height_ = 11;
+ this->stoneTemplate_ = "";
+
+ this->checkGametype();
+ }
+
+ /**
+ @brief
+ Method to create a TowerDefenseCenterpoint through XML.
+ */
+ void TowerDefenseCenterpoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(TowerDefenseCenterpoint, XMLPort, xmlelement, mode);
+
+ XMLPortParam(TowerDefenseCenterpoint, "width", setWidth, getWidth, xmlelement, mode); // die Breite
+ XMLPortParam(TowerDefenseCenterpoint, "height", setHeight, setWidth, xmlelement, mode); // die Grösse
+ XMLPortParam(TowerDefenseCenterpoint, "stoneTemplate", setStoneTemplate, getStoneTemplate, xmlelement, mode);
+ }
+
+ /**
+ @brief
+ Is called when the gametype has changed.
+ */
+ void TowerDefenseCenterpoint::changedGametype()
+ {
+ SUPER(TowerDefenseCenterpoint, changedGametype);
+
+ // Check, whether it's still TowerDefense.
+ this->checkGametype();
+ }
+
+ /**
+ @brief
+ Checks whether the gametype is TowerDefense and if it is, sets its centerpoint.
+ */
+ void TowerDefenseCenterpoint::checkGametype()
+ {
+ if (this->getGametype() != NULL && this->getGametype()->isA(Class(TowerDefense)))
+ {
+ TowerDefense* TowerDefenseGametype = orxonox_cast<TowerDefense*>(this->getGametype().get());
+ TowerDefenseGametype->setCenterpoint(this);
+ }
+ }
+}
Added: code/branches/newlevel2012/src/modules/towerdefense/TowerDefenseCenterpoint.h
===================================================================
--- code/branches/newlevel2012/src/modules/towerdefense/TowerDefenseCenterpoint.h (rev 0)
+++ code/branches/newlevel2012/src/modules/towerdefense/TowerDefenseCenterpoint.h 2012-04-20 14:45:46 UTC (rev 9110)
@@ -0,0 +1,121 @@
+/*
+ * 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:
+ * ...
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file TowerDefenseCenterpoint.h
+ @brief Declaration of the TowerDefenseCenterpoint class.
+ @ingroup TowerDefense
+*/
+
+#ifndef _TowerDefenseCenterpoint_H__
+#define _TowerDefenseCenterpoint_H__
+
+#include "TowerDefense/TowerDefensePrereqs.h"
+
+#include <string>
+
+#include <util/Math.h>
+
+#include "worldentities/StaticEntity.h"
+
+namespace orxonox
+{
+
+ /**
+ @brief
+
+
+ @author
+
+ @ingroup TowerDefense
+ */
+ class _TowerDefenseExport TowerDefenseCenterpoint : public StaticEntity
+ {
+ public:
+ TowerDefenseCenterpoint(BaseObject* creator); //!< Constructor. Registers and initializes the object and checks whether the gametype is actually TowerDefense.
+ virtual ~TowerDefenseCenterpoint() {}
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method to create a TowerDefenseCenterpoint through XML.
+
+ virtual void changedGametype(); //!< Is called when the gametype has changed.
+
+ /**
+ @brief Set the width of the playing field.
+ @param width The width in number of tiles.
+ */
+ void setWidth(unsigned int width)
+ { this->width_ = width; }
+ /**
+ @brief Get the width of the playing field.
+ @return Returns the width in number of tiles.
+ */
+ unsigned int getWidth(void) const
+ { return this->width_; }
+
+ /**
+ @brief Set the height of the playing field.
+ @param height The height in number of tiles.
+ */
+ void setHeight(unsigned int height)
+ { this->height_ = height; }
+ /**
+ @brief Get the height of the playing field.
+ @return Returns the height in number of tiles.
+ */
+ unsigned int getHeight(void) const
+ { return this->height_; }
+
+ /**
+
+
+ /**
+ * TODO; Replace stone with tower
+ @brief Set the template for the stones.
+ @param template The template name to be applied to each stone.
+ */
+ //void setStoneTemplate(const std::string& templateName)
+ // { this->stoneTemplate_ = templateName; }
+ /**
+ @brief Get the template for the stones.
+ @return Returns the template name to be applied to each stone.
+ */
+ //const std::string& getStoneTemplate(void) const
+ // { return this->stoneTemplate_; }
+
+
+ private:
+ void checkGametype(); //!< Checks whether the gametype is TowerDefense and if it is, sets its centerpoint.
+
+ unsigned int width_;
+ unsigned int height_;
+ //std::string stoneTemplate_;
+
+ };
+}
+
+#endif /* _TowerDefenseCenterpoint_H__ */
Added: code/branches/newlevel2012/src/modules/towerdefense/TowerDefensePrereqs.cc
===================================================================
--- code/branches/newlevel2012/src/modules/towerdefense/TowerDefensePrereqs.cc (rev 0)
+++ code/branches/newlevel2012/src/modules/towerdefense/TowerDefensePrereqs.cc 2012-04-20 14:45:46 UTC (rev 9110)
@@ -0,0 +1,71 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+/**
+ at file
+ at brief
+ Shared library macros, enums, constants and forward declarations for the TowerDefense module
+*/
+
+#ifndef _TowerDefensePrereqs_H__
+#define _TowerDefensePrereqs_H__
+
+#include "OrxonoxConfig.h"
+#include "OrxonoxPrereqs.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(TowerDefense_STATIC_BUILD)
+# ifdef TowerDefense_SHARED_BUILD
+# define _TowerDefenseExport __declspec(dllexport)
+# else
+# if defined( __MINGW32__ )
+# define _TowerDefenseExport
+# else
+# define _TowerDefenseExport __declspec(dllimport)
+# endif
+# endif
+#elif defined ( ORXONOX_GCC_VISIBILITY )
+# define _TowerDefenseExport __attribute__ ((visibility("default")))
+#else
+# define _TowerDefenseExport
+#endif
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+ class TowerDefense;
+ class TowerDefenseCenterpoint;
+}
+
+#endif /* _TowerDefensePrereqs_H__ */
More information about the Orxonox-commit
mailing list