start project with header, struct, mlx functionnal, and basic key event action
This commit is contained in:
14
headers/cube3d.h
Normal file
14
headers/cube3d.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef CUBE3D_H
|
||||
# define CUBE3D_H
|
||||
|
||||
#include "../libs/libft/includes/libft.h"
|
||||
#include <mlx.h>
|
||||
#include <unistd.h> // for sleep()
|
||||
#include <stdlib.h> // for atoi()
|
||||
#include <stdio.h> // for printf()
|
||||
|
||||
#include "cube3d_macro.h"
|
||||
#include "cube3d_struct.h"
|
||||
#include "cube3d_proto.h"
|
||||
|
||||
#endif
|
||||
21
headers/cube3d_macro.h
Normal file
21
headers/cube3d_macro.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef CUBE3D_MACRO_H
|
||||
# define CUBE3D_MACRO_H
|
||||
|
||||
# define MAX_NB_KEY 3
|
||||
|
||||
# define ARROW_LEFT 65361
|
||||
# define ARROW_UP 65362
|
||||
# define ARROW_RIGHT 65363
|
||||
# define ARROW_DOWN 65364
|
||||
# define KEY_A 97 // left
|
||||
# define KEY_Q 113 // left (azerty)
|
||||
# define KEY_D 100 // right
|
||||
# define KEY_S 115 // backward
|
||||
# define KEY_W 119 // forward
|
||||
# define KEY_Z 122 // forward (azerty)
|
||||
# define KEY_ESC 65307
|
||||
# define KEY_SHIFT_LEFT 65505
|
||||
# define KEY_SHIFT_RIGHT 65506
|
||||
# define KEY_SPACE 32
|
||||
|
||||
#endif
|
||||
40
headers/cube3d_proto.h
Normal file
40
headers/cube3d_proto.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef CUBE3D_PROTO_H
|
||||
# define CUBE3D_PROTO_H
|
||||
|
||||
// -------------------------------
|
||||
// SRC
|
||||
|
||||
|
||||
// -------------------------------
|
||||
// SRC/INIT
|
||||
|
||||
// init_struct.c
|
||||
t_game *init_game(void);
|
||||
|
||||
// init_parsing.c
|
||||
void init_parsing(int ac, char **av, t_game *game);
|
||||
|
||||
|
||||
// -------------------------------
|
||||
// SRC/PARSING
|
||||
|
||||
|
||||
// -------------------------------
|
||||
// SRC/HOOK
|
||||
|
||||
// key_hook.c
|
||||
int keypress(int keycode, t_game *game);
|
||||
|
||||
// key_do_action.c
|
||||
int shut_down(t_game *game);
|
||||
|
||||
|
||||
// -------------------------------
|
||||
// SRC/DRAW
|
||||
|
||||
|
||||
// -------------------------------
|
||||
// SRC/FREE
|
||||
|
||||
|
||||
#endif
|
||||
15
headers/cube3d_struct.h
Normal file
15
headers/cube3d_struct.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef CUBE3D_STRUCT_H
|
||||
# define CUBE3D_STRUCT_H
|
||||
|
||||
typedef struct s_game
|
||||
{
|
||||
void *mlx_ptr;
|
||||
void *win_ptr;
|
||||
int plr_x;
|
||||
int plr_y;
|
||||
int win_size_x;
|
||||
int win_size_y;
|
||||
int k_hook[MAX_NB_KEY];
|
||||
} t_game;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user