From 8cec16bdb6f980565b29d5b55379e481018753f6 Mon Sep 17 00:00:00 2001 From: Dominik Kaiser Date: Thu, 9 May 2024 16:19:29 +0200 Subject: Setup basic structure and add basic input handling --- src/init.c | 31 +++++++++++++++++++++++++++++++ src/loop.c | 18 ++++++++++++++++++ src/main.c | 10 +++++++--- 3 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 src/init.c create mode 100644 src/loop.c (limited to 'src') diff --git a/src/init.c b/src/init.c new file mode 100644 index 0000000..569bed8 --- /dev/null +++ b/src/init.c @@ -0,0 +1,31 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* init.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: dkaiser mlx, loop, game); + /* mlx_key_hook(game->mlx, on_key_down, game); */ + mlx_hook(game->window, 2, 0, on_key_down, game); + mlx_hook(game->window, 3, 0, on_key_up, game); +} + +int init(t_game *game) +{ + game->mlx = mlx_init(); + game->window = mlx_new_window(game->mlx, 1920, 1080, "so_long"); + // TODO: make size and title dynamic + init_hooks(game); + return (0); +} diff --git a/src/loop.c b/src/loop.c new file mode 100644 index 0000000..506dad1 --- /dev/null +++ b/src/loop.c @@ -0,0 +1,18 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* loop.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: dkaiser