void gsl_init_video (int width, int height, int bpp, int flags, int options, int fov, float near_clip, int far_clip) { //Setting up the stencil buffer for windows systems SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); OPTIONS |= options; if (!SDL_SetVideoMode(width, height, bpp, flags)) fatal("Could not initialise SDL video mode"); WIDTH = width; HEIGHT = height; if (OPTIONS & GSL_CATCH_MOUSE) { SDL_WarpMouse(WIDTH / 2, HEIGHT / 2); discardEvents(1); } if (OPTIONS & GSL_DEFAULT_VIDEO) { glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(fov, (width * 1.0 / height), near_clip, far_clip); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ZERO); return; } }
void LwipNetTcpSocket::errCb(err_t err) { DBG("NetTcpSocket %p - Error %d in LwipNetTcpSocket::errCb.\n", (void*)this, err); //WARN: At this point, m_pPcb has been freed by lwIP m_pPcb = NULL; //These errors are fatal, discard all events queued before so that the errors are handled first discardEvents(); m_closed = true; cleanUp(); if( err == ERR_ABRT) queueEvent(NETTCPSOCKET_CONABRT); else //if( err == ERR_RST) queueEvent(NETTCPSOCKET_CONRST); }
void calcMouseMotion () { Mouse.state = SDL_GetMouseState(&Mouse.motionX, &Mouse.motionY); Mouse.motionX -= (WIDTH / 2); Mouse.motionY -= (HEIGHT / 2); //Calculate the motion from how much we have moved since last frame //(mouse was centered (WIDTH / 2, HEIGHT / 2) last frame); (deylen - 14/5/2009) if (OPTIONS & GSL_CATCH_MOUSE) { SDL_WarpMouse(WIDTH / 2, HEIGHT / 2); //Center the mouse for next frame calculations; (deylen - 14/5/2009) discardEvents(1); } }