src/render/SDL_render.c
changeset 7496 13dfa871f0af
parent 7419 a22566f42281
child 7508 1f64c6874619
equal deleted inserted replaced
7495:c4ba5e5c2765 7496:13dfa871f0af
   149         if (renderer->logical_w) {
   149         if (renderer->logical_w) {
   150             event->motion.x -= renderer->viewport.x;
   150             event->motion.x -= renderer->viewport.x;
   151             event->motion.y -= renderer->viewport.y;
   151             event->motion.y -= renderer->viewport.y;
   152             event->motion.x = (int)(event->motion.x / renderer->scale.x);
   152             event->motion.x = (int)(event->motion.x / renderer->scale.x);
   153             event->motion.y = (int)(event->motion.y / renderer->scale.y);
   153             event->motion.y = (int)(event->motion.y / renderer->scale.y);
       
   154             if (event->motion.xrel > 0) {
       
   155                 event->motion.xrel = SDL_max(1, (int)(event->motion.xrel / renderer->scale.x));
       
   156             } else if (event->motion.xrel < 0) {
       
   157                 event->motion.xrel = SDL_min(-1, (int)(event->motion.xrel / renderer->scale.x));
       
   158             }
       
   159             if (event->motion.yrel > 0) {
       
   160                 event->motion.yrel = SDL_max(1, (int)(event->motion.yrel / renderer->scale.y));
       
   161             } else if (event->motion.yrel < 0) {
       
   162                 event->motion.yrel = SDL_min(-1, (int)(event->motion.yrel / renderer->scale.y));
       
   163             }
   154         }
   164         }
   155     } else if (event->type == SDL_MOUSEBUTTONDOWN ||
   165     } else if (event->type == SDL_MOUSEBUTTONDOWN ||
   156                event->type == SDL_MOUSEBUTTONUP) {
   166                event->type == SDL_MOUSEBUTTONUP) {
   157         if (renderer->logical_w) {
   167         if (renderer->logical_w) {
   158             event->button.x -= renderer->viewport.x;
   168             event->button.x -= renderer->viewport.x;