Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix all compilation warnings and errors. #72

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions include/buttons.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@

#include "rpg.h"

enum stats {
none,
HOVER,
ACTIVE,
RELEASE,
};
enum stats {
none,
HOVER,
ACTIVE,
RELEASE,
};

typedef struct {
sfVector2f pos;
sfVector2f size;
sfTexture *texture;
sfSprite *sprite;
sfRectangleShape *rect;
sfIntRect rect_text;
sfColor color;
sfText *text;
sfFont *font;
sfVector2f text_pos;
char *str;
enum stats state;
void (*callback)(void *);
} buttons_t;
typedef struct {
sfVector2f pos;
sfVector2f size;
sfTexture *texture;
sfSprite *sprite;
sfRectangleShape *rect;
sfIntRect rect_text;
sfColor color;
sfText *text;
sfFont *font;
sfVector2f text_pos;
char *str;
enum stats state;
void (*callback)(void *);
} buttons_t;

#endif /* !BUTTONS_H_ */
10 changes: 5 additions & 5 deletions include/clocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

#include "game.h"

typedef struct {
sfClock *clock;
sfTime time;
float seconds;
} clocks_t;
typedef struct {
sfClock *clock;
sfTime time;
float seconds;
} clocks_t;

#endif /* !CLOCKS_H_ */
22 changes: 11 additions & 11 deletions include/dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@

#include "game.h"

typedef struct {
char **dialog_text;
sfTexture *texture;
sfSprite *sprite;
sfText *text;
sfFont *font;
sfVector2f pos;
sfClock *clock;
sfTime time;
float seconds;
} dialog_box_t;
typedef struct {
char **dialog_text;
sfTexture *texture;
sfSprite *sprite;
sfText *text;
sfFont *font;
sfVector2f pos;
sfClock *clock;
sfTime time;
float seconds;
} dialog_box_t;

#endif /* !DIALOG_H_ */
26 changes: 13 additions & 13 deletions include/end.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@

#include "rpg.h"

typedef struct s_end {
sfRectangleShape *container;
sfRectangleShape *content;
sfText *text;
sfFont *font;
sfVector2f pos;
sfVector2f size;
sfVector2f pos_text;
sfVector2f size_text;
sfColor color;
sfColor color_text;
int is_end;
} end_t;
typedef struct s_end {
sfRectangleShape *container;
sfRectangleShape *content;
sfText *text;
sfFont *font;
sfVector2f pos;
sfVector2f size;
sfVector2f pos_text;
sfVector2f size_text;
sfColor color;
sfColor color_text;
int is_end;
} end_t;

#endif /* !END_H_ */
53 changes: 26 additions & 27 deletions include/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,34 @@
#include "clocks.h"
#include "network.h"
#include "end.h"

typedef struct {
window_t *window;
map_t *map;
perso_t *perso;
mobs_t **mobs;
buttons_t **start;
buttons_t *go_back;
params_t *params;
keys_t *keys;
int menu;
game_menu_t *game_menu;
save_t *save;
inventory_t *inventory;
overlay_t *overlay;
npc_t **npc;
dialog_box_t *dialogs;
clocks_t *clock;
network_t *network;
raycasting_t *raycasting;
bool is_raycasting;
end_t *win;
end_t *loose;
bool is_finished;
int nb_mob_killed;
} game_t;

#include "start.h"
#include "params_fonctions.h"
#include "game_functions.h"

typedef struct {
window_t *window;
map_t *map;
perso_t *perso;
mobs_t **mobs;
buttons_t **start;
buttons_t *go_back;
params_t *params;
keys_t *keys;
int menu;
game_menu_t *game_menu;
save_t *save;
inventory_t *inventory;
overlay_t *overlay;
npc_t **npc;
dialog_box_t *dialogs;
clocks_t *clock;
network_t *network;
raycasting_t *raycasting;
bool is_raycasting;
end_t *win;
end_t *loose;
bool is_finished;
int nb_mob_killed;
} game_t;

#endif /* !GAME_H_ */
32 changes: 16 additions & 16 deletions include/game_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@

#include "game.h"

void change_to_inventory(game_t *game);
void change_to_character(game_t *game);
void change_to_option(game_t *game);
void exit_start_all(game_t *game);
void change_to_quest(game_t *game);
void change_to_inventory(game_t *game);
void change_to_character(game_t *game);
void change_to_option(game_t *game);
void exit_start_all(game_t *game);
void change_to_quest(game_t *game);

