int kbhit(void) { if(!keybev) { proc_events(); } return keybev != 0; }
int kb_getkey(void) { int res = -1; proc_events(); if(keybev) { res = keybev->key.keysym.sym; keybev = 0; } return res; }
int getch(void) { int res; while(!keybev) { SDL_Event ev; SDL_WaitEvent(&ev); SDL_PushEvent(&ev); proc_events(); } res = keybev->key.keysym.sym; keybev = 0; return res; }
static void update(float dt) { //glPushMatrix(); uint64_t res = mach_absolute_time() - timer; world->update(res/1000.0f); timer = mach_absolute_time(); proc_events(); obj->render(); /* btTransform trans; btVector3 center; btScalar rad; const int numObjects=world->m_dynamicsWorld->getNumCollisionObjects(); btVector3 wireColor(1,0,0); for(int i=4;i<numObjects;i++) { btCollisionObject* colObj=world->m_dynamicsWorld->getCollisionObjectArray()[i]; printf("%f\n", center.getX()); btRigidBody* body=btRigidBody::upcast(colObj); body->getMotionState()->getWorldTransform(trans); //glRotatef(15, 0,0,1); //glRotatef(15, 0,0,1); glPushMatrix(); //trans.getRotation().getAxis(); //glTranslatef(trans.getOrigin().getX(), trans.getOrigin().getY(), 0); draw(trans); draw_bounding_sphere(center, rad); glPopMatrix(); //char data[200]; //sprintf(data, "pos = <%f,%f>", plr->getX(), plr->getY()); //drawString(10, 10, data); } */ //glPopMatrix(); }