comparison libmlk-rpg/mlk/rpg/battle-indicator.c @ 505:6100c643dba0

ui: finally ditch theme
author David Demelier <markand@malikania.fr>
date Wed, 01 Mar 2023 16:24:07 +0100
parents 52a305833381
children
comparison
equal deleted inserted replaced
504:52a305833381 505:6100c643dba0
23 23
24 #include <mlk/core/color.h> 24 #include <mlk/core/color.h>
25 #include <mlk/core/font.h> 25 #include <mlk/core/font.h>
26 #include <mlk/core/panic.h> 26 #include <mlk/core/panic.h>
27 27
28 #include <mlk/ui/theme.h>
29
30 #include "battle-indicator.h" 28 #include "battle-indicator.h"
31 29
32 #define THEME(bti) ((bti)->theme ? (bti)->theme : &mlk_theme)
33 #define STEP (2) 30 #define STEP (2)
34 #define DELAY (5) 31 #define DELAY (5)
35 32
36 static inline unsigned int 33 static inline unsigned int
37 inc(int cmp, int tgt) 34 inc(int cmp, int tgt)
52 battle_indicator_start(struct battle_indicator *bti) 49 battle_indicator_start(struct battle_indicator *bti)
53 { 50 {
54 assert(bti); 51 assert(bti);
55 52
56 char buf[128]; 53 char buf[128];
57 const struct mlk_theme *theme = THEME(bti);
58 int err; 54 int err;
59 55
60 snprintf(buf, sizeof (buf), "%u", bti->amount); 56 snprintf(buf, sizeof (buf), "%u", bti->amount);
61 57
62 bti->cur = 0xffffffff; 58 bti->cur = 0xffffffff;
63 bti->elapsed = 0; 59 bti->elapsed = 0;
64 bti->alpha = 250; 60 bti->alpha = 250;
65 61
62 #if 0
66 if ((err = mlk_font_render(theme->fonts[MLK_THEME_FONT_INTERFACE], &bti->tex[0], buf, bti->cur)) < 0 || 63 if ((err = mlk_font_render(theme->fonts[MLK_THEME_FONT_INTERFACE], &bti->tex[0], buf, bti->cur)) < 0 ||
67 (err = mlk_font_render(theme->fonts[MLK_THEME_FONT_INTERFACE], &bti->tex[1], buf, 0x000000ff)) < 0) 64 (err = mlk_font_render(theme->fonts[MLK_THEME_FONT_INTERFACE], &bti->tex[1], buf, 0x000000ff)) < 0)
68 mlk_panic(err); 65 mlk_panic(err);
66 #endif
69 } 67 }
70 68
71 int 69 int
72 battle_indicator_completed(const struct battle_indicator *bti) 70 battle_indicator_completed(const struct battle_indicator *bti)
73 { 71 {