Mercurial > molko
comparison src/sprite.c @ 46:b815621df3e3
core: remove all fixed width integers, closes #2460
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 15 Jan 2020 22:31:17 +0100 |
parents | 607bd90aba63 |
children |
comparison
equal
deleted
inserted
replaced
45:e10fd1b6323f | 46:b815621df3e3 |
---|---|
21 #include "sprite.h" | 21 #include "sprite.h" |
22 #include "texture_p.h" | 22 #include "texture_p.h" |
23 #include "texture.h" | 23 #include "texture.h" |
24 | 24 |
25 void | 25 void |
26 sprite_init(struct sprite *sprite, struct texture *tex, uint8_t cellw, uint8_t cellh) | 26 sprite_init(struct sprite *sprite, |
27 struct texture *tex, | |
28 unsigned int cellw, | |
29 unsigned int cellh) | |
27 { | 30 { |
28 int w = 0; | 31 int w = 0; |
29 int h = 0; | 32 int h = 0; |
30 | 33 |
31 assert(sprite); | 34 assert(sprite); |
32 assert(tex); | 35 assert(tex); |
33 | 36 |
37 /* TODO: use texture_get_size */ | |
34 SDL_QueryTexture(tex->handle, NULL, NULL, &w, &h); | 38 SDL_QueryTexture(tex->handle, NULL, NULL, &w, &h); |
35 | 39 |
36 sprite->texture = tex; | 40 sprite->texture = tex; |
37 sprite->cellw = cellw; | 41 sprite->cellw = cellw; |
38 sprite->cellh = cellh; | 42 sprite->cellh = cellh; |
39 sprite->nrows = h / cellh; | 43 sprite->nrows = h / cellh; |
40 sprite->ncols = w / cellw; | 44 sprite->ncols = w / cellw; |
41 } | 45 } |
42 | 46 |
43 void | 47 void |
44 sprite_draw(struct sprite *sprite, uint16_t r, uint16_t c, int x, int y) | 48 sprite_draw(struct sprite *sprite, unsigned int r, unsigned int c, int x, int y) |
45 { | 49 { |
46 assert(sprite); | 50 assert(sprite); |
47 | 51 |
48 texture_draw_ex( | 52 texture_draw_ex( |
49 sprite->texture, | 53 sprite->texture, |