Split resource groups into KKEngine (always loaded first) and CoinGame.
Split resource groups into KKEngine (always loaded first) and CoinGame.
Added a CoinGame debug HUD. Added a score (static for now) to the game.

file:a/App.cpp -> file:b/App.cpp
--- a/App.cpp
+++ b/App.cpp
@@ -55,7 +55,6 @@
 bool App::initialize()
 {
   _pluginsCfg="plugins.cfg";
-  _resourcesCfg="resources.cfg";
   _root=new Ogre::Root(_pluginsCfg);
 
   // Configure rendering
@@ -66,26 +65,12 @@
 
   _window=_root->initialise(true,"OGRE Render Window");
 
-  // Setup resources
-  Ogre::ConfigFile cf;
-  cf.load(_resourcesCfg);
-
-  Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
-  Ogre::String secName, typeName, archName;
-  while(seci.hasMoreElements())
-    {
-      secName=seci.peekNextKey();
-      Ogre::ConfigFile::SettingsMultiMap *settings=seci.getNext();
-      Ogre::ConfigFile::SettingsMultiMap::iterator i;
-      for(i=settings->begin();i!=settings->end();++i)
-	{
-	  typeName=i->first;
-	  archName=i->second;
-	  Ogre::ResourceGroupManager::getSingleton().addResourceLocation(archName,typeName,secName);
-	}
-    }
-
   Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
+
+  loadResourcesFromConfigFile("kkengine.cfg");
+  loadResourcesFromConfigFile("resources.cfg");
+
+  Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("KKEngine");
   Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
 
   /// Setup inputs
@@ -227,6 +212,29 @@
 void App::addDebugHUD(DebugHUD *hud)
 {
   _debugHUDs.push_back(hud);
+}
+
+void App::loadResourcesFromConfigFile(Ogre::String configFile)
+{
+    // Setup resources
+  Ogre::ConfigFile cf;
+  cf.load(configFile);
+
+  Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
+  Ogre::String secName, typeName, archName;
+  while(seci.hasMoreElements())
+    {
+      secName=seci.peekNextKey();
+      Ogre::ConfigFile::SettingsMultiMap *settings=seci.getNext();
+      Ogre::ConfigFile::SettingsMultiMap::iterator i;
+      for(i=settings->begin();i!=settings->end();++i)
+	{
+	  typeName=i->first;
+	  archName=i->second;
+	  Ogre::ResourceGroupManager::getSingleton().addResourceLocation(archName,typeName,secName);
+	}
+    }
+
 }
 
 bool App::keyPressed(const OIS::KeyEvent &e)

file:a/App.h -> file:b/App.h
--- a/App.h
+++ b/App.h
@@ -37,8 +37,9 @@
   virtual bool initialize();
   virtual void setupScene();
 
+  void loadResourcesFromConfigFile(Ogre::String configFile);
+
   void addDebugHUD(DebugHUD *hud);
-
   bool showDebug();
 
   /// OIS Inputs

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,6 +16,7 @@
   DebugHUD.cpp
   DebugMain.cpp
   DebugBullet.cpp
+  DebugCoinGame.cpp
   DotSceneLoader.cpp
   DotSceneSubloader.cpp
   DotScene.cpp
@@ -28,12 +29,14 @@
 
 SET(DATAS
   plugins.cfg
+  kkengine.cfg
   resources.cfg
-  media/debug.overlay
-  media/debugmain.overlay
-  media/debugbullet.overlay
-  media/fonts/DebugFont.fontdef
-  media/fonts/times.ttf
+  media/kkengine/overlays/debug.overlay
+  media/kkengine/overlays/debugmain.overlay
+  media/kkengine/overlays/debugbullet.overlay
+  media/kkengine/fonts/DebugFont.fontdef
+  media/kkengine/fonts/times.ttf
+  media/overlays/debugcoingame.overlay
   media/base/base.scene
   media/base/Ground.mesh
   media/base/Building.mesh

--- a/CoinGame.cpp
+++ b/CoinGame.cpp
@@ -2,9 +2,11 @@
 
 #include "DotSceneLoader.h"
 #include "DotSceneBulletSubloader.h"
+#include "DebugCoinGame.h"
 
 CoinGame::CoinGame()
   : BulletApp(),
+    _score(100),
     _updateTime(0),
     _piston(0),
     _pointTrigger(0),
@@ -17,6 +19,21 @@
       iter!=_coins.end();
       iter++)
     delete *iter;
+}
+
+int CoinGame::score()
+{
+  return _score;
+}
+
+bool CoinGame::initialize()
+{
+  if(!BulletApp::initialize())
+    return false;
+
+  loadResourcesFromConfigFile("resources.cfg");
+  addDebugHUD(new DebugCoinGame(this));
+  return true;
 }
 
 void CoinGame::setupScene()

