00001 00017 #ifndef APPLICATION_H 00018 #define APPLICATION_H 00019 00020 #include <boost/shared_ptr.hpp> 00021 #include "RenderSystem.h" 00022 00023 namespace green 00024 { 00032 class Application 00033 { 00034 protected: 00035 RenderSystemPtr mRenderSystem; 00036 00037 public: 00038 virtual ~Application() {} 00039 00050 virtual void Init() {} 00051 00053 virtual void display() {} 00054 00059 virtual void reshape(int width, int height) { 00060 mRenderSystem->Reshape(width, height); 00061 } 00062 00068 virtual void motion(int x, int y) {} 00069 00073 enum MouseButton { LEFT_BUTTON, MIDDLE_BUTTON, RIGHT_BUTTON }; 00074 00076 enum MouseState {UP, DOWN}; 00077 00086 virtual void mouse(MouseButton button, MouseState state, int x, int y) {} 00087 00094 virtual void keyboard(unsigned char ch, int x, int y) {} 00095 00102 virtual void keyboard_up(unsigned char ch, int x, int y) {} 00103 00108 inline 00109 virtual void SetRenderSystem(RenderSystemPtr renderSystem) { 00110 CHECK_SHARED(renderSystem); 00111 mRenderSystem = renderSystem; 00112 } 00113 00114 }; 00115 typedef boost::shared_ptr<Application> ApplicationPtr; 00116 } 00117 00118 #endif