typedef struct game_functions_s {
void (*function)(game_t *game);
} game_functions_t;
typedef struct game_functions_s {
void (*function)(game_t *game);
} game_functions_t;

static const game_functions_t MENU_FLAGS[] = {
{function : &change_to_inventory},
{function : &change_to_character},
{function : &change_to_quest},
{function : &change_to_option},
{function : &exit_start_all},
{function : NULL},
};
static const game_functions_t MENU_FLAGS[] = {
{function : &change_to_inventory},
{function : &change_to_character},
{function : &change_to_quest},
{function : &change_to_option},
{function : &exit_start_all},
{function : NULL},
};

#endif /* !GAME_FUNCTIONS_H_ */
56 changes: 28 additions & 28 deletions include/game_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,36 @@
#include "rpg.h"
#include "buttons.h"

typedef struct {
sfRectangleShape *container;
buttons_t **buttons;
} sidebar_t;
typedef struct {
sfRectangleShape *container;
buttons_t **buttons;
} sidebar_t;

typedef struct {
sfText **name;
sfText **value;
} character_t;
typedef struct {
sfText **name;
sfText **value;
} character_t;

typedef struct {
sfRectangleShape *container;
sfRectangleShape *content;
sfFont *font;
sfText *achievement;
sfRectangleShape *bar;
sfVector2f pos;
sfVector2f size;
int nb_achievement;
int nb_achievement_second;
} quest_t;
typedef struct {
sfRectangleShape *container;
sfRectangleShape *content;
sfFont *font;
sfText *achievement;
sfRectangleShape *bar;
sfVector2f pos;
sfVector2f size;
int nb_achievement;
int nb_achievement_second;
} quest_t;

typedef struct {
sfRectangleShape *container;
sfRectangleShape *content;
sidebar_t *sidebar;
character_t *character;
quest_t *quest;
sfFont *font;
sfText **title;
} game_menu_t;
typedef struct {
sfRectangleShape *container;
sfRectangleShape *content;
sidebar_t *sidebar;
character_t *character;
quest_t *quest;
sfFont *font;
sfText **title;
} game_menu_t;

#endif /* !GAME_MENU_H_ */
20 changes: 10 additions & 10 deletions include/inventory.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@

#include "rpg.h"

typedef struct {
sfRectangleShape *container;
sfRectangleShape *content;
sfTexture *texture;
sfVector2f pos;
} item_t;
typedef struct {
sfRectangleShape *container;
sfRectangleShape *content;
sfTexture *texture;
sfVector2f pos;
} item_t;

typedef struct {
item_t **items;
int item_selected;
} inventory_t;
typedef struct {
item_t **items;
int item_selected;
} inventory_t;

#endif /* !INVENTORY_H_ */
26 changes: 13 additions & 13 deletions include/keys.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@

#include "rpg.h"

typedef struct {
sfKeyCode up;
sfKeyCode down;
sfKeyCode left;
sfKeyCode right;
sfKeyCode space;
sfKeyCode attack;
sfKeyCode inventory;
sfKeyCode pause;
sfKeyCode interact;
sfKeyCode escape;
bool switch_keys;
} keys_t;
typedef struct {
sfKeyCode up;
sfKeyCode down;
sfKeyCode left;
sfKeyCode right;
sfKeyCode space;
sfKeyCode attack;
sfKeyCode inventory;
sfKeyCode pause;
sfKeyCode interact;
sfKeyCode escape;
bool switch_keys;
} keys_t;

#endif /* !KEYS_H_ */
22 changes: 11 additions & 11 deletions include/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@

#include "rpg.h"

typedef struct {
sfTexture *texture;
sfSprite *sprite;
sfTexture *iso_texture;
sfSprite *iso_sprite;
sfRectangleShape *rectangle;
sfVector2f scale;
sfVector2f pos;
sfImage *colls_image;
sfIntRect rect;
} map_t;
typedef struct {
sfTexture *texture;
sfSprite *sprite;
sfTexture *iso_texture;
sfSprite *iso_sprite;
sfRectangleShape *rectangle;
sfVector2f scale;
sfVector2f pos;
sfImage *colls_image;
sfIntRect rect;
} map_t;

#endif /* !MAP_H_ */
Loading
Loading