The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
the first SDL_FINGERDOWN result is black screen
traveleru


Joined: 12 Aug 2014
Posts: 3
Location: ShenZhen. China
Hello, Anyone can read my following code? these are the section of my program. It runs on android 4.2 mobile.

case SDL_FINGERDOWN:
logInt("finger down occur: ",SDL_FINGERDOWN);
px = floor(e.tfinger.x * screenwidth);
py = floor(e.tfinger.y * screenheigh);

SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
SDL_RenderClear(renderer);
SDL_RenderPresent(renderer);

SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
SDL_RenderDrawLine(renderer,px,0,px,screenheigh-1);
SDL_RenderDrawLine(renderer,0,py,screenwidth-1,py);
SDL_RenderPresent(renderer);

logFloat("cordinate float x:",e.tfinger.x);
logFloat("cordinate float y:",e.tfinger.y);
logInt("cordinate int x:",px);
logInt("cordinate int y:",py);
break;


when I touch mobile firstly, mobile screen displays the red cross line on the black background. it is not expected. but then many time, mobile screen displays the red cross line on the green background. It is correct.
why is it? help me!
there is anoter events
traveleru


Joined: 12 Aug 2014
Posts: 3
Location: ShenZhen. China
I find it, before sdl_fingerdown event happends, exists two time window_events. it must be processed.