summaryrefslogtreecommitdiffhomepage
path: root/src/sprite.c
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2023-05-26 16:30:43 -0400
committerrealtradam <[email protected]>2023-05-26 16:30:43 -0400
commitd1471c210e8af13234bd7fe120faf5fc9dfae038 (patch)
treeaede588ee9fa1cb0d17cda38f9367eb6baa9b223 /src/sprite.c
parent33dc8e4cd4987a9f439767cf23812dce835fb4a5 (diff)
downloadTOJam2023-d1471c210e8af13234bd7fe120faf5fc9dfae038.tar.gz
TOJam2023-d1471c210e8af13234bd7fe120faf5fc9dfae038.zip
start sprite work
Diffstat (limited to 'src/sprite.c')
-rw-r--r--src/sprite.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/sprite.c b/src/sprite.c
new file mode 100644
index 0000000..c1c88f6
--- /dev/null
+++ b/src/sprite.c
@@ -0,0 +1,24 @@
+
+#include "rodeo.h"
+#include "sprite.h"
+
+void
+draw_sprite(sprite_t *sprite, float x, float y, float scale)
+{
+ rodeo_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)sprite->iter,
+ .y = 0,
+ .width = (float)sprite->config.width,
+ .height = (float)sprite->config.height
+ },
+ &(rodeo_color_RGBAFloat_t){ .array = { 1.0f, 1.0f, 1.0f, 1.0f } },
+ sprite->config.texture
+ );
+}