file:a/CoinGame.h -> file:b/CoinGame.h
--- a/CoinGame.h
+++ b/CoinGame.h
@@ -12,7 +12,10 @@
   CoinGame();
   ~CoinGame();
 
+  int score();
+
 protected:
+  virtual bool initialize();
   void setupScene();
 
   bool keyReleased(const OIS::KeyEvent &e);
@@ -24,6 +27,8 @@
   void createBase();
   void createCoinField();
   void dropCoin(Ogre::Vector3 pos);
+
+  int _score;
 
   Ogre::Real _updateTime;
   std::vector<Coin*> _coins;

file:b/DebugCoinGame.cpp (new)
--- /dev/null
+++ b/DebugCoinGame.cpp
@@ -1,1 +1,25 @@
+#include "DebugCoinGame.h"
 
+#include <OgreOverlayManager.h>
+#include <OgreOverlayContainer.h>
+#include <OgreStringConverter.h>
+
+#include <proc/readproc.h>
+
+DebugCoinGame::DebugCoinGame(CoinGame *coinGame)
+  : DebugHUD("CoinGame"),_coinGame(coinGame)
+{ 
+  _scoreDebug=Ogre::OverlayManager::getSingletonPtr()->getOverlayElement("Debug/CoinGame/Score");
+}
+
+void DebugCoinGame::update()
+{
+  DebugHUD::update();
+
+  // FPS
+  Ogre::Real score=_coinGame->score();
+  _scoreDebug->setCaption(Ogre::StringConverter::toString(score));
+
+}
+
+

file:b/DebugCoinGame.h (new)
--- /dev/null
+++ b/DebugCoinGame.h
@@ -1,1 +1,24 @@
+#ifndef DEBUGCOINGAME_H_
+#define DEBUGCOINGAME_H_
 
+#include <OgreRenderWindow.h>
+#include <OgreOverlayElement.h>
+
+#include "DebugHUD.h"
+#include "CoinGame.h"
+
+class DebugCoinGame : public DebugHUD
+{
+public:
+  DebugCoinGame(CoinGame *coinGame);
+
+  void update();
+
+private:
+  CoinGame *_coinGame;
+
+  Ogre::OverlayElement *_scoreDebug;
+};
+
+#endif // DEBUGCOINGAME_H_
+

file:b/kkengine.cfg (new)
--- /dev/null
+++ b/kkengine.cfg
@@ -1,1 +1,4 @@
+[KKEngine]
+FileSystem=media/kkengine/overlays
+FileSystem=media/kkengine/fonts
 

file:a/media/debug.overlay (deleted)
--- a/media/debug.overlay
+++ /dev/null
@@ -1,13 +1,1 @@
-template element TextArea(Debug/Template/BasicText)
-{
-	metrics_mode pixels
-	font_name DebugFont
-	char_height 16
-}
 
-
-Debug
-{
-}
-
-

--- a/media/debugbullet.overlay
+++ /dev/null
@@ -1,64 +1,1 @@
-template container Panel(Bullet)
-{
-	metrics_mode pixels
-	left 0
-	top 30
-	width 100
-	height 100
 
-	element TextArea(Bullet/ObjectsLabel) : Debug/Template/BasicText
-	{
-		left 10
-		top 10
-		width 100
-		height 10
-		caption # Objects:
-	}
-
-	element TextArea(Bullet/Objects) : Debug/Template/BasicText
-	{
-		left 75
-		top 10
-		width 100
-		height 10
-		caption 100
-	}
-
-	element TextArea(Bullet/ActiveLabel) : Debug/Template/BasicText
-	{
-		left 10
-		top 25
-		width 100
-		height 10
-		caption # Active:
-	}
-
-	element TextArea(Bullet/Active) : Debug/Template/BasicText
-	{
-		left 75
-		top 25
-		width 100
-		height 10
-		caption 100
-	}
-
-	element TextArea(Bullet/SleepingLabel) : Debug/Template/BasicText
-	{
-		left 10
-		top 40
-		width 100
-		height 10
-		caption # Sleeping:
-	}
-
-	element TextArea(Bullet/Sleeping) : Debug/Template/BasicText
-	{
-		left 75
-		top 40
-		width 100
-		height 10
-		caption 100
-	}
-
-}
-

file:a/media/debugmain.overlay (deleted)
--- a/media/debugmain.overlay
+++ /dev/null
@@ -1,44 +1,1 @@
-template container Panel(TopBar)
-{
-	left 0
-	top 0
-	width 1
-	height 1
 
-	element TextArea(TopBar/FPSLabel) : Debug/Template/BasicText
-	{
-		left 10
-		top 10
-		width 100
-		height 10
-		caption FPS:
-	}
-
-	element TextArea(TopBar/FPS) : Debug/Template/BasicText
-	{
-		left 40
-		top 10
-		width 100
-		height 10
-		caption 100
-	}
-
-	element TextArea(TopBar/VMLabel) : Debug/Template/BasicText
-	{
-		left 100
-		top 10
-		width 100
-		height 10
-		caption Memory:
-	}
-
-	element TextArea(TopBar/VM) : Debug/Template/BasicText
-	{
-		left 150
-		top 10
-		width 100
-		height 10
-		caption 100
-	}
-}
-

