GUI: Icons and IconsAnimation refactoring. Switch assets to new Icon Api (#566)
* GUI: Icons and IconsAnimation refactoring. Switch assets to new Icon API. * Gui: icon and animation draw now do not accept null pointer * Format Sources * Fix no debug build * Furi: stricter checks in memmgr
This commit is contained in:
@@ -7,7 +7,7 @@ const Item TV = {
|
||||
.timeout = 10,
|
||||
.x = 160,
|
||||
.y = 34,
|
||||
.icon = I_TV_20x24,
|
||||
.icon = &I_TV_20x24,
|
||||
.action_name = "Use",
|
||||
.draw = draw_tv,
|
||||
.callback = smash_tv};
|
||||
@@ -17,7 +17,7 @@ const Item Painting = {
|
||||
.timeout = 20,
|
||||
.x = 160,
|
||||
.y = 10,
|
||||
.icon = I_Home_painting_17x20,
|
||||
.icon = &I_Home_painting_17x20,
|
||||
.action_name = "Inspect",
|
||||
.draw = NULL,
|
||||
.callback = inspect_painting};
|
||||
@@ -27,7 +27,7 @@ const Item Sofa = {
|
||||
.timeout = 100,
|
||||
.x = 250,
|
||||
.y = 34,
|
||||
.icon = I_Sofa_40x13,
|
||||
.icon = &I_Sofa_40x13,
|
||||
.action_name = "Sit",
|
||||
.draw = NULL,
|
||||
.callback = sofa_sit};
|
||||
@@ -37,7 +37,7 @@ const Item PC = {
|
||||
.timeout = 100,
|
||||
.x = 400,
|
||||
.y = 10,
|
||||
.icon = I_PC_22x29,
|
||||
.icon = &I_PC_22x29,
|
||||
.action_name = "Use",
|
||||
.draw = NULL,
|
||||
.callback = pc_callback};
|
||||
@@ -111,8 +111,8 @@ void smash_tv(Canvas* canvas, void* state) {
|
||||
SceneState* s = state;
|
||||
s->player_flipped = true;
|
||||
canvas_set_bitmap_mode(canvas, true);
|
||||
canvas_draw_icon_name(
|
||||
canvas, ((TV.x - 5) - s->player_global.x) * PARALLAX(TV.layer), TV.y - 2, I_FX_Bang_32x6);
|
||||
canvas_draw_icon(
|
||||
canvas, ((TV.x - 5) - s->player_global.x) * PARALLAX(TV.layer), TV.y - 2, &I_FX_Bang_32x6);
|
||||
canvas_set_bitmap_mode(canvas, false);
|
||||
if(s->action_timeout < TV.timeout - 2) {
|
||||
elements_multiline_text_framed(canvas, 80, 24, "Bang!");
|
||||
@@ -124,8 +124,8 @@ void sofa_sit(Canvas* canvas, void* state) {
|
||||
SceneState* s = state;
|
||||
// temp fix pos
|
||||
s->player_global.x = 154;
|
||||
s->dolphin_gfx = A_FX_Sitting_40x27;
|
||||
s->dolphin_gfx_b = I_FX_SittingB_40x27;
|
||||
s->dolphin_gfx = &A_FX_Sitting_40x27;
|
||||
s->dolphin_gfx_b = &I_FX_SittingB_40x27;
|
||||
}
|
||||
|
||||
void inspect_painting(Canvas* canvas, void* state) {
|
||||
|
@@ -66,7 +66,7 @@ typedef struct {
|
||||
uint16_t timeout;
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
IconName icon;
|
||||
const Icon* icon;
|
||||
char action_name[16];
|
||||
void (*draw)(Canvas* canvas, void* model);
|
||||
void (*callback)(Canvas* canvas, void* model);
|
||||
@@ -79,8 +79,8 @@ typedef struct {
|
||||
Vec2 player_v;
|
||||
Vec2 screen;
|
||||
|
||||
IconName dolphin_gfx;
|
||||
IconName dolphin_gfx_b; // temp
|
||||
const Icon* dolphin_gfx;
|
||||
const Icon* dolphin_gfx_b; // temp
|
||||
|
||||
bool player_flipped;
|
||||
bool use_pending;
|
||||
|
@@ -104,37 +104,37 @@ void dolphin_scene_render_dolphin(SceneState* state, Canvas* canvas) {
|
||||
furi_assert(canvas);
|
||||
|
||||
if(state->scene_zoom == SCENE_ZOOM) {
|
||||
state->dolphin_gfx = I_DolphinExcited_64x63;
|
||||
state->dolphin_gfx = &I_DolphinExcited_64x63;
|
||||
} else if(state->action == SLEEP && state->player_global.x == 154) { // 2do - sofa x pos getter
|
||||
state->dolphin_gfx = A_FX_Sitting_40x27;
|
||||
state->dolphin_gfx_b = I_FX_SittingB_40x27;
|
||||
state->dolphin_gfx = &A_FX_Sitting_40x27;
|
||||
state->dolphin_gfx_b = &I_FX_SittingB_40x27;
|
||||
} else if(state->action != INTERACT) {
|
||||
if(state->player_v.x < 0 || state->player_flipped) {
|
||||
if(state->player_anim == 0) {
|
||||
state->dolphin_gfx = I_WalkL1_32x32;
|
||||
state->dolphin_gfx_b = I_WalkLB1_32x32;
|
||||
state->dolphin_gfx = &I_WalkL1_32x32;
|
||||
state->dolphin_gfx_b = &I_WalkLB1_32x32;
|
||||
|
||||
} else {
|
||||
state->dolphin_gfx = I_WalkL2_32x32;
|
||||
state->dolphin_gfx_b = I_WalkLB2_32x32;
|
||||
state->dolphin_gfx = &I_WalkL2_32x32;
|
||||
state->dolphin_gfx_b = &I_WalkLB2_32x32;
|
||||
}
|
||||
} else if(state->player_v.x > 0 || !state->player_flipped) {
|
||||
if(state->player_anim == 0) {
|
||||
state->dolphin_gfx = I_WalkR1_32x32;
|
||||
state->dolphin_gfx_b = I_WalkRB1_32x32;
|
||||
state->dolphin_gfx = &I_WalkR1_32x32;
|
||||
state->dolphin_gfx_b = &I_WalkRB1_32x32;
|
||||
|
||||
} else {
|
||||
state->dolphin_gfx = I_WalkR2_32x32;
|
||||
state->dolphin_gfx_b = I_WalkRB2_32x32;
|
||||
state->dolphin_gfx = &I_WalkR2_32x32;
|
||||
state->dolphin_gfx_b = &I_WalkRB2_32x32;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
canvas_set_bitmap_mode(canvas, true);
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
canvas_draw_icon_name(canvas, state->player.x, state->player.y, state->dolphin_gfx_b);
|
||||
canvas_draw_icon(canvas, state->player.x, state->player.y, state->dolphin_gfx_b);
|
||||
canvas_set_color(canvas, ColorBlack);
|
||||
canvas_draw_icon_name(canvas, state->player.x, state->player.y, state->dolphin_gfx);
|
||||
canvas_draw_icon(canvas, state->player.x, state->player.y, state->dolphin_gfx);
|
||||
canvas_set_bitmap_mode(canvas, false);
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ void dolphin_scene_render(SceneState* state, Canvas* canvas, uint32_t t) {
|
||||
if(current_scene[i]->draw) current_scene[i]->draw(canvas, state);
|
||||
|
||||
if(l == current_scene[i]->layer) {
|
||||
canvas_draw_icon_name(
|
||||
canvas_draw_icon(
|
||||
canvas,
|
||||
item_pos * PARALLAX(l),
|
||||
current_scene[i]->y,
|
||||
|
Reference in New Issue
Block a user