start project with header, struct, mlx functionnal, and basic key event action
This commit is contained in:
23
srcs/init/init_struct.c
Normal file
23
srcs/init/init_struct.c
Normal 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user