aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ft_draw_life_bar.c48
1 files changed, 25 insertions, 23 deletions
diff --git a/src/ft_draw_life_bar.c b/src/ft_draw_life_bar.c
index f429b43..c8cf629 100644
--- a/src/ft_draw_life_bar.c
+++ b/src/ft_draw_life_bar.c
@@ -33,28 +33,8 @@ static void
cl->tnum[id].img_w * cl->tnum[id].tex_y + 2];
}
-/* static void */
-/* ft_put_next_number(char n, int16_t x_offset, t_cub *cl); */
-
-/* static void */
-/* ft_put_image_from_number(char *num, uint16_t h, uint16_t w, t_cub *cl) */
-/* { */
-/* const size_t len = ft_strlen(num); */
-
-/* (void)num; */
-/* (void)h; */
-/* (void)w; */
-/* (void)cl; */
-/* if (len == 3) */
-/* { */
-/* ft_put_next_number(num[0], 0, cl); */
-/* ft_put_next_number(num[1], 0, cl); */
-/* ft_put_next_number(num[2], 0, cl); */
-/* } */
-/* } */
-
static void
- ft_put_percent_image(char n, uint16_t x_offset, t_cub *cl)
+ ft_put_next_number(char n, uint16_t x_offset, t_cub *cl)
{
int32_t x_ratio;
int32_t y_ratio;
@@ -82,6 +62,28 @@ static void
}
static void
+ ft_put_image_from_number(char *num, t_cub *cl)
+{
+ const size_t len = ft_strlen(num);
+ const int16_t scl = cl->mlist.scale;
+
+ (void)cl;
+ if (len == 3)
+ {
+ ft_put_next_number(num[0], 0, cl);
+ ft_put_next_number(num[1], (1 * (32 * scl) / 4), cl);
+ ft_put_next_number(num[2], (2 * (32 * scl) / 4), cl);
+ }
+ else if (len == 2)
+ {
+ ft_put_next_number(num[0], (1 * (32 * scl) / 4), cl);
+ ft_put_next_number(num[1], (2 * (32 * scl) / 4), cl);
+ }
+ else
+ ft_put_next_number(num[0], (2 * (32 * scl) / 4), cl);
+}
+
+static void
ft_get_hw(t_cub *cl)
{
int16_t x;
@@ -113,7 +115,7 @@ void
if (!(num = ft_itoa((int64_t)calc)))
ft_error(FT_RET_ALLOC_ERR, FT_ERR_ALLOCATE, cl);
ft_get_hw(cl);
- ft_put_percent_image(58, (3 * (32 * scl) / 4), cl);
- /* ft_put_image_from_number(num, y, x, cl); */
+ ft_put_next_number(58, (3 * (32 * scl) / 4), cl);
+ ft_put_image_from_number(num, cl);
ft_memdel((void*)&num);
}