fshake3d
0.0.1
FreeformDensity3DSurfaceEditor
|
00001 00002 class UIAppPeerGlut 00003 { 00004 public: 00005 UIAppPeerGlut(int argc, char* argv[], App* pApp) 00006 : mpApp(pApp) 00007 , mpCaptureView(0) 00008 { 00009 glutInit(&argc, argv); 00010 glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE|GLUT_DEPTH); 00011 } 00012 void connectFrame(Frame* pFrame) 00013 { 00014 int windowid = glutCreateWindow(""); 00015 glutDisplayFunc(display); 00016 pFrame->setWindowID(pFrame); 00017 mFrameMap[windowid] = pFrame; 00018 } 00019 void disconnectFrame(Frame* pFrame) 00020 { 00021 00022 } 00023 static void display() 00024 { 00025 getFrame()->display(); 00026 } 00027 static void mouse(int button, int state, int x, int y) 00028 { 00029 getFrame()->onEvent( Event::makeMouseEvent(this,button,state,x,y) ); 00030 } 00031 static void motion(int x, int y) 00032 { 00033 } 00034 Frame* getFrame() 00035 { 00036 return mFrameMap[ glutGetWindow() ]; 00037 } 00038 private: 00039 App* mpApp; 00040 View* mpCaptureView; 00041 std::map<int, Frame*> mFrameMap; 00042 }; 00043 00044 int main(int argc, char* argv[]) 00045 { 00046 UIAppPeerGlut appPeer(argc,argv); 00047 FShake3DApp app(appPeer); 00048 }