start project with header, struct, mlx functionnal, and basic key event action

This commit is contained in:
hugogogo
2022-03-23 14:27:36 +01:00
parent 1959a1a9a3
commit 95bd304708
11 changed files with 228 additions and 1 deletions

23
srcs/init/init_struct.c Normal file
View File

@@ -0,0 +1,23 @@
#include "cube3d.h"
t_game *init_game(void)
{
t_game *game;
game = malloc(sizeof(t_game));
// player first position
game->plr_x = 16;
game->plr_y = 16;
// size window
game->win_size_x = 500;
game->win_size_y = 500;
// init connexion to server
game->mlx_ptr = mlx_init();
// create the window
game->win_ptr = mlx_new_window(game->mlx_ptr, game->win_size_x, game->win_size_y, "test");
// fill k_hook with zeros (key_hook, the array containing the values of key press)
ft_bzero(&game->k_hook, sizeof(game->k_hook));
return (game);
}