Merge branch 'master' of git.sr.ht:~xamora/cube3D
This commit is contained in:
commit
4aa1047dca
9
Makefile
9
Makefile
@ -1,8 +1,9 @@
|
|||||||
SRCS = main.c game/game.c
|
SRCS_GAME = main.c game/game.c
|
||||||
OBJS = ${SRCS:.c=.o}
|
SRCS_PARSING =
|
||||||
|
OBJS = ${SRCS_GAME:.c=.o} ${SRCS_PARSING:.c=.o}
|
||||||
CC = clang
|
CC = clang
|
||||||
LIBS = libftx/libftx.a MLX42/build/libmlx42.a
|
LIBS = libftx/libftx.a MLX42/build/libmlx42.a -ldl -lglfw -lm
|
||||||
CFLAGS = -g -Wall -Wextra -Werror
|
CFLAGS = -g -Wall -Wextra -Werror -Wno-conversion -Ofast
|
||||||
NAME = cub3D
|
NAME = cub3D
|
||||||
|
|
||||||
all: ${NAME}
|
all: ${NAME}
|
||||||
|
3
cube3D.h
3
cube3D.h
@ -6,7 +6,7 @@
|
|||||||
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/26 12:34:04 by erey-bet #+# #+# */
|
/* Created: 2023/04/26 12:34:04 by erey-bet #+# #+# */
|
||||||
/* Updated: 2023/04/26 14:51:27 by erey-bet ### ########.fr */
|
/* Updated: 2023/04/26 15:20:47 by erey-bet ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -18,6 +18,7 @@
|
|||||||
# include <X11/keysym.h>
|
# include <X11/keysym.h>
|
||||||
# include <X11/X.h>
|
# include <X11/X.h>
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
|
# include <stdio.h>
|
||||||
|
|
||||||
// img: 0=Nord, 1=WEST, 2=SUD, 3=EAST;
|
// img: 0=Nord, 1=WEST, 2=SUD, 3=EAST;
|
||||||
|
|
||||||
|
25
game/game.c
25
game/game.c
@ -6,7 +6,7 @@
|
|||||||
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/26 12:59:53 by erey-bet #+# #+# */
|
/* Created: 2023/04/26 12:59:53 by erey-bet #+# #+# */
|
||||||
/* Updated: 2023/04/26 14:47:50 by erey-bet ### ########.fr */
|
/* Updated: 2023/04/26 15:44:55 by erey-bet ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -14,12 +14,27 @@
|
|||||||
|
|
||||||
int start_game(t_map *map)
|
int start_game(t_map *map)
|
||||||
{
|
{
|
||||||
mlx_t *mlx;
|
t_game *game;
|
||||||
|
|
||||||
(void)map;
|
(void)map;
|
||||||
mlx = mlx_init(1920, 1080, "jan lili", true);
|
game->mlx = mlx_init(1920, 1080, "jan lili", true)
|
||||||
mlx_loop(mlx);
|
if (mlx)
|
||||||
mlx_terminate(mlx);
|
return (1);
|
||||||
|
game->window = mlx_new_image(game->mlx, 128, 128);
|
||||||
|
if (game->image)
|
||||||
|
{
|
||||||
|
mlx_close_window(game->mlx);
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
if (mlx_image_to_window(game->mlx, game->window, 0, 0) == -1)
|
||||||
|
{
|
||||||
|
mlx_close_window(game->mlx);
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
mlx_loop_hook(game->mlx, manage, game)
|
||||||
|
mlx_loop(game->mlx);
|
||||||
|
mlx_terminate(game->mlx);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
29
game/game.h
Normal file
29
game/game.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* game.h :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/04/26 15:29:34 by erey-bet #+# #+# */
|
||||||
|
/* Updated: 2023/04/26 15:38:47 by erey-bet ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#ifndef GAME_H
|
||||||
|
# define GAME_H
|
||||||
|
|
||||||
|
typedef struct s_player
|
||||||
|
{
|
||||||
|
double pos_x;
|
||||||
|
double pos_y;
|
||||||
|
} t_ply;
|
||||||
|
|
||||||
|
typedef struct s_game
|
||||||
|
{
|
||||||
|
mlx_t *mlx;
|
||||||
|
mlx_image_t *windows;
|
||||||
|
t_ply *ply;
|
||||||
|
} t_game;
|
||||||
|
|
||||||
|
#endif
|
4
main.c
4
main.c
@ -6,7 +6,7 @@
|
|||||||
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/26 12:44:55 by erey-bet #+# #+# */
|
/* Created: 2023/04/26 12:44:55 by erey-bet #+# #+# */
|
||||||
/* Updated: 2023/04/26 14:50:46 by erey-bet ### ########.fr */
|
/* Updated: 2023/04/26 15:20:32 by erey-bet ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -18,6 +18,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
{
|
{
|
||||||
|
printf("No argument");
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
/*map = map_parsing(argv[1]);
|
/*map = map_parsing(argv[1]);
|
||||||
@ -27,6 +28,7 @@ int main(int argc, char **argv)
|
|||||||
}*/
|
}*/
|
||||||
(void)argv;
|
(void)argv;
|
||||||
map = malloc(sizeof(t_map));
|
map = malloc(sizeof(t_map));
|
||||||
|
map->map = malloc(sizeof(char *) * 5);
|
||||||
map->map[0] = "11111";
|
map->map[0] = "11111";
|
||||||
map->map[1] = "10001";
|
map->map[1] = "10001";
|
||||||
map->map[2] = "10S01";
|
map->map[2] = "10S01";
|
||||||
|
Loading…
Reference in New Issue
Block a user