Hit 'N' to reset the game.
Hit 'N' to reset the game.

file:a/Cursor.cpp -> file:b/Cursor.cpp
--- a/Cursor.cpp
+++ b/Cursor.cpp
@@ -18,6 +18,12 @@
 Ogre::Vector3 Cursor::position()
 {
   return _position;
+}
+
+void Cursor::setPosition(Ogre::Vector3 position)
+{
+  _cursorNode->setPosition(position*100);
+  _position=position;
 }
 
 Ogre::String Cursor::type()

file:a/Cursor.h -> file:b/Cursor.h
--- a/Cursor.h
+++ b/Cursor.h
@@ -11,6 +11,7 @@
   void move(Ogre::Vector3 dir);
 
   Ogre::Vector3 position();
+  void setPosition(Ogre::Vector3 position);
 
   Ogre::String type();
   void setType(Ogre::String type);

file:a/Marker.cpp -> file:b/Marker.cpp
--- a/Marker.cpp
+++ b/Marker.cpp
@@ -19,3 +19,9 @@
 
 Ogre::String Marker::type() { return _type; }
 
+void Marker::destroy()
+{
+  _sceneMngr->destroySceneNode(_markerNode);
+  _sceneMngr->destroyEntity(_markerEntity);
+}
+

file:a/Marker.h -> file:b/Marker.h
--- a/Marker.h
+++ b/Marker.h
@@ -9,6 +9,8 @@
   Marker(Ogre::SceneManager *sceneMngr,Ogre::Vector3 position,Ogre::String type);
 
   Ogre::String type();
+
+  void destroy();
 private:
   static int _count;
 

file:a/TTT.cpp -> file:b/TTT.cpp
--- a/TTT.cpp
+++ b/TTT.cpp
@@ -155,8 +155,41 @@
  
 bool TTT::keyReleased(const OIS::KeyEvent& evt)
 {
-  _cameraMan->injectKeyUp(evt);
+  switch(evt.key)
+    {
+    case OIS::KC_N:
+      newGame();
+      return true;
+      break;
+    default:
+      _cameraMan->injectKeyUp(evt);
+      break;
+    }
   return App::keyReleased(evt);
+}
+
+void TTT::newGame()
+{
+  // Remove existing markers
+  for(std::map<unsigned int,Marker * >::iterator iter=_markers.begin();
+      iter!=_markers.end();
+      iter++)
+    {
+      iter->second->destroy();
+      delete iter->second;
+    }
+  _markers.erase(_markers.begin(),_markers.end());
+
+  // Reset the score
+  _score["lemon"]=0;
+  _score["beer"]=0;
+
+  // Reset the cursor
+  _cursor->setPosition(Ogre::Vector3(0,0,0));
+  if(Ogre::Math::UnitRandom()<0.5)
+    _cursor->setType("lemon");
+  else
+    _cursor->setType("beer");
 }
 
 void TTT::place()

file:a/TTT.h -> file:b/TTT.h
--- a/TTT.h
+++ b/TTT.h
@@ -34,6 +34,7 @@
   void createGrid();
   void createCamera();
 
+  void newGame();
   void place();
 
   unsigned int codeforpos(int x);