GLUTApplication.h

00001 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
00002 /* 
00003  * Copyright (C) 2008 Micha Hersch, EPFL
00004  * RobotCub Consortium, European Commission FP6 Project IST-004370
00005  * email:   micha.hersch@robotcub.org
00006  * website: www.robotcub.org
00007  * Permission is granted to copy, distribute, and/or modify this program
00008  * under the terms of the GNU General Public License, version 2 or any
00009  * later version published by the Free Software Foundation.
00010  *
00011  * A copy of the license can be found at
00012  * http://www.robotcub.org/icub/license/gpl.txt
00013  *
00014  * This program is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
00017  * Public License for more details
00018  */
00019 #ifndef __GLUTAPPLICATION_H__
00020 #define __GLUTAPPLICATION_H__
00021 
00022 #include <GL/glut.h>
00023 
00024 #include "GLConsole.h"
00025 #include "GLCamera.h"
00026 #include "GLSnapshot.h"
00027 #include "GL2DPlot.h"
00028 #include "GLColorPlot.h"
00029 #include "GLSubWindow.h"
00030 #include "Timer.h"
00031 
00032 class GLUTBaseApplication;
00033 typedef GLUTBaseApplication *pGLUTBaseApplication;
00034 
00035 class GLUTBaseApplication
00036 {
00037 protected:
00038   // Window ID
00039   int               m_WindowID;
00040 
00041   // Cameras
00042   GLCamera_List     m_Camera;
00043   int               m_CurrentCamera;
00044 
00045   // Mouse tracking
00046   int               m_CurrentMouseButton;
00047   int               m_CurrentMouseX;
00048   int               m_CurrentMouseY;
00049 
00050 
00051   // Console
00052   //GLConsole         m_Console;
00053 
00054   
00055   // Double click Timer
00056   Timer             m_DblClickTimer;
00057   int               m_LastPressedButton;
00058 
00059  protected:
00060   // Snapshots
00061   GLSnapshot        m_Snapshot;
00062   bool              m_Snap;
00063 
00064 public:
00065   GLUTBaseApplication();
00066   GLUTBaseApplication(int argc, char **argv);
00067 //  GLUTBaseApplication(int argc, char **argv, pTree config);
00068   virtual ~GLUTBaseApplication();
00069 
00070   virtual void  Init();
00071   virtual void  Render();
00072   virtual void  Free();
00073   virtual void  OnIdle();
00074   virtual void  Resize          (int width, int height);
00075   virtual void  InputMouseButton(int button, int state, int x, int y);
00076   virtual void  InputMouseMotion(int x, int y);
00077   virtual void  InputNormalKey  (unsigned char key, int x, int y);
00078   virtual void  InputSpecialKey (int key, int x, int y);
00079 
00080           void  SetCurrent();
00081 
00082           void  Run();
00083           void  Exit();
00084           void  StartSnapshot(const char *filename,GLSnapshotMode mode);
00085 
00086           void  NextCamera();
00087           void  SetCamera(int num);
00088           GLCamera *GetCamera();
00089 private:
00090           void  BaseFree();
00091           void  BaseRender();
00092           void  BaseResize          (int width, int height);
00093           void  BaseInputNormalKey  (unsigned char key, int x, int y);
00094           void  BaseInputSpecialKey (int key, int x, int y);
00095           void  BaseInputMouseButton(int button, int state, int x, int y);
00096           void  BaseInputMouseMotion(int x, int y);
00097 
00098 protected:
00099     GLSubWindow_List  m_SubWindows;
00100 
00101 
00102 private:
00103   static  void  GLUTApp_Render();
00104   static  void  GLUTApp_OnIdle();
00105   static  void  GLUTApp_Resize(int width, int height);
00106   static  void  GLUTApp_InputMouseButton(int button, int state, int x, int y);
00107   static  void  GLUTApp_InputMouseMotion(int x, int y);
00108   static  void  GLUTApp_InputNormalKey(unsigned char key, int x, int y);
00109   static  void  GLUTApp_InputSpecialKey(int key, int x, int y);
00110 
00111   static  pGLUTBaseApplication    m_GLUTApp;
00112 };
00113 
00114 
00115 
00116 
00117 
00118 /*
00119 class GLUTApplication : public GLUTBaseApplication
00120 {
00121 public:
00122   GLUTApplication(int argc, char **argv);
00123 //  GLUTApplication(int argc, char **argv, pTree config);
00124   ~GLUTApplication();
00125 
00126   virtual void  Init();
00127   virtual void  Render();
00128   virtual void  Free();
00129   virtual void  OnIdle();
00130   virtual void  Resize          (int width, int height);
00131   virtual void  InputMouseButton(int button, int state, int x, int y);
00132   virtual void  InputMouseMotion(int x, int y);
00133   virtual void  InputNormalKey  (unsigned char key, int x, int y);
00134   virtual void  InputSpecialKey (int key, int x, int y);
00135 };
00136 */
00137 #endif
 All Data Structures Functions Variables

Generated on Wed Sep 22 16:51:25 2010 for Body_Schema_Learning by  doxygen 1.6.1