mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 09:58:09 +01:00
style: split structs.h header into multiple, remove from central dir
This commit is contained in:
parent
38a05423dd
commit
6322d05b22
19 changed files with 141 additions and 87 deletions
21
src/main.c
21
src/main.c
|
|
@ -6,12 +6,11 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */
|
||||
/* Updated: 2025/07/17 14:55:29 by kcolin ### ########.fr */
|
||||
/* Updated: 2025/07/17 15:52:57 by kcolin ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../libft/includes/libft.h"
|
||||
#include "../includes/structs.h"
|
||||
#include "../mlx/mlx.h"
|
||||
#include "consts.h"
|
||||
#include "map/map_checker.h"
|
||||
|
|
@ -34,11 +33,11 @@ int game_loop(t_cub3d_data *data)
|
|||
{
|
||||
data->player.x += data->player.movement.x;
|
||||
data->player.y += data->player.movement.y;
|
||||
mlx_destroy_image(data->mlx, data->mlx_data->img);
|
||||
data->mlx_data->img = mlx_new_image(data->mlx, 800, 600);
|
||||
draw_map(data->map, &data->player, data->mlx_data);
|
||||
mlx_destroy_image(data->mlx, data->img_data->img);
|
||||
data->img_data->img = mlx_new_image(data->mlx, 800, 600);
|
||||
draw_map(data->map, &data->player, data->img_data);
|
||||
mlx_put_image_to_window(data->mlx, data->mlx_win,
|
||||
data->mlx_data->img, 0, 0);
|
||||
data->img_data->img, 0, 0);
|
||||
mlx_string_put(data->mlx, data->mlx_win, 10, 10, 0x00FFFFFF, COMPILED_TEXT);
|
||||
return (0);
|
||||
}
|
||||
|
|
@ -55,11 +54,11 @@ int main(int argc, char **argv)
|
|||
data.map->error), 1);
|
||||
data.mlx = mlx_init();
|
||||
data.mlx_win = mlx_new_window(data.mlx, 800, 600, "Cub3d");
|
||||
data.mlx_data = ft_calloc(sizeof(t_mlx_data), 1);
|
||||
data.mlx_data->img = mlx_new_image(data.mlx, 800, 600);
|
||||
data.mlx_data->addr = mlx_get_data_addr(data.mlx_data->img,
|
||||
&data.mlx_data->bits_per_pixel, &data.mlx_data->line_length,
|
||||
&data.mlx_data->endian);
|
||||
data.img_data = ft_calloc(sizeof(t_img_data), 1);
|
||||
data.img_data->img = mlx_new_image(data.mlx, 800, 600);
|
||||
data.img_data->addr = mlx_get_data_addr(data.img_data->img,
|
||||
&data.img_data->bits_per_pixel, &data.img_data->line_length,
|
||||
&data.img_data->endian);
|
||||
init_player(data.map, &(data.player));
|
||||
mlx_hook(data.mlx_win, KeyPress, KeyPressMask, keypress_handler, &data);
|
||||
mlx_hook(data.mlx_win, KeyRelease, KeyReleaseMask,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue