From 1c1c5fa9b1094e96e6eea8abc163949e2277e151 Mon Sep 17 00:00:00 2001 From: Krow Savcik Date: Sat, 20 Jul 2024 01:20:31 +0300 Subject: feature: added frame marker --- src/ui.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src') diff --git a/src/ui.c b/src/ui.c index 52ce31e..b58cc0b 100644 --- a/src/ui.c +++ b/src/ui.c @@ -298,6 +298,12 @@ ui_mousel_down(int x, int y) y = y - fpan->geom.y - 8; y /= 22; if (y == 0) { + if (x < 162) break; + x = (x - 162) / 22; + if (x >= 0 && x < cur_canvas->frame_arr_cnt) { + cur_canvas->frames[x].state ^= 1; + ui_redraw_panel(UI_PANELTYPE_TIMELINE); + } break; } y -= 1; @@ -312,6 +318,8 @@ ui_mousel_down(int x, int y) canvas_change_layer(cur_canvas, y); ui_redraw_panel(UI_PANELTYPE_TIMELINE); } + + if (x < 162) break; x = (x - 162) / 22; if (x < 0 || x >= cur_canvas->frame_arr_cnt) break; canvas_change_frame(cur_canvas, x); @@ -812,6 +820,22 @@ ui_panel_timeline_redraw(UIPanelTimeline *p) SBDF_SDLPrint(ren, font, text, j, 17); } + for (i = 0; i < cur_canvas->frame_arr_cnt; i++) { + dest.y = 6; + dest.x = 170 + i * 22; + dest.h = 24; + dest.w = 24; + if (cur_canvas->frames[i].state&1^1) continue; + SDL_RenderSetViewport(ren, &dest); + SDL_SetRenderDrawColor(ren, INTTOCOLA(0xff0040ff)); + SDL_RenderDrawLine(ren, 18, 0, 23, 0); + SDL_RenderDrawLine(ren, 18, 1, 23, 1); + SDL_RenderDrawLine(ren, 20, 2, 23, 3); + SDL_RenderDrawLine(ren, 20, 3, 23, 2); + SDL_RenderDrawLine(ren, 22, 4, 23, 4); + SDL_RenderDrawLine(ren, 22, 5, 23, 5); + } + /* Draw cell table */ SDL_SetRenderDrawColor(ren, INTTOCOLA(0x131313ff)); for (i = 0; i < cur_canvas->layer_arr_cnt; i++) { -- cgit v1.2.3