new option-based api for sprite issue
This commit is contained in:
		| @@ -243,13 +243,13 @@ struct player *player_create(struct world *world) { | ||||
|  | ||||
|  | ||||
| static void drawdef(struct player *player) { | ||||
|     push_sprite("/assets/player/baron-walk.png", | ||||
|                 (t_frect) { | ||||
|                     .x = player->rect.x + ((player->rect.w - player->sprite_w) / 2), | ||||
|                     .y = player->rect.y - 8, | ||||
|                     .w = player->sprite_w, | ||||
|                     .h = player->sprite_h, | ||||
|                 }); | ||||
|     m_sprite("/assets/player/baron-walk.png", | ||||
|             (t_frect) { | ||||
|                 .x = player->rect.x + ((player->rect.w - player->sprite_w) / 2), | ||||
|                 .y = player->rect.y - 8, | ||||
|                 .w = player->sprite_w, | ||||
|                 .h = player->sprite_h, | ||||
|             }); | ||||
|  | ||||
|     push_circle((t_fvec2) { 256, 128 }, | ||||
|                 24, | ||||
|   | ||||
| @@ -20,38 +20,27 @@ static void ingame_tick(struct state *state) { | ||||
|     if (input_is_action_pressed(&ctx.input, "player_jump")) | ||||
|         cam.pos.z -= 0.01f; | ||||
|  | ||||
|     push_camera(&cam); | ||||
|     m_sprite(m_set(path,  "/assets/light.png"), | ||||
|              m_set(rect,  ((t_frect){ 48, 64, 64, 64 })), | ||||
|              m_opt(color, ((t_color){ 255, 0, 0, 255 }))); | ||||
|  | ||||
|     push_sprite_ex((t_frect){ .x = 32, .y = 64, .w = 64, .h = 64 }, (t_push_sprite_args){ | ||||
|         .path = "/assets/light.png", | ||||
|         .color = (t_color){255, 0, 0, 255}, }); | ||||
|     m_sprite(m_set(path,  "/assets/light.png"), | ||||
|              m_set(rect,  ((t_frect){ 64, 64, 64, 64 })), | ||||
|              m_opt(color, ((t_color){ 0, 255, 0, 255 }))); | ||||
|  | ||||
|     push_sprite_ex((t_frect){ .x = 48, .y = 64, .w = 64, .h = 64 }, (t_push_sprite_args){ | ||||
|         .path = "/assets/light.png", | ||||
|         .color = (t_color){0, 255, 0, 255}, }); | ||||
|     m_sprite(m_set(path,  "/assets/light.png"), | ||||
|              m_set(rect,  ((t_frect){ 80, 64, 64, 64 })), | ||||
|              m_opt(color, ((t_color){ 0, 0, 255, 255 }))); | ||||
|  | ||||
|     push_sprite_ex((t_frect){ .x = 64, .y = 64, .w = 64, .h = 64 }, (t_push_sprite_args){ | ||||
|         .path = "/assets/light.png", | ||||
|         .color = (t_color){0, 0, 255, 255}, }); | ||||
|     m_sprite(m_set(path,     "/assets/player/baron-walk.png"), | ||||
|              m_set(rect,     ((t_frect){ 32, 32, 64, 64 })), | ||||
|              m_opt(rotation, (float)M_PI * 2 * (float)(ctx.tick_count % 64) / 64 )); | ||||
|  | ||||
|     push_sprite_ex((t_frect){ .x = 32, .y = 32, .w = 64, .h = 64 }, (t_push_sprite_args){ | ||||
|         .path = "/assets/player/baron-walk.png", | ||||
|         .color = (t_color){255, 255, 255, 255}, | ||||
|         .rotation = (float)M_PI * 2 * (float)(ctx.tick_count % 64) / 64, }); | ||||
|     m_sprite(m_set(path,     "/assets/player/baron-walk.png"), | ||||
|              m_set(rect,     ((t_frect){ 128, 32, 128, 64 })), | ||||
|              m_opt(rotation, (float)M_PI * 2 * (float)(ctx.tick_count % 64) / 64 )); | ||||
|  | ||||
|     push_sprite_ex((t_frect){ .x = 64, .y = 32, .w = 64, .h = 64 }, (t_push_sprite_args){ | ||||
|         .path = "/assets/player/baron-walk.png", | ||||
|         .color = (t_color){255, 255, 255, 255}, | ||||
|         .rotation = (float)M_PI / 64, }); | ||||
|  | ||||
|     push_sprite_ex((t_frect){ .x = 96, .y = 32, .w = 64, .h = 64 }, (t_push_sprite_args){ | ||||
|         .path = "/assets/player/baron-walk.png", | ||||
|         .color = (t_color){255, 255, 255, 255}, }); | ||||
|  | ||||
|     push_sprite_ex((t_frect){ .x = 128, .y = 32, .w = 128, .h = 64 }, (t_push_sprite_args){ | ||||
|         .path = "/assets/player/baron-walk.png", | ||||
|         .color = (t_color){255, 255, 255, 255}, | ||||
|         .rotation = (float)M_PI * 2 * (float)(ctx.tick_count % 64) / 64, }); | ||||
|     set_camera(&cam); | ||||
|  | ||||
|     unfurl_triangle("/assets/big-violet.png", | ||||
|                     (t_fvec3){ -1, -1, 0 }, | ||||
|   | ||||
| @@ -14,9 +14,8 @@ static void title_tick(struct state *state) { | ||||
|     } | ||||
|  | ||||
|  | ||||
|     push_sprite("/assets/title.png", (t_frect) { | ||||
|         (RENDER_BASE_WIDTH / 2) - (320 / 2), 64, 320, 128 | ||||
|     }); | ||||
|     m_sprite("/assets/title.png", ((t_frect) { | ||||
|             (RENDER_BASE_WIDTH / 2) - (320 / 2), 64, 320, 128 })); | ||||
| } | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -105,7 +105,7 @@ void world_drawdef(struct world *world) { | ||||
|         if (world->tiles[i].type == TILE_TYPE_VOID) | ||||
|             continue; | ||||
|  | ||||
|         push_sprite("/assets/white.png", to_frect(world->tiles[i].rect)); | ||||
|         m_sprite("/assets/white.png", to_frect(world->tiles[i].rect)); | ||||
|     } | ||||
|  | ||||
|     drawdef_debug(world); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user