int main( int argc, char * argv[] ) { btCollisionWorld* collisionWorld = initCollision(); osg::ArgumentParser arguments( &argc, argv ); MoveManipulator* mm = new MoveManipulator; osg::ref_ptr< osg::Group > root =(osg::Group*) createScene( collisionWorld, mm, arguments ); osgViewer::Viewer viewer; viewer.setUpViewInWindow( 10, 30, 800, 600 ); viewer.setCameraManipulator( new osgGA::TrackballManipulator() ); viewer.addEventHandler( mm ); osgbCollision::GLDebugDrawer* dbgDraw = new osgbCollision::GLDebugDrawer(); dbgDraw->setDebugMode( ~btIDebugDraw::DBG_DrawText ); collisionWorld->setDebugDrawer( dbgDraw ); root->addChild( dbgDraw->getSceneGraph() ); viewer.setSceneData( root.get() ); bool lastColState = false; while( !viewer.done() ) { collisionWorld->performDiscreteCollisionDetection(); detectCollision( lastColState, collisionWorld ); dbgDraw->BeginDraw(); collisionWorld->debugDrawWorld(); dbgDraw->EndDraw(); viewer.frame(); } return( 0 ); }
GameEnvironment::GameEnvironment() { std::cout << "Konstruktor gameenvironment" << std::endl; initVariables(); try { initModels(); } catch (Exception e) { MessageBoxA(NULL, "Oops, something went wrong :(\nPlease press OK and restart game", "Error", MB_OK | MB_ICONERROR | MB_SYSTEMMODAL); exit(0); } try { initCollision(); } catch (LoadingFileError e) { MessageBoxA(NULL, e.type().c_str(), "Error", MB_OK | MB_ICONWARNING | MB_SYSTEMMODAL); } catch (Exception e) { MessageBoxA(NULL, "Oops, something went wrong :(\nPlease press OK and restart game", "Error", MB_OK | MB_ICONERROR | MB_SYSTEMMODAL); exit(0); } try { initSound(); } catch (InitFmodError e) { MessageBoxA(NULL, e.type().c_str(), "Error", MB_OK | MB_ICONERROR | MB_SYSTEMMODAL); exit(0); } catch (SoundError e) { MessageBoxA(NULL, e.type().c_str(), "Error", MB_OK | MB_ICONERROR | MB_SYSTEMMODAL); exit(0); } catch (Exception e) { MessageBoxA(NULL, "Oops, something with sounds went wrong :(\nPlease press OK and restart game", "Error", MB_OK | MB_ICONERROR | MB_SYSTEMMODAL); exit(0); } try { initShaders(); } catch (LoadingFileError e) { MessageBoxA(NULL, e.type().c_str(), "Error", MB_OK | MB_ICONWARNING | MB_SYSTEMMODAL); } catch (Exception e) { MessageBoxA(NULL, "Oops, something went wrong :(\nPlease press OK and restart game", "Error", MB_OK | MB_ICONERROR | MB_SYSTEMMODAL); exit(0); } }