From 48cef82988d6209987ae27fe29b72d7d5e402b3c Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Wed, 19 Jul 2023 08:35:00 -0700 Subject: Add sprites. --- gfx-iso/app/isogfx-demo.c | 15 +++++++++++++-- gfx-iso/app/main.c | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'gfx-iso/app') diff --git a/gfx-iso/app/isogfx-demo.c b/gfx-iso/app/isogfx-demo.c index d463d1c..9889275 100644 --- a/gfx-iso/app/isogfx-demo.c +++ b/gfx-iso/app/isogfx-demo.c @@ -9,8 +9,10 @@ #include typedef struct State { - int xpick; - int ypick; + int xpick; + int ypick; + SpriteSheet stag_sheet; + Sprite stag; } State; static void shutdown(IsoGfx* iso, void* app_state) { @@ -54,6 +56,15 @@ bool make_demo_app(IsoGfx* iso, IsoGfxApp* app) { goto cleanup; } + if (!isogfx_load_sprite_sheet( + iso, "/home/jeanne/assets/tilesets/scrabling/critters/stag/stag.ss", + &state->stag_sheet)) { + goto cleanup; + } + + state->stag = isogfx_make_sprite(iso, state->stag_sheet); + isogfx_set_sprite_position(iso, state->stag, 5, 4); + app->pixel_scale = 2; app->state = state; app->shutdown = shutdown; diff --git a/gfx-iso/app/main.c b/gfx-iso/app/main.c index 5b441d3..ff8a266 100644 --- a/gfx-iso/app/main.c +++ b/gfx-iso/app/main.c @@ -138,6 +138,8 @@ static void update(void* app_state, double t, double dt) { assert(app_state); State* state = (State*)(app_state); + isogfx_update(state->iso, t); + assert(state->app.update); (*state->app.update)(state->iso, state->app.state, t, dt); } -- cgit v1.2.3