--- a/media/fonts/DebugFont.fontdef
+++ /dev/null
@@ -1,8 +1,1 @@
-DebugFont
-{
-	type		truetype
-	source		times.ttf
-	size		16
-	resolution	72
-}
 

file:a/media/fonts/times.ttf (deleted)
Binary files a/media/fonts/times.ttf and /dev/null differ

--- /dev/null
+++ b/media/kkengine/fonts/DebugFont.fontdef
@@ -1,1 +1,8 @@
+DebugFont
+{
+	type		truetype
+	source		times.ttf
+	size		16
+	resolution	72
+}
 

Binary files /dev/null and b/media/kkengine/fonts/times.ttf differ

--- /dev/null
+++ b/media/kkengine/overlays/debug.overlay
@@ -1,1 +1,13 @@
+template element TextArea(Debug/Template/BasicText)
+{
+	metrics_mode pixels
+	font_name DebugFont
+	char_height 16
+}
 
+
+Debug
+{
+}
+
+

--- /dev/null
+++ b/media/kkengine/overlays/debugbullet.overlay
@@ -1,1 +1,64 @@
+template container Panel(Bullet)
+{
+	metrics_mode pixels
+	left 0
+	top 30
+	width 100
+	height 100
 
+	element TextArea(Bullet/ObjectsLabel) : Debug/Template/BasicText
+	{
+		left 10
+		top 10
+		width 100
+		height 10
+		caption # Objects:
+	}
+
+	element TextArea(Bullet/Objects) : Debug/Template/BasicText
+	{
+		left 75
+		top 10
+		width 100
+		height 10
+		caption 100
+	}
+
+	element TextArea(Bullet/ActiveLabel) : Debug/Template/BasicText
+	{
+		left 10
+		top 25
+		width 100
+		height 10
+		caption # Active:
+	}
+
+	element TextArea(Bullet/Active) : Debug/Template/BasicText
+	{
+		left 75
+		top 25
+		width 100
+		height 10
+		caption 100
+	}
+
+	element TextArea(Bullet/SleepingLabel) : Debug/Template/BasicText
+	{
+		left 10
+		top 40
+		width 100
+		height 10
+		caption # Sleeping:
+	}
+
+	element TextArea(Bullet/Sleeping) : Debug/Template/BasicText
+	{
+		left 75
+		top 40
+		width 100
+		height 10
+		caption 100
+	}
+
+}
+

--- /dev/null
+++ b/media/kkengine/overlays/debugmain.overlay
@@ -1,1 +1,44 @@
+template container Panel(TopBar)
+{
+	left 0
+	top 0
+	width 1
+	height 1
 
+	element TextArea(TopBar/FPSLabel) : Debug/Template/BasicText
+	{
+		left 10
+		top 10
+		width 100
+		height 10
+		caption FPS:
+	}
+
+	element TextArea(TopBar/FPS) : Debug/Template/BasicText
+	{
+		left 40
+		top 10
+		width 100
+		height 10
+		caption 100
+	}
+
+	element TextArea(TopBar/VMLabel) : Debug/Template/BasicText
+	{
+		left 100
+		top 10
+		width 100
+		height 10
+		caption Memory:
+	}
+
+	element TextArea(TopBar/VM) : Debug/Template/BasicText
+	{
+		left 150
+		top 10
+		width 100
+		height 10
+		caption 100
+	}
+}
+

--- /dev/null
+++ b/media/overlays/debugcoingame.overlay
@@ -1,1 +1,29 @@
+template container Panel(CoinGame)
+{
+	metrics_mode pixels
+	left 120
+	top 30
+	width 100
+	height 100
 
+	element TextArea(CoinGame/ScoreLabel) : Debug/Template/BasicText
+	{
+		left 10
+		top 10
+		width 100
+		height 10
+		caption Score:
+	}
+
+	element TextArea(CoinGame/Score) : Debug/Template/BasicText
+	{
+		left 50
+		top 10
+		width 100
+		height 10
+		caption 100
+	}
+
+
+}
+

--- a/resources.cfg
+++ b/resources.cfg
@@ -1,5 +1,8 @@
-[General]
-FileSystem=media/
+[KKEngine]
+FileSystem=media/kkengine
+FileSystem=media/kkengine/fonts
+
+[CoinGame]
+FileSystem=media/overlays
 FileSystem=media/models
-FileSystem=media/fonts
 FileSystem=media/base