[SDL] Not Response on Window Mode (on WindowsXP)

Wutipong Wongsakuldej 9tawan at gmail.com
Sat Nov 12 06:10:39 PST 2005


Bill Kendrick wrote:
> On Sat, Nov 12, 2005 at 03:18:43AM +0700, Wutipong Wongsakuldej wrote:
>   
>> This problem is not found on Full-Screen Mode.
>>
>>     
>
> You are doing SDL_Flip() a _lot_, even when nothing has changed
> and it hasn't been "33" ms.  (e.g., if there were no events, it still
> SDL_Flip()'s, which might be expensive, esp. in windowed / software surface
> modes.)
>
> Try only SDL_Flip()'ing when you actually do the SDL_BlitSurface() stuff.
>
> -bill!
>
>   
I've tried to use SDL_Delay() , but still same result :-(
Anyway, thanks so much for suggestion.
>   
>> Here is the rendering code :-
>>
>> int UpdateScreen(void* data)
>> {
>>    static long exframe = SDL_GetTicks();
>>    while(true)
>>    {
>>        //Delay each frame for approx 33ms
>>        //SDL_Delay(33);
>>
>>        //Start Render new Frame
>>        SDL_LockMutex(mutex);
>>        long now = SDL_GetTicks();
>>
>>        if(now-exframe >=33)
>>        {
>>            exframe = now;
>>
>>            //Clear Frame Buffer
>>            SDL_FillRect(backBuffer,NULL,0xffffffff);
>>            //Draw Text to Screen
>>            SDL_BlitSurface(background,NULL,backBuffer,NULL);
>>            box->Draw(backBuffer);
>>            SDL_BlitSurface(messageBuffer,NULL,backBuffer,NULL);
>>        }
>>        //Do Event
>>        SDL_Event event;
>>        while(SDL_PollEvent(&event)==1)
>>        {
>>            box->ActionPerformed(event);
>>        };
>>        //Flip Frame Buffer
>>        SDL_Flip(backBuffer);
>>        SDL_UnlockMutex(mutex);
>>        //Finish Render Frame
>>    }
>>    return 0;
>> }
>>     
>
> -bill!
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
>
>   





More information about the SDL mailing list