Initial commit
Initial commit

file:b/App.cpp (new)
--- /dev/null
+++ b/App.cpp
@@ -1,1 +1,63 @@
+#include "App.h"
 
+App::App()
+  : _device(0)
+{}
+
+App::~App()
+{
+  _device->drop();
+}
+
+bool App::run()
+{
+  init();
+
+  while(_device->run())
+    {
+      // Render everything
+      _device->getVideoDriver()->beginScene(true,true,SColor(255,0,0,255));
+      _device->getSceneManager()->drawAll();
+      _device->getGUIEnvironment()->drawAll();
+      _device->getVideoDriver()->endScene();
+    }
+
+  return true;
+}
+
+void App::init()
+{
+  // Initialize Irrlicht
+  _device=createDevice(video::EDT_OPENGL,dimension2d<u32>(640,480),16,
+		       false,false,false,this);
+
+  _smgr=_device->getSceneManager();
+  _driver=_device->getVideoDriver();
+}
+
+bool App::OnEvent(const SEvent &event)
+{
+  switch(event.EventType)
+    {
+    case EET_KEY_INPUT_EVENT:
+      if(event.KeyInput.Key==KEY_ESCAPE && !event.KeyInput.PressedDown)
+	{
+	  _device->closeDevice();
+	  return true;
+	}
+    default:
+      break;
+    }
+
+  return false;
+}
+
+IrrlichtDevice* App::device()
+{ return _device; }
+
+ISceneManager* App::smgr()
+{ return _smgr; }
+
+IVideoDriver* App::driver()
+{ return _driver; }
+

file:b/App.h (new)
--- /dev/null
+++ b/App.h
@@ -1,1 +1,34 @@
+#ifndef APP_H_
+#define APP_H_
 
+#include <irrlicht.h>
+
+using namespace irr;
+using namespace irr::core;
+using namespace irr::video;
+using namespace irr::scene;
+
+class App : public IEventReceiver
+{
+public:
+  App();
+  ~App();
+
+  bool run();
+
+  bool OnEvent(const SEvent &event);
+
+protected:
+  virtual void init();
+  IrrlichtDevice* device();
+  ISceneManager* smgr();
+  IVideoDriver* driver();
+
+private:
+  IrrlichtDevice *_device;
+  ISceneManager *_smgr;
+  IVideoDriver *_driver;
+};
+
+#endif // APP_H_
+

file:b/Makefile (new)
--- /dev/null
+++ b/Makefile
@@ -1,1 +1,13 @@
+OBJS=../template/main.o ../template/App.o
+APP=template
 
+CFLAGS=-I/home/kkrizka/dev/irrlicht-svn/include/irrlicht -I../template
+CXXFLAGS=${CFLAGS}
+LDFLAGS= -g -lIrrlicht -L/home/kkrizka/dev/irrlicht-svn/lib
+
+all: ${OBJS}
+	g++ ${LDFLAGS} -o ${APP} ${OBJS}
+
+clean:
+	rm ${OBJS}
+	rm ${APP}

file:b/main.cpp (new)
--- /dev/null
+++ b/main.cpp
@@ -1,1 +1,9 @@
+#include "App.h"
 
+int main(int argc,char *argv[])
+{
+  App app;
+  
+  return app.run();
+}
+