void ANDROID_GL_SwapBuffers(_THIS) { //__android_log_print(ANDROID_LOG_INFO, "libSDL", "ANDROID_GL_SwapBuffers"); if( !SDL_ANDROID_InsideVideoThread() ) { __android_log_print(ANDROID_LOG_INFO, "libSDL", "Error: calling %s not from the main thread!", __PRETTY_FUNCTION__); return; } SDL_ANDROID_CallJavaSwapBuffers(); };
void SDL_ANDROID_MultiThreadedVideoLoop() { while(1) { int signalNeeded = 0; int swapBuffersNeeded = 0; SDL_mutexP(videoThread.mutex); videoThread.threadReady = 1; SDL_CondSignal(videoThread.cond2); SDL_CondWaitTimeout(videoThread.cond, videoThread.mutex, 1000); if( videoThread.execute ) { videoThread.threadReady = 0; switch( videoThread.cmd ) { case CMD_INIT: videoThread.retcode = ANDROID_VideoInit(videoThread._this, videoThread.vformat); break; case CMD_SETVIDEOMODE: videoThread.retcode2 = ANDROID_SetVideoMode(videoThread._this, videoThread.current, videoThread.width, videoThread.height, videoThread.bpp, videoThread.flags); break; case CMD_QUIT: ANDROID_VideoQuit(videoThread._this); break; case CMD_UPDATERECTS: ANDROID_FlipHWSurfaceInternal(); swapBuffersNeeded = 1; break; case CMD_FLIP: ANDROID_FlipHWSurfaceInternal(); swapBuffersNeeded = 1; break; } videoThread.execute = 0; signalNeeded = 1; } SDL_mutexV(videoThread.mutex); if( signalNeeded ) SDL_CondSignal(videoThread.cond2); if( swapBuffersNeeded ) { SDL_ANDROID_CallJavaSwapBuffers(); } } }
static void ANDROID_UpdateRects(_THIS, int numrects, SDL_Rect *rects) { if( !SDL_ANDROID_InsideVideoThread() ) { __android_log_print(ANDROID_LOG_INFO, "libSDL", "Error: calling %s not from the main thread!", __PRETTY_FUNCTION__); return; } if(!SDL_CurrentVideoSurface) { __android_log_print(ANDROID_LOG_INFO, "libSDL", "Error: calling %s without main video surface!", __PRETTY_FUNCTION__); return; } ANDROID_FlipHWSurfaceInternal(); SDL_ANDROID_CallJavaSwapBuffers(); }
static void ANDROID_UpdateRects(_THIS, int numrects, SDL_Rect *rects) { if( !SDL_ANDROID_InsideVideoThread() ) { __android_log_print(ANDROID_LOG_INFO, "libSDL", "Error: calling %s not from the main thread!", __PRETTY_FUNCTION__); return; } if(!SDL_CurrentVideoSurface) { __android_log_print(ANDROID_LOG_INFO, "libSDL", "Error: calling %s without main video surface!", __PRETTY_FUNCTION__); return; } // ANDROID_FlipHWSurfaceInternal(numrects, rects); // Fails for fheroes2, I'll add a compatibility option later. ANDROID_FlipHWSurfaceInternal(0, NULL); SDL_ANDROID_CallJavaSwapBuffers(); }
static int ANDROID_FlipHWSurface(_THIS, SDL_Surface *surface) { if( !SDL_ANDROID_InsideVideoThread() ) { __android_log_print(ANDROID_LOG_INFO, "libSDL", "Error: calling %s not from the main thread!", __PRETTY_FUNCTION__); return -1; } if(!SDL_CurrentVideoSurface) { __android_log_print(ANDROID_LOG_INFO, "libSDL", "Error: calling %s without main video surface!", __PRETTY_FUNCTION__); return -1; } ANDROID_FlipHWSurfaceInternal(0, NULL); SDL_ANDROID_CallJavaSwapBuffers(); return(0); }
void ANDROID_GL_SwapBuffers(_THIS, SDL_Window * window) { SDL_ANDROID_CallJavaSwapBuffers(); };