diff options
Diffstat (limited to 'src/px.c')
-rw-r--r-- | src/px.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -220,10 +220,17 @@ _pxSpr(const PxSprArgs *args) int h = (args->h < 0) ? (int)(args->spr->h) : (args->h); h = pxMin(h, args->spr->h - args->iy); + int ox = args->x; + int oy = args->y; + if (args->center) { + ox -= w / 2; + oy -= h / 2; + } + for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { - const int dx = x + args->x; - const int dy = y + args->y; + const int dx = x + ox; + const int dy = y + oy; int ix = args->ix + ((args->flip_x) ? (w - x - 1) : (x)); |