Merge remote-tracking branch 'origin/master' into raph
This commit is contained in:
commit
97dd0ac698
6 changed files with 99 additions and 3 deletions
2
.clangd
2
.clangd
|
|
@ -2,6 +2,8 @@ CompileFlags:
|
||||||
Add:
|
Add:
|
||||||
- "-Werror -Wextra -Wall"
|
- "-Werror -Wextra -Wall"
|
||||||
- "-I/opt/X11/include"
|
- "-I/opt/X11/include"
|
||||||
|
- "-I/home/raphael/Documents/42_cursus/circle4/Cub3D/includes"
|
||||||
|
- "-I/home/raphael/Documents/42_cursus/circle4/Cub3D/includes/include"
|
||||||
- "-I/Users/raphael/Documents/42_cursus/circle4/Cub3D/includes"
|
- "-I/Users/raphael/Documents/42_cursus/circle4/Cub3D/includes"
|
||||||
- "-I/Users/raphael/Documents/42_cursus/circle4/Cub3D/includes/include"
|
- "-I/Users/raphael/Documents/42_cursus/circle4/Cub3D/includes/include"
|
||||||
- "-I/home/iron/Documents/code/42school/Cub3D/includes"
|
- "-I/home/iron/Documents/code/42school/Cub3D/includes"
|
||||||
|
|
|
||||||
1
.envrc
Normal file
1
.envrc
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
||||||
31
flake.nix
Normal file
31
flake.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
description = "Flake utils demo";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
c_formatter_42.url = "github:maix0/c_formatter_42-flake";
|
||||||
|
};
|
||||||
|
outputs = {
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
flake-utils,
|
||||||
|
c_formatter_42,
|
||||||
|
}:
|
||||||
|
flake-utils.lib.eachDefaultSystem (
|
||||||
|
system: let
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
in {
|
||||||
|
devShell = pkgs.mkShell {
|
||||||
|
packages = [
|
||||||
|
pkgs.xorg.libX11
|
||||||
|
pkgs.xorg.libXext
|
||||||
|
pkgs.clang
|
||||||
|
pkgs.clang-tools
|
||||||
|
pkgs.norminette
|
||||||
|
c_formatter_42.packages.${system}.default
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/10/30 16:30:26 by rparodi #+# #+# */
|
/* Created: 2024/10/30 16:30:26 by rparodi #+# #+# */
|
||||||
/* Updated: 2024/11/12 08:33:12 by bgoulard ### ########.fr */
|
/* Updated: 2024/11/13 06:56:05 by bgoulard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -20,6 +20,10 @@
|
||||||
|
|
||||||
# include <stdbool.h>
|
# include <stdbool.h>
|
||||||
|
|
||||||
|
/// @brief Createsa a blank map for rapahael to test the raycasting
|
||||||
|
/// @note Dev only function.
|
||||||
|
void blank(t_info *info);
|
||||||
|
|
||||||
int init_mlx_env(t_info *info);
|
int init_mlx_env(t_info *info);
|
||||||
|
|
||||||
void cleanup_info(t_info *info);
|
void cleanup_info(t_info *info);
|
||||||
|
|
|
||||||
59
parsing/blank_for_raph.c
Normal file
59
parsing/blank_for_raph.c
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* blank_for_raph.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2024/11/13 06:44:42 by bgoulard #+# #+# */
|
||||||
|
/* Updated: 2024/11/13 06:55:09 by bgoulard ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "cub3d_struct.h"
|
||||||
|
|
||||||
|
#include "ft_string.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
static t_tile char_to_tile(char c)
|
||||||
|
{
|
||||||
|
if (c == '1' || c == ' ')
|
||||||
|
return (WALL);
|
||||||
|
return (EMPTY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @brief Createsa a blank map for rapahael to test the raycasting
|
||||||
|
/// @param info The structure containing the information about the game
|
||||||
|
/// @return void
|
||||||
|
/// @note based on map:
|
||||||
|
/// 11111
|
||||||
|
/// 10001
|
||||||
|
/// 10S01
|
||||||
|
/// 10001
|
||||||
|
/// 10111
|
||||||
|
/// 111
|
||||||
|
/// @note The blank does not fill in the textures.
|
||||||
|
void blank(t_info *info)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
info->map.size.x = 5;
|
||||||
|
info->map.size.y = 6;
|
||||||
|
info->map.player_pos.x = 2.5;
|
||||||
|
info->map.player_pos.y = 2.5;
|
||||||
|
info->map.fraw = malloc(sizeof(char *) * 6);
|
||||||
|
info->map.fraw[0] = ft_strdup("11111");
|
||||||
|
info->map.fraw[1] = ft_strdup("10001");
|
||||||
|
info->map.fraw[2] = ft_strdup("10S01");
|
||||||
|
info->map.fraw[3] = ft_strdup("10001");
|
||||||
|
info->map.fraw[4] = ft_strdup("10111");
|
||||||
|
info->map.fraw[5] = ft_strdup("11111");
|
||||||
|
info->map.map = ft_calloc(sizeof(t_tile), (info->map.size.y * info->map.size.x));
|
||||||
|
|
||||||
|
while (i < info->map.size.y * info->map.size.x)
|
||||||
|
{
|
||||||
|
info->map.map[i] = char_to_tile (
|
||||||
|
info->map.fraw[i / info->map.size.x][i % info->map.size.x]);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/10/30 16:30:03 by rparodi #+# #+# */
|
/* Created: 2024/10/30 16:30:03 by rparodi #+# #+# */
|
||||||
/* Updated: 2024/11/12 09:50:01 by bgoulard ### ########.fr */
|
/* Updated: 2024/11/13 06:56:50 by bgoulard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -61,7 +61,6 @@ void run_cub3d(t_info *info)
|
||||||
if (info->last_error != NO_ERROR)
|
if (info->last_error != NO_ERROR)
|
||||||
return ;
|
return ;
|
||||||
// todo: here
|
// todo: here
|
||||||
// - parse map
|
|
||||||
// - validity check
|
// - validity check
|
||||||
init_mlx_env(info);
|
init_mlx_env(info);
|
||||||
mlx_loop(info->mlx_ptr);
|
mlx_loop(info->mlx_ptr);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue