Now i have an New way…
It works, but only to next Finger Position on Android where i touch on screen​:grin:
#include <SDL2/SDL.h>
#include <stdio.h>
#include <stdlib.h>
int main( int argc, char *argv[] )
{
SDL_Event event;
SDL_Init(SDL_INIT_EVERYTHING);
//----------------
SDL_Window *window = SDL_CreateWindow("Mouse Test " , 50, 50, 480, 252, SDL_WINDOW_SHOWN);
SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, 0);
//----------------
SDL_Surface *background = SDL_LoadBMP("background.bmp");
SDL_Texture *texture_background = SDL_CreateTextureFromSurface(renderer,background);
SDL_Surface *blank_up = SDL_LoadBMP("hwnd_blank_up.bmp");
SDL_Texture *texture_blank_up = SDL_CreateTextureFromSurface(renderer,blank_up);
SDL_Surface *blank_down = SDL_LoadBMP("hwnd_blank_down.bmp");
SDL_Texture *texture_blank_down = SDL_CreateTextureFromSurface(renderer,blank_down);
//-----------------------------------
int hwnd_size_x = 48; // 48 on landsacpe: 118
int hwnd_size_y = 42; // 42 on landscape 106
int mouse_x = 100;
int mouse_y = 100;
SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
SDL_RenderClear(renderer);
//--------------
int quit = 1;
while(quit == 1)
{
SDL_WaitEvent(&event);
while (SDL_PollEvent(&event))
{
switch (event.type)
{
case SDL_QUIT:
quit = 0;
break;
case SDL_MOUSEMOTION:
if (event.type == SDL_MOUSEMOTION )
{
mouse_x = event.motion.x;
mouse_y = event.motion.y;
}
// break;
case SDL_MOUSEBUTTONDOWN:
if (event.type == SDL_MOUSEBUTTONDOWN)
{
mouse_x = event.motion.x;
mouse_y = event.motion.y;
}
//break;
} // end of switch event
} // end of pollevent
//---------------------------------
SDL_Rect dstrect_back = { 0, 0, 480, 252};
SDL_RenderCopy(renderer,texture_background, NULL, &dstrect_back);
SDL_Rect dstrect0 = { 0, 0, hwnd_size_x, hwnd_size_y};
SDL_RenderCopy(renderer,texture_blank_up, NULL, &dstrect0);
SDL_Rect dstrect1 = { hwnd_size_x *1, 0, hwnd_size_x, hwnd_size_y};
SDL_RenderCopy(renderer,texture_blank_up, NULL, &dstrect1);
SDL_Rect dstrect2 = { hwnd_size_x *2, 0, hwnd_size_x, hwnd_size_y};
SDL_RenderCopy(renderer,texture_blank_up, NULL, &dstrect2);
SDL_Rect dstrect3 = { hwnd_size_x *3, 0, hwnd_size_x, hwnd_size_y};
SDL_RenderCopy(renderer,texture_blank_up, NULL, &dstrect3);
//....
SDL_Rect dstrect_m = { mouse_x, mouse_y, 50 , 50} ;
SDL_RenderCopy(renderer,texture_blank_up, NULL, &dstrect_m);
SDL_RenderPresent(renderer);
} //end of whlie_loop
//----------
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}