Coding style

This commit is contained in:
Anonymus Raccoon
2020-03-27 14:45:51 +01:00
parent 0c9a711629
commit e0fd5ce7dd
9 changed files with 73 additions and 42 deletions
+6 -3
View File
@@ -1,6 +1,9 @@
// /*
// Created by anonymus-raccoon on 3/3/20. ** EPITECH PROJECT, 2019
// ** MUL_my_runner_2019
** File description:
** runner
*/
#ifndef _TEAMS_COMPONENT_C_ #ifndef _TEAMS_COMPONENT_C_
#define _TEAMS_COMPONENT_H_ #define _TEAMS_COMPONENT_H_
+6 -3
View File
@@ -1,6 +1,9 @@
// /*
// Created by anonymus-raccoon on 3/6/20. ** EPITECH PROJECT, 2019
// ** MUL_my_runner_2019
** File description:
** runner
*/
#ifndef _DPR_ERRORS_H_ #ifndef _DPR_ERRORS_H_
#define _DPR_ERRORS_H_ #define _DPR_ERRORS_H_
+27 -14
View File
@@ -10,21 +10,34 @@
#define ERROR 84 #define ERROR 84
#include "scene.h" #include "scene.h"
int start_game(); int start_game(void);
bool start_button(gc_engine *engine, gc_entity *entity, gc_vector2 _); bool start_button(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
bool options(gc_engine *engine, gc_entity *entity, gc_vector2 _); enum gc_mousekeys __);
bool goto_main_menu(gc_engine *engine, gc_entity *entity, gc_vector2 _); bool options(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
bool quit(gc_engine *engine, gc_entity *entity, gc_vector2 _); enum gc_mousekeys __);
bool catch(gc_engine *engine, gc_entity *entity, gc_vector2 _); bool goto_main_menu(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
bool toggle_pause(gc_engine *engine, gc_entity *entity, gc_vector2 _); enum gc_mousekeys __);
bool quit(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
enum gc_mousekeys __);
bool catch(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
enum gc_mousekeys __);
bool toggle_pause(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
enum gc_mousekeys __);
int checkbox_update(gc_scene *s, gc_entity *entity, bool checked); int checkbox_update(gc_scene *s, gc_entity *entity, bool checked);
void resolution_set_text(gc_entity *entity, gc_engine *engine); void resolution_set_txt(gc_entity *entity, gc_engine *engine, \
void framerate_set_text(gc_entity *entity, gc_engine *engine); enum gc_mousekeys __);
void framerate_set_text(gc_entity *entity, gc_engine *engine, \
enum gc_mousekeys __);
bool fullscreen(gc_engine *engine, gc_entity *entity, gc_vector2 _); bool fullscreen(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
bool resolution_down(gc_engine *engine, gc_entity *entity, gc_vector2 _); enum gc_mousekeys __);
bool resolution_up(gc_engine *engine, gc_entity *entity, gc_vector2 _); bool resolution_down(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
bool framerate_up(gc_engine *engine, gc_entity *entity, gc_vector2 _); enum gc_mousekeys __);
bool framerate_down(gc_engine *engine, gc_entity *entity, gc_vector2 _); bool resolution_up(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
enum gc_mousekeys __);
bool framerate_up(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
enum gc_mousekeys __);
bool framerate_down(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
enum gc_mousekeys __);
+6 -3
View File
@@ -1,6 +1,9 @@
// /*
// Created by anonymus-raccoon on 3/9/20. ** EPITECH PROJECT, 2019
// ** MUL_my_runner_2019
** File description:
** runner
*/
#ifndef _GAME_MANAGER_SYSTEM_H_ #ifndef _GAME_MANAGER_SYSTEM_H_
#define _GAME_MANAGER_SYSTEM_H_ #define _GAME_MANAGER_SYSTEM_H_
-2
View File
@@ -13,12 +13,10 @@
static void ctr(void *component, va_list args) static void ctr(void *component, va_list args)
{ {
struct game_manager *cmp = (struct game_manager *)component;
} }
static void fdctr(gc_entity *entity, gc_scene *scene, void *component, node *n) static void fdctr(gc_entity *entity, gc_scene *scene, void *component, node *n)
{ {
struct game_manager *cmp = (struct game_manager *)component;
if (scene->get_entity_by_cmp(scene, "game_manager")) if (scene->get_entity_by_cmp(scene, "game_manager"))
my_printf(MULTIPLE_GAME_MGR_ERROR); my_printf(MULTIPLE_GAME_MGR_ERROR);
} }
+4 -2
View File
@@ -36,7 +36,8 @@ void framerate_set_text(gc_entity *entity, gc_engine *engine)
((gc_text *)renderer->data)->text = framerate; ((gc_text *)renderer->data)->text = framerate;
} }
bool framerate_down(gc_engine *engine, gc_entity *entity, gc_vector2 _) bool framerate_down(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
enum gc_mousekeys __)
{ {
struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system); struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system);
int i = 2; int i = 2;
@@ -51,7 +52,8 @@ bool framerate_down(gc_engine *engine, gc_entity *entity, gc_vector2 _)
return (true); return (true);
} }
bool framerate_up(gc_engine *engine, gc_entity *entity, gc_vector2 _) bool framerate_up(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
enum gc_mousekeys __)
{ {
struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system); struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system);
int i = 0; int i = 0;
+12 -7
View File
@@ -11,7 +11,8 @@
#include "setup.h" #include "setup.h"
#include "my.h" #include "my.h"
bool start_button(gc_engine *engine, gc_entity *entity, gc_vector2 _) bool start_button(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
enum gc_mousekeys __)
{ {
gc_scene *scene = scene_create(engine, "prefabs/game.gcprefab"); gc_scene *scene = scene_create(engine, "prefabs/game.gcprefab");
if (!scene) { if (!scene) {
@@ -23,7 +24,8 @@ bool start_button(gc_engine *engine, gc_entity *entity, gc_vector2 _)
return (true); return (true);
} }
bool options(gc_engine *engine, gc_entity *entity, gc_vector2 _) bool options(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
enum gc_mousekeys __)
{ {
gc_scene *scene = scene_create(engine, "prefabs/options.gcprefab"); gc_scene *scene = scene_create(engine, "prefabs/options.gcprefab");
struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system); struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system);
@@ -38,13 +40,14 @@ bool options(gc_engine *engine, gc_entity *entity, gc_vector2 _)
if (rend) if (rend)
checkbox_update(engine->scene, entity, rend->is_fullscreen); checkbox_update(engine->scene, entity, rend->is_fullscreen);
entity = engine->scene->get_entity(engine->scene, 51); entity = engine->scene->get_entity(engine->scene, 51);
resolution_set_text(entity, engine); resolution_set_txt(entity, engine, 0);
entity = engine->scene->get_entity(engine->scene, 52); entity = engine->scene->get_entity(engine->scene, 52);
framerate_set_text(entity, engine); framerate_set_text(entity, engine, 0);
return (true); return (true);
} }
bool goto_main_menu(gc_engine *engine, gc_entity *entity, gc_vector2 _) bool goto_main_menu(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
enum gc_mousekeys __)
{ {
gc_scene *scene = scene_create(engine, "prefabs/mainmenu.gcprefab"); gc_scene *scene = scene_create(engine, "prefabs/mainmenu.gcprefab");
if (!scene) { if (!scene) {
@@ -56,13 +59,15 @@ bool goto_main_menu(gc_engine *engine, gc_entity *entity, gc_vector2 _)
return (true); return (true);
} }
bool quit(gc_engine *engine, gc_entity *entity, gc_vector2 _) bool quit(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
enum gc_mousekeys __)
{ {
engine->should_close = true; engine->should_close = true;
return (true); return (true);
} }
bool catch(gc_engine *engine, gc_entity *entity, gc_vector2 _) bool catch(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
enum gc_mousekeys __)
{ {
return (true); return (true);
} }
+11 -7
View File
@@ -38,7 +38,8 @@ int checkbox_update(gc_scene *s, gc_entity *entity, bool checked)
return (0); return (0);
} }
void resolution_set_text(gc_entity *entity, gc_engine *engine) void resolution_set_txt(gc_entity *entity, gc_engine *engine, \
enum gc_mousekeys __)
{ {
struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system); struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system);
struct renderer *renderer; struct renderer *renderer;
@@ -56,7 +57,8 @@ void resolution_set_text(gc_entity *entity, gc_engine *engine)
((gc_text *)renderer->data)->text = resolution; ((gc_text *)renderer->data)->text = resolution;
} }
bool fullscreen(gc_engine *engine, gc_entity *entity, gc_vector2 _) bool fullscreen(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
enum gc_mousekeys __)
{ {
struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system); struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system);
@@ -72,11 +74,12 @@ bool fullscreen(gc_engine *engine, gc_entity *entity, gc_vector2 _)
else else
rend->window = sfRenderWindow_create((sfVideoMode){rend->resolution.x, \ rend->window = sfRenderWindow_create((sfVideoMode){rend->resolution.x, \
rend->resolution.y, 32}, "My3D", sfDefaultStyle, NULL); rend->resolution.y, 32}, "My3D", sfDefaultStyle, NULL);
resolution_set_text(engine->scene->get_entity(engine->scene, 51), engine); resolution_set_txt(engine->scene->get_entity(engine->scene, 51), engine, 0);
return (true); return (true);
} }
bool resolution_down(gc_engine *engine, gc_entity *entity, gc_vector2 _) bool resolution_down(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
enum gc_mousekeys __)
{ {
struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system); struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system);
int i = 2; int i = 2;
@@ -90,11 +93,12 @@ bool resolution_down(gc_engine *engine, gc_entity *entity, gc_vector2 _)
resolutions[i].y resolutions[i].y
}); });
rend->resolution = resolutions[i]; rend->resolution = resolutions[i];
resolution_set_text(engine->scene->get_entity(engine->scene, 51), engine); resolution_set_txt(engine->scene->get_entity(engine->scene, 51), engine, 0);
return (true); return (true);
} }
bool resolution_up(gc_engine *engine, gc_entity *entity, gc_vector2 _) bool resolution_up(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
enum gc_mousekeys __)
{ {
struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system); struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system);
int i = 0; int i = 0;
@@ -110,6 +114,6 @@ bool resolution_up(gc_engine *engine, gc_entity *entity, gc_vector2 _)
resolutions[i].y resolutions[i].y
}); });
rend->resolution = resolutions[i]; rend->resolution = resolutions[i];
resolution_set_text(engine->scene->get_entity(engine->scene, 51), engine); resolution_set_txt(engine->scene->get_entity(engine->scene, 51), engine, 0);
return (true); return (true);
} }