TAPs 0.7.7.3
TAPsGLUTWindow.hpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsGLUTWindow.hpp
00003 
00004 Create and maintain OpenGL Window by GLUT.
00005 
00006 Derive a class (and override the functions) from this class for custom GLUT 
00007 window.
00008 
00009 SUKITTI PUNAK   (08/24/2005)
00010 UPDATE          (09/10/2010)
00011 ******************************************************************************/
00012 #ifndef TAPs_GLUT_WINDOW_HPP
00013 #define TAPs_GLUT_WINDOW_HPP
00014 
00015 #include "TAPsGLUTCallbackFns.hpp"
00016 
00017 BEGIN_NAMESPACE_TAPs__OpenGL
00018 //=============================================================================
00019 class GLUTWindow {
00020 //=============================================================================
00021 protected:
00022     std::string                 m_strTitle; // GLUT Display Title
00023     int                         m_iID;      // GLUT Display ID
00024     GLUTCallbackFns *           m_pGLUT;    // GLUT object pointer
00025     static int                  m_siID;     // static GLUT Display ID 
00026     static GLUTCallbackFns *    m_spGLUT;   // static GLUT object pointer
00027 //=============================================================================
00028 public:
00029     //-------------------------------------------------------------------------
00030     
00032     GLUTWindow ( std::string const title, GLUTCallbackFns * const pGLUT, 
00033                     int width = 256, int height = 256 );
00034     
00039     GLUTWindow ( std::string const title, int width = 256, int height = 256 );
00040 
00042     ~GLUTWindow ();
00043     
00044     //-------------------------------------------------------------------------
00045     // Set/Get Fns
00046     static int GetMainID () { return m_siID; }
00047     void SetGLUT ( GLUTCallbackFns * const pGLUT );
00048     GLUTCallbackFns * GetGLUTObject () const    { return m_pGLUT; }
00049     int GetID () const  { return m_iID; }
00050     //-------------------------------------------------------------------------
00051     virtual void Initialize () {}
00052     //-------------------------------------------------------------------------
00053     // GLUT Callback Fns
00054     static void Display ()
00055     {
00056         assert( m_spGLUT );
00057         m_spGLUT->DisplayFn();
00058     }
00059     static void Reshape (int width, int height)
00060     {
00061         assert( m_spGLUT );
00062         m_spGLUT->ReshapeFn( width, height );
00063     }
00064     static void Mouse ( int button, int state, int x, int y )
00065     {
00066         assert( m_spGLUT );
00067         m_spGLUT->MouseFn( button, state, x, y );
00068     }
00069     static void Motion ( int x, int y )
00070     {
00071         assert( m_spGLUT );
00072         m_spGLUT->MotionFn( x, y );
00073     }
00074     static void Keyboard ( unsigned char key, int x, int y )
00075     {
00076         assert( m_spGLUT );
00077         m_spGLUT->KeyboardFn( key, x, y );
00078     }
00079     static void Special ( int key, int x, int y )
00080     {
00081         assert( m_spGLUT );
00082         m_spGLUT->SpecialFn( key, x, y );
00083     }
00084     static void Idle ()
00085     {
00086         assert( m_spGLUT );
00087         m_spGLUT->IdleFn();
00088     }
00089     //-------------------------------------------------------------------------
00090 }; // END CLASS GLUTWindow
00091 //-----------------------------------------------------------------------------
00092 //=============================================================================
00093 END_NAMESPACE_TAPs__OpenGL
00094 //-----------------------------------------------------------------------------
00095 // Include definition if TAPs_USE_EXPORT is not defined
00096 #if !defined( TAPs_USE_EXPORT )
00097     #include "TAPsGLUTWindow.cpp"
00098 #endif
00099 //-----------------------------------------------------------------------------
00100 #endif
00101 //345678901234567890123456789012345678901234567890123456789012345678901234567890
00102 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines