improve gexit with init function and add basic mlx image gestion

This commit is contained in:
Hugo LAMY
2022-03-25 18:49:06 +01:00
parent 3a1036ccdc
commit 02b5d88ea5
45 changed files with 139 additions and 7042 deletions

View File

@@ -14,10 +14,15 @@ t_game *init_game(void)
// 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)
game->win_ptr = mlx_new_window(game->mlx_ptr, game->win_size_x,
game->win_size_y, "test");
// k(ey)_hook is the array containing the values of key press events
ft_bzero(&game->k_hook, sizeof(game->k_hook));
// create image and get its data address
game->img_ptr = mlx_new_image(game->mlx_ptr, game->win_size_x,
game->win_size_y);
game->img_data = mlx_get_data_addr(game->img_ptr, &(game->bpp),
&(game->sizel), &(game->endian));
return (game);
}