Blender V2.61 - r43446
|
00001 00028 #include "GlutMouseManager.h" 00029 #include "MT_assert.h" 00030 00031 MEM_SmartPtr<GlutMouseManager> GlutMouseManager::m_s_instance = MEM_SmartPtr<GlutMouseManager>(); 00032 00033 00034 GlutMouseManager * 00035 GlutMouseManager:: 00036 Instance( 00037 ){ 00038 if (m_s_instance == NULL) { 00039 m_s_instance = new GlutMouseManager(); 00040 } 00041 00042 return m_s_instance; 00043 } 00044 00045 // these are the functions you should pass to GLUT 00046 00047 void 00048 GlutMouseManager:: 00049 Mouse( 00050 int button, 00051 int state, 00052 int x, 00053 int y 00054 ){ 00055 GlutMouseManager *manager = GlutMouseManager::Instance(); 00056 00057 if (manager->m_handler != NULL) { 00058 manager->m_handler->Mouse(button,state,x,y); 00059 } 00060 } 00061 00062 void 00063 GlutMouseManager:: 00064 Motion( 00065 int x, 00066 int y 00067 ){ 00068 GlutMouseManager *manager = GlutMouseManager::Instance(); 00069 00070 if (manager->m_handler != NULL) { 00071 manager->m_handler->Motion(x,y); 00072 } 00073 } 00074 00075 void 00076 GlutMouseManager:: 00077 InstallHandler( 00078 GlutMouseHandler *handler 00079 ){ 00080 00081 MT_assert(m_handler == NULL); 00082 m_handler = handler; 00083 } 00084 00085 void 00086 GlutMouseManager:: 00087 ReleaseHandler( 00088 ){ 00089 m_handler = NULL; 00090 } 00091 00092 GlutMouseManager:: 00093 ~GlutMouseManager( 00094 ){ 00095 00096 delete(m_handler); 00097 } 00098 00099