summaryrefslogtreecommitdiffhomepage
path: root/src/sprite.c
blob: 0e5d7e838514f40210f68fdcc20e1cb9337fbc1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

#include "rodeo.h"
#include "sprite.h"

void
draw_sprite(sprite_t *sprite, float x, float y, float scale, rodeo_color_RGBAFloat_t color)
{
	rodeo_gfx_texture_2d_draw(
		(rodeo_rectangle_t){
			.x = x,// - ((float)sprite->config.width * scale / 2),
			.y = y,// - ((float)sprite->config.height * scale / 2),
			.width = (float)sprite->config.width * scale,
			.height = (float)sprite->config.height * scale 
		},
		(rodeo_rectangle_t){ 
			.x = (float)sprite->config.width * (float)(uint32_t)sprite->iter,
			.y = 0,
			.width = (float)sprite->config.width,
			.height = (float)sprite->config.height
		},
		color,
		sprite->config.texture
	);
}