aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-20 19:21:47 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-20 19:21:47 +0100
commit7d52dc0036c8329989a8bd5b76d8704314644860 (patch)
tree88fb340705b918450e5af92374088341992ba693 /src
parentit's not working at all (diff)
download42-cub3d-7d52dc0036c8329989a8bd5b76d8704314644860.tar.gz
42-cub3d-7d52dc0036c8329989a8bd5b76d8704314644860.tar.bz2
42-cub3d-7d52dc0036c8329989a8bd5b76d8704314644860.tar.xz
42-cub3d-7d52dc0036c8329989a8bd5b76d8704314644860.tar.zst
42-cub3d-7d52dc0036c8329989a8bd5b76d8704314644860.zip
it's not working
Diffstat (limited to '')
-rw-r--r--src/ft_draw_life_bar.c23
-rw-r--r--src/ft_tex_init.c80
2 files changed, 51 insertions, 52 deletions
diff --git a/src/ft_draw_life_bar.c b/src/ft_draw_life_bar.c
index 687e3a7..8e3da2c 100644
--- a/src/ft_draw_life_bar.c
+++ b/src/ft_draw_life_bar.c
@@ -38,24 +38,22 @@ static void
{
int32_t x_ratio;
int32_t y_ratio;
- int16_t x;
- int16_t y;
+ int32_t x;
+ int32_t y;
- x_ratio = (int)((cl->tnum[10].img_w << 16) / (8 * cl->mlist.scale)) + 1;
- y_ratio = (int)((cl->tnum[10].img_h << 16) /
- ((cl->mlist.map_h * cl->mlist.scale))) + 1;
+ x_ratio = (int)((cl->tnum[10].img_w << 16) / (cl->mlist.map_w * cl->mlist.scale)) + 1;
+ y_ratio = (int)((cl->tnum[10].img_h << 16) / (cl->mlist.map_h * cl->mlist.scale)) + 1;
y = cl->wlist.y_size - (cl->mlist.map_h * cl->mlist.scale) - 10;
- while (y < (int16_t)cl->wlist.y_size - 10)
+ while (y < (int32_t)(cl->wlist.y_size - (cl->mlist.map_h * cl->mlist.scale) - 10 + (8 * cl->mlist.scale)))
{
cl->tnum[10].tex_y = (y * y_ratio) >> 16;
- x = ((cl->mlist.map_w * cl->mlist.scale) + 20 + ((32 * cl->mlist.scale)
- - ((32 * cl->mlist.scale) / 4)));
- while (x < (int16_t)((cl->mlist.map_w * cl->mlist.scale)
+ x = ((cl->mlist.map_w * cl->mlist.scale) + 20);
+ while (x < (int32_t)((cl->mlist.map_w * cl->mlist.scale)
+ 10 + ((32 * cl->mlist.scale))))
{
cl->tnum[10].tex_x = (x * x_ratio) >> 16;
- /* if (cl->tnum[10].ptr[cl->tnum[10].tex_x * 4 + 4 * */
- /* cl->tnum[10].img_h * cl->tnum[10].tex_y]) */
+ if (cl->tnum[10].ptr[cl->tnum[10].tex_x * 4 + 4 *
+ cl->tnum[10].img_h * cl->tnum[10].tex_y])
ft_draw_tnum(10, y, x, cl);
x++;
}
@@ -68,10 +66,11 @@ void
{
char *num;
float calc;
+
+ ft_put_percent_image(cl);
calc = ((float)cl->plist.life / (float)FT_STRT_LIFE) * 100.0;
if (!(num = ft_itoa((int64_t)calc)))
ft_error(FT_RET_ALLOC_ERR, FT_ERR_ALLOCATE, cl);
- ft_put_percent_image(cl);
/* ft_put_image_from_number(num, cl); */
ft_memdel((void*)&num);
}
diff --git a/src/ft_tex_init.c b/src/ft_tex_init.c
index 5e445ce..ecbb568 100644
--- a/src/ft_tex_init.c
+++ b/src/ft_tex_init.c
@@ -43,46 +43,46 @@
static void
ft_init_numbers(t_cub *cl)
{
- cl->tnum[0].img = mlx_xpm_file_to_image(cl->wlist.wlx,
- FT_ZER_PATH, &cl->tnum[0].img_w, &cl->tnum[0].img_h);
- cl->tnum[0].ptr = mlx_get_data_addr(cl->tnum[0].img,
- &cl->tnum[0].bpp, &cl->tnum[0].sizeline, &cl->tnum[0].endian);
- cl->tnum[1].img = mlx_xpm_file_to_image(cl->wlist.wlx,
- FT_ONE_PATH, &cl->tnum[1].img_w, &cl->tnum[1].img_h);
- cl->tnum[1].ptr = mlx_get_data_addr(cl->tnum[1].img,
- &cl->tnum[1].bpp, &cl->tnum[1].sizeline, &cl->tnum[1].endian);
- cl->tnum[2].img = mlx_xpm_file_to_image(cl->wlist.wlx,
- FT_TWO_PATH, &cl->tnum[2].img_w, &cl->tnum[2].img_h);
- cl->tnum[2].ptr = mlx_get_data_addr(cl->tnum[2].img,
- &cl->tnum[2].bpp, &cl->tnum[2].sizeline, &cl->tnum[2].endian);
- cl->tnum[3].img = mlx_xpm_file_to_image(cl->wlist.wlx,
- FT_THR_PATH, &cl->tnum[3].img_w, &cl->tnum[3].img_h);
- cl->tnum[3].ptr = mlx_get_data_addr(cl->tnum[3].img,
- &cl->tnum[3].bpp, &cl->tnum[3].sizeline, &cl->tnum[3].endian);
- cl->tnum[4].img = mlx_xpm_file_to_image(cl->wlist.wlx,
- FT_FOU_PATH, &cl->tnum[4].img_w, &cl->tnum[4].img_h);
- cl->tnum[4].ptr = mlx_get_data_addr(cl->tnum[4].img,
- &cl->tnum[4].bpp, &cl->tnum[4].sizeline, &cl->tnum[4].endian);
- cl->tnum[5].img = mlx_xpm_file_to_image(cl->wlist.wlx,
- FT_FIV_PATH, &cl->tnum[5].img_w, &cl->tnum[5].img_h);
- cl->tnum[5].ptr = mlx_get_data_addr(cl->tnum[5].img,
- &cl->tnum[5].bpp, &cl->tnum[5].sizeline, &cl->tnum[5].endian);
- cl->tnum[6].img = mlx_xpm_file_to_image(cl->wlist.wlx,
- FT_SIX_PATH, &cl->tnum[6].img_w, &cl->tnum[6].img_h);
- cl->tnum[6].ptr = mlx_get_data_addr(cl->tnum[6].img,
- &cl->tnum[6].bpp, &cl->tnum[6].sizeline, &cl->tnum[6].endian);
- cl->tnum[7].img = mlx_xpm_file_to_image(cl->wlist.wlx,
- FT_SEV_PATH, &cl->tnum[7].img_w, &cl->tnum[7].img_h);
- cl->tnum[7].ptr = mlx_get_data_addr(cl->tnum[7].img,
- &cl->tnum[7].bpp, &cl->tnum[7].sizeline, &cl->tnum[7].endian);
- cl->tnum[8].img = mlx_xpm_file_to_image(cl->wlist.wlx,
- FT_EIG_PATH, &cl->tnum[8].img_w, &cl->tnum[8].img_h);
- cl->tnum[8].ptr = mlx_get_data_addr(cl->tnum[8].img,
- &cl->tnum[8].bpp, &cl->tnum[8].sizeline, &cl->tnum[8].endian);
- cl->tnum[9].img = mlx_xpm_file_to_image(cl->wlist.wlx,
- FT_NIN_PATH, &cl->tnum[9].img_w, &cl->tnum[9].img_h);
- cl->tnum[9].ptr = mlx_get_data_addr(cl->tnum[9].img,
- &cl->tnum[9].bpp, &cl->tnum[9].sizeline, &cl->tnum[9].endian);
+ /* cl->tnum[0].img = mlx_xpm_file_to_image(cl->wlist.wlx, */
+ /* FT_ZER_PATH, &cl->tnum[0].img_w, &cl->tnum[0].img_h); */
+ /* cl->tnum[0].ptr = mlx_get_data_addr(cl->tnum[0].img, */
+ /* &cl->tnum[0].bpp, &cl->tnum[0].sizeline, &cl->tnum[0].endian); */
+ /* cl->tnum[1].img = mlx_xpm_file_to_image(cl->wlist.wlx, */
+ /* FT_ONE_PATH, &cl->tnum[1].img_w, &cl->tnum[1].img_h); */
+ /* cl->tnum[1].ptr = mlx_get_data_addr(cl->tnum[1].img, */
+ /* &cl->tnum[1].bpp, &cl->tnum[1].sizeline, &cl->tnum[1].endian); */
+ /* cl->tnum[2].img = mlx_xpm_file_to_image(cl->wlist.wlx, */
+ /* FT_TWO_PATH, &cl->tnum[2].img_w, &cl->tnum[2].img_h); */
+ /* cl->tnum[2].ptr = mlx_get_data_addr(cl->tnum[2].img, */
+ /* &cl->tnum[2].bpp, &cl->tnum[2].sizeline, &cl->tnum[2].endian); */
+ /* cl->tnum[3].img = mlx_xpm_file_to_image(cl->wlist.wlx, */
+ /* FT_THR_PATH, &cl->tnum[3].img_w, &cl->tnum[3].img_h); */
+ /* cl->tnum[3].ptr = mlx_get_data_addr(cl->tnum[3].img, */
+ /* &cl->tnum[3].bpp, &cl->tnum[3].sizeline, &cl->tnum[3].endian); */
+ /* cl->tnum[4].img = mlx_xpm_file_to_image(cl->wlist.wlx, */
+ /* FT_FOU_PATH, &cl->tnum[4].img_w, &cl->tnum[4].img_h); */
+ /* cl->tnum[4].ptr = mlx_get_data_addr(cl->tnum[4].img, */
+ /* &cl->tnum[4].bpp, &cl->tnum[4].sizeline, &cl->tnum[4].endian); */
+ /* cl->tnum[5].img = mlx_xpm_file_to_image(cl->wlist.wlx, */
+ /* FT_FIV_PATH, &cl->tnum[5].img_w, &cl->tnum[5].img_h); */
+ /* cl->tnum[5].ptr = mlx_get_data_addr(cl->tnum[5].img, */
+ /* &cl->tnum[5].bpp, &cl->tnum[5].sizeline, &cl->tnum[5].endian); */
+ /* cl->tnum[6].img = mlx_xpm_file_to_image(cl->wlist.wlx, */
+ /* FT_SIX_PATH, &cl->tnum[6].img_w, &cl->tnum[6].img_h); */
+ /* cl->tnum[6].ptr = mlx_get_data_addr(cl->tnum[6].img, */
+ /* &cl->tnum[6].bpp, &cl->tnum[6].sizeline, &cl->tnum[6].endian); */
+ /* cl->tnum[7].img = mlx_xpm_file_to_image(cl->wlist.wlx, */
+ /* FT_SEV_PATH, &cl->tnum[7].img_w, &cl->tnum[7].img_h); */
+ /* cl->tnum[7].ptr = mlx_get_data_addr(cl->tnum[7].img, */
+ /* &cl->tnum[7].bpp, &cl->tnum[7].sizeline, &cl->tnum[7].endian); */
+ /* cl->tnum[8].img = mlx_xpm_file_to_image(cl->wlist.wlx, */
+ /* FT_EIG_PATH, &cl->tnum[8].img_w, &cl->tnum[8].img_h); */
+ /* cl->tnum[8].ptr = mlx_get_data_addr(cl->tnum[8].img, */
+ /* &cl->tnum[8].bpp, &cl->tnum[8].sizeline, &cl->tnum[8].endian); */
+ /* cl->tnum[9].img = mlx_xpm_file_to_image(cl->wlist.wlx, */
+ /* FT_NIN_PATH, &cl->tnum[9].img_w, &cl->tnum[9].img_h); */
+ /* cl->tnum[9].ptr = mlx_get_data_addr(cl->tnum[9].img, */
+ /* &cl->tnum[9].bpp, &cl->tnum[9].sizeline, &cl->tnum[9].endian); */
cl->tnum[10].img = mlx_xpm_file_to_image(cl->wlist.wlx,
FT_PER_PATH, &cl->tnum[10].img_w, &cl->tnum[10].img_h);
cl->tnum[10].ptr = mlx_get_data_addr(cl->tnum[10].img,