add limit for x/y offset
This commit is contained in:
parent
79bc7066b0
commit
944fc66665
16
main.c
16
main.c
@ -302,6 +302,8 @@ int MAIN
|
||||
int x_offset = 0;
|
||||
int y_offset = 0;
|
||||
int zoom_level = 1;
|
||||
int seuil_x; // limit for x_offset
|
||||
int seuil_y; // limit for y_offset
|
||||
int over = 0;
|
||||
int time = 0;
|
||||
int wait_time = 100;
|
||||
@ -395,6 +397,20 @@ int MAIN
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* check x and y offset*/
|
||||
seuil_x = width/(2*zoom_level);
|
||||
if (x_offset < seuil_x) x_offset=seuil_x;
|
||||
|
||||
if (x_offset > width-seuil_x) x_offset=width-seuil_x;
|
||||
|
||||
seuil_y = height/(2*zoom_level);
|
||||
if (y_offset < seuil_y) y_offset=seuil_y;
|
||||
|
||||
if(y_offset > height-seuil_y) y_offset=height-seuil_y;
|
||||
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
new_time = SDL_GetTicks();
|
||||
remaining_time -= new_time - time;
|
||||
|
Loading…
x
Reference in New Issue
Block a user