29 |
*/ |
*/ |
30 |
|
|
31 |
#include "pgdraw.h" |
#include "pgdraw.h" |
32 |
|
#include <cmath> |
33 |
|
|
34 |
using namespace std; |
using namespace std; |
35 |
|
|
44 |
if (!tilemap->w || !tilemap->h || !surface->w || !surface->h) |
if (!tilemap->w || !tilemap->h || !surface->w || !surface->h) |
45 |
return; |
return; |
46 |
|
|
47 |
int dx = abs(drawrect.x - ref.x); |
int dx = abs((double)(drawrect.x - ref.x)); |
48 |
int dy = abs(drawrect.y - ref.y); |
int dy = abs((double)(drawrect.y - ref.y)); |
49 |
|
|
50 |
index1.x = dx / tilemap->w; |
index1.x = dx / tilemap->w; |
51 |
index1.y = dy / tilemap->h; |
index1.y = dy / tilemap->h; |