Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Predefined entities moved into Graphic System from Utils class

  • Loading branch information...
commit 1cab311f8364447c1e25fcce99b6d079047b08ea 1 parent ca85a62
@Ockonal Ockonal authored
View
8 include/Core/Utils.hpp
@@ -22,7 +22,7 @@ using namespace boost::posix_time;
#define NEW_EVENT(Signature, Name) typedef SlotObject< signals2::signal<Signature> > Name;
// Check the location exists
-#define LOCATION(path) Utils::get_mutable_instance().checkLocation(path);
+#define LOCATION(path) Utils::get_mutable_instance().checkLocation(path)
#define utils (Utils::get_mutable_instance())
#define utilsConst (Utils::get_const_instance())
@@ -34,9 +34,6 @@ class Utils : public singleton<Utils>
string mDimension;
ptime mTimeStamp;
- // Default entities
- Ogre::Entity mError;
-
void createPlane(Ogre::Mesh *newMesh);
void createSphere(Ogre::Mesh *newMesh);
void createCube(Ogre::Mesh *newMesh);
@@ -55,9 +52,6 @@ class Utils : public singleton<Utils>
ptime getCurrentTime() const;
void writeTimestamp();
string getTimeDifference();
-
- // For default entities
- void configureEntities();
};
#endif
View
7 include/Systems/GraphicSystem.hpp
@@ -4,6 +4,7 @@
#include "System.hpp"
#include "Core/Types.hpp"
#include "Core/Singleton.hpp"
+#include "Core/Utils.hpp"
#include "Managers/LogManager.hpp"
#include "Managers/ConfigManager.hpp"
@@ -28,6 +29,9 @@ class GraphicSystem : public ISystem, public ISingleton<GraphicSystem>
Ogre::Viewport *mViewport;
Ogre::Camera *mCamera;
+ // For default entities
+ Ogre::Entity *mError;
+
public:
Ogre::Root *getRoot() const { return mRoot; }
Ogre::RenderWindow *getWindow() const { return mWindow; }
@@ -36,6 +40,9 @@ class GraphicSystem : public ISystem, public ISingleton<GraphicSystem>
Ogre:: Viewport *getViewport() const { return mViewport; }
Ogre::Camera *getCamera() const { return mCamera; }
+ // For default entities
+ void configureEntities();
+
GraphicSystem();
~GraphicSystem();
View
2  src/Core/GameApplication.cpp
@@ -48,7 +48,7 @@ void GameApplication::Start()
mRunning = true;
utils.setMediaPath(CONFIG("resources.MediaFolder", string, "Media"));
- utils.configureEntities();
+ graphicSystem.configureEntities();
SIGNAL(Engine::Events::GlobalInitEvent, "Inited", );
View
7 src/Core/Utils.cpp
@@ -50,13 +50,6 @@ string Utils::checkLocation(const string &path)
return path;
}
-void Utils::configureEntities()
-{
- // Error mesh
- string entMesh = LOCATION(utils.getMediaPath() + "/Engine/" + "Error.mesh");
- mError = graphicSystem.getSceneMgr()->createEntity("Engine:Error", entMesh);
-}
-
string Utils::getTimeDifference()
{
// If we don't call writeTimestamp before this function
View
7 src/Systems/GraphicSystem.cpp
@@ -109,6 +109,13 @@ void GraphicSystem::update(float elapsed)
// ...
}
+void GraphicSystem::configureEntities()
+{
+ // Error mesh
+ string entMesh = LOCATION(utils.getMediaPath() + "/Engine/" + "Error.mesh");
+ mError = getSceneMgr()->createEntity("Engine:Error", entMesh);
+}
+
std::string GraphicSystem::toString()
{
return "GraphicSystem";
Please sign in to comment.
Something went wrong with that request. Please try again.