diff --git a/apps/testgame/scenes/ingame.c b/apps/testgame/scenes/ingame.c index c1f961f..1fe1fdf 100644 --- a/apps/testgame/scenes/ingame.c +++ b/apps/testgame/scenes/ingame.c @@ -57,7 +57,7 @@ static void ingame_tick(struct state *state) { m_sprite(m_set(path, "/assets/player/baron-walk.png"), m_set(rect, ((t_frect){ 256, 256, 48, 48 })), m_opt(color, ((t_color){ 255, 255, 255, 255 })), - m_opt(scale, false ), + m_opt(stretch, false ), m_opt(texture_origin, ((t_fvec2){ ctx.tick_count % 48, ctx.tick_count % 48 }))); m_sprite(m_set(path, "/assets/light.png"), diff --git a/townengine/rendering.h b/townengine/rendering.h index 7dbc367..2aa527e 100644 --- a/townengine/rendering.h +++ b/townengine/rendering.h @@ -19,7 +19,7 @@ typedef struct push_sprite_args { float, rotation, bool, flip_x, bool, flip_y, - bool, scale ) + bool, stretch ) } t_push_sprite_args; /* pushes a sprite onto the sprite render queue */ diff --git a/townengine/rendering/sprites.h b/townengine/rendering/sprites.h index 8eaf95d..1f6ae68 100644 --- a/townengine/rendering/sprites.h +++ b/townengine/rendering/sprites.h @@ -69,7 +69,7 @@ void push_sprite(const t_push_sprite_args args) { .texture_key = textures_get_key(&ctx.texture_cache, args.path), .flip_x = m_or(args, flip_x, false), .flip_y = m_or(args, flip_y, false), - .repeat = !m_or(args, scale, true), + .repeat = !m_or(args, stretch, true), m_opt_from(texture_origin, args, texture_origin) }; @@ -211,6 +211,8 @@ static void render_sprites(const struct primitive_2d primitives[], uv2 = (t_fvec2){ xr + wr * !sprite.flip_x, yr + hr * !sprite.flip_y }; uv3 = (t_fvec2){ xr + wr * !sprite.flip_x, yr + hr * sprite.flip_y }; + /* TODO: texture_origin support */ + } else { /* try fitting texture into supplied destination rectangle */