dev: reorganize global variables and constants
This commit is contained in:
parent
a395676ee9
commit
5992784dce
26 changed files with 401 additions and 356 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/29 17:43:01 by mcolonna #+# #+# */
|
||||
/* Updated: 2024/04/19 13:00:28 by mcolonna ### ########.fr */
|
||||
/* Updated: 2024/04/20 13:20:36 by mcolonna ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -25,10 +25,8 @@ typedef struct s_assetmeta
|
|||
bool opaque;
|
||||
} t_assetmeta;
|
||||
|
||||
extern const t_assetmeta g_assetsmap[NB_ASSETS];
|
||||
|
||||
/**
|
||||
* Index for each asset. Must be in the same order than g_assetsmap.
|
||||
* Index for each asset. Must be in the same order than g_consts.assetsmap.
|
||||
* The frames of an animation must be together and sorted.
|
||||
* The images of an object with directions must be in this order:
|
||||
* down, up, left, right
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/03/11 15:56:31 by mcolonna #+# #+# */
|
||||
/* Updated: 2024/04/19 12:59:36 by mcolonna ### ########.fr */
|
||||
/* Updated: 2024/04/20 13:24:27 by mcolonna ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -32,8 +32,6 @@ typedef struct s_spritemeta
|
|||
int delay_frame;
|
||||
} t_spritemeta;
|
||||
|
||||
extern const t_spritemeta g_spritesmap[NB_SPRITES];
|
||||
|
||||
typedef enum e_spritesmap_id
|
||||
{
|
||||
CASE_BORDER_TOP,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/02 13:53:41 by mcolonna #+# #+# */
|
||||
/* Updated: 2024/04/18 21:00:20 by mcolonna ### ########.fr */
|
||||
/* Updated: 2024/04/20 13:32:27 by mcolonna ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -27,6 +27,8 @@
|
|||
# include "libtf.h"
|
||||
# include "mlx.h"
|
||||
|
||||
# include "main/main.h"
|
||||
|
||||
# include "utils/direction.h"
|
||||
# include "utils/point.h"
|
||||
# include "utils/map.h"
|
||||
|
|
@ -53,6 +55,5 @@
|
|||
# include "main/env.h"
|
||||
# include "main/input.h"
|
||||
# include "main/timedloop.h"
|
||||
# include "main/main.h"
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/26 15:26:13 by mcolonna #+# #+# */
|
||||
/* Updated: 2024/04/20 12:47:22 by mcolonna ### ########.fr */
|
||||
/* Updated: 2024/04/20 15:46:49 by mcolonna ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -18,15 +18,13 @@
|
|||
# define WINDOW_TITLE "undretale"
|
||||
# define FPS 20
|
||||
# define TEXT_SPACE 9
|
||||
|
||||
# define LEVEL_COUNT 10
|
||||
|
||||
extern const t_const_string g_levels[LEVEL_COUNT];
|
||||
|
||||
typedef struct s_env
|
||||
{
|
||||
// GLOBAL
|
||||
t_memclass mc;
|
||||
t_loopfunctions loopfunctions;
|
||||
|
||||
// IO
|
||||
// display
|
||||
|
|
@ -49,8 +47,16 @@ typedef struct s_env
|
|||
int max_ketchup;
|
||||
// moves
|
||||
int moves;
|
||||
} t_env;
|
||||
|
||||
} t_env;
|
||||
extern t_env g_env;
|
||||
|
||||
typedef struct s_consts
|
||||
{
|
||||
t_const_string levels[LEVEL_COUNT];
|
||||
t_assetmeta assetsmap[NB_ASSETS];
|
||||
t_spritemeta spritesmap[NB_SPRITES];
|
||||
t_roomcase roomcases[];
|
||||
} t_consts;
|
||||
extern const t_consts g_consts;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/02 13:39:54 by mcolonna #+# #+# */
|
||||
/* Updated: 2024/04/17 13:17:59 by mcolonna ### ########.fr */
|
||||
/* Updated: 2024/04/20 13:29:14 by mcolonna ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -19,8 +19,6 @@ typedef struct s_loopfunctions
|
|||
void (*draw)(void);
|
||||
} t_loopfunctions;
|
||||
|
||||
extern t_loopfunctions g_loopfunctions;
|
||||
|
||||
int main(int argc, t_const_string *argv);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,13 +6,20 @@
|
|||
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/03/07 23:00:45 by mcolonna #+# #+# */
|
||||
/* Updated: 2024/04/18 13:32:49 by mcolonna ### ########.fr */
|
||||
/* Updated: 2024/04/20 15:45:36 by mcolonna ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef ROOM_H
|
||||
# define ROOM_H
|
||||
|
||||
typedef struct s_roomcase
|
||||
{
|
||||
char c;
|
||||
t_object_init object;
|
||||
t_spritesmap_id surface;
|
||||
} t_roomcase;
|
||||
|
||||
typedef struct s_room
|
||||
{
|
||||
int width;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue