summaryrefslogtreecommitdiff
path: root/game_draw.c
diff options
context:
space:
mode:
Diffstat (limited to 'game_draw.c')
-rw-r--r--game_draw.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/game_draw.c b/game_draw.c
new file mode 100644
index 0000000..ed91aa4
--- /dev/null
+++ b/game_draw.c
@@ -0,0 +1,38 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* game_draw.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: kdx <kdx @student.42angouleme.fr +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2022/10/12 10:10:28 by kdx #+# #+# */
+/* Updated: 2022/10/14 03:28:39 by kdx ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "game.h"
+#include "map.h"
+#include "player.h"
+#include "sprite.h"
+#include "badeline.h"
+
+void game_draw(t_game *game)
+{
+ t_sprite *s_exit;
+
+ if (game->redraw)
+ {
+ game->redraw = 0;
+ map_draw(game->sily, &game->map);
+ sily_input_draw(game->sily);
+ }
+ s_exit = game->ss_exit->frame[(game->sily->tick / 10)
+ % game->ss_exit->frame_count];
+ badeline_erase(game->sily, &game->badeline);
+ player_erase(game->sily, game->player.old_pos);
+ sprite_draw(game->sily, s_exit, game->map.exit[0], game->map.exit[1]);
+ badeline_draw(game->sily, &game->badeline);
+ player_draw(game->sily, &game->player);
+ if (game->sily->prev_move_events != game->sily->move_events)
+ sily_input_draw(game->sily);
+}