30 lines
823 B
C
30 lines
823 B
C
#include "cube3d.h"
|
|
|
|
t_game *init_game(void)
|
|
{
|
|
t_game *game;
|
|
|
|
game = mb_alloc(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();
|
|
mb_add(game->mlx_ptr);
|
|
// create the window
|
|
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);
|
|
}
|
|
|