aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_draw_scene.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_draw_scene.c')
-rw-r--r--src/ft_draw_scene.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/ft_draw_scene.c b/src/ft_draw_scene.c
index 9461eef..f96eae6 100644
--- a/src/ft_draw_scene.c
+++ b/src/ft_draw_scene.c
@@ -15,6 +15,30 @@
#include <mlx.h>
#include <stdint.h>
+static int8_t
+ ft_put_stage(t_cub *clist)
+{
+ const uint32_t x = 15;
+ const uint32_t y = clist->wlist.y_size
+ - (clist->mlist.map_h * clist->mlist.scale) - 20;
+ const uint8_t len = 6 + ft_uintlen(clist->currlvl);
+ char *str;
+
+ if (!(str = (char*)malloc((len + 1) * sizeof(char))))
+ return (-1);
+ ft_sprintf(str, "Stage %hd", clist->currlvl);
+ if (clist->mlist.isnlvl)
+ {
+ mlx_string_put(clist->wlist.wlx,
+ clist->wlist.winptr,
+ x, y,
+ 0x00ff0000,
+ str);
+ }
+ ft_memdel((void**)&str);
+ return (0);
+}
+
void
ft_draw_scene(t_cub *clist)
{
@@ -24,9 +48,19 @@ void
&clist->img.sizeline, &clist->img.endian);
ft_castray(clist);
if (clist->ishud)
+ {
ft_draw_hud(clist);
+ ft_error(FT_RET_ALLOC_ERR, FT_ERR_ALLOCATE, clist);
+ }
mlx_put_image_to_window(clist->wlist.wlx,
clist->wlist.winptr, clist->img.img, 0, 0);
+ if (clist->ishud)
+ {
+ if (ft_put_stage(clist) < 0)
+ {
+ ft_error(FT_RET_ALLOC_ERR, FT_ERR_ALLOCATE, clist);
+ }
+ }
mlx_destroy_image(clist->wlist.wlx, clist->img.img);
}