Blender V2.61 - r43446

GlutKeyboardManager.cpp

Go to the documentation of this file.
00001 
00028 #include "GlutKeyboardManager.h"
00029 #include "MT_assert.h"
00030 
00031 MEM_SmartPtr<GlutKeyboardManager> GlutKeyboardManager::m_s_instance = MEM_SmartPtr<GlutKeyboardManager>();
00032 
00033     GlutKeyboardManager *
00034 GlutKeyboardManager::
00035 Instance(
00036 ){
00037     if (m_s_instance == NULL) {
00038         m_s_instance = new GlutKeyboardManager();
00039     }
00040 
00041     return m_s_instance;
00042 }
00043 
00044 
00045 // this is the function you should pass to glut
00046 
00047     void
00048 GlutKeyboardManager::
00049 HandleKeyboard(
00050     unsigned char key,
00051     int x,
00052     int y
00053 ){
00054     GlutKeyboardManager *manager = GlutKeyboardManager::Instance();
00055 
00056     if (manager->m_handler != NULL) {
00057         manager->m_handler->HandleKeyboard(key,x,y);
00058     }
00059 }
00060 
00061     void
00062 GlutKeyboardManager::
00063 InstallHandler(
00064     GlutKeyboardHandler * handler
00065 ){
00066 
00067     MT_assert(m_handler == NULL);
00068     m_handler = handler;
00069 }
00070 
00071     void
00072 GlutKeyboardManager::
00073 ReleaseHandler(
00074 ){
00075     m_handler = NULL;
00076 }
00077 
00078 
00079 GlutKeyboardManager::
00080 ~GlutKeyboardManager(
00081 ){
00082 
00083     delete(m_handler);
00084 }