diff --git a/include/components/controllable_component.h b/include/components/controllable_component.h deleted file mode 100644 index 0498b49..0000000 --- a/include/components/controllable_component.h +++ /dev/null @@ -1,21 +0,0 @@ -/* -** EPITECH PROJECT, 2019 -** Gamacon -** File description: -** movable_component -*/ - -#pragma once - -#include "component.h" -#include - -struct controllable_component -{ - gc_component base; - bool moving_left; - bool moving_right; - bool jumping; -}; - -extern const struct controllable_component controllable_component; \ No newline at end of file diff --git a/include/components/controllers/keyboard_controller.h b/include/components/controllers/keyboard_controller.h deleted file mode 100644 index 294fee0..0000000 --- a/include/components/controllers/keyboard_controller.h +++ /dev/null @@ -1,21 +0,0 @@ -/* -** EPITECH PROJECT, 2019 -** Gamacon -** File description: -** keyboard_component -*/ - -#pragma once - -#include "component.h" -#include - -struct keyboard_controller -{ - gc_component base; - int left_key; - int right_key; - int jump_key; -}; - -extern const struct keyboard_controller keyboard_controller; \ No newline at end of file diff --git a/include/map_utils.h b/include/map_utils.h index 094452e..6713266 100644 --- a/include/map_utils.h +++ b/include/map_utils.h @@ -9,7 +9,7 @@ #include #include "components/vertex_component.h" -#define ANGLE_X 45 +#define ANGLE_X 25 #define ANGLE_Y 35 #define ADD_VALUE 10 diff --git a/include/systems/controllers/keyboard_controller_system.h b/include/systems/controllers/keyboard_controller_system.h deleted file mode 100644 index 4ea1f3a..0000000 --- a/include/systems/controllers/keyboard_controller_system.h +++ /dev/null @@ -1,12 +0,0 @@ -/* -** EPITECH PROJECT, 2019 -** MUL_my_runner_2019 -** File description: -** texture_renderer_system -*/ - -#pragma once - -#include "system.h" - -extern const gc_system keyboard_controller_system; \ No newline at end of file diff --git a/include/vector2.h b/include/vector2.h index 421a66b..16b5fc7 100644 --- a/include/vector2.h +++ b/include/vector2.h @@ -23,6 +23,14 @@ typedef struct gc_vector2i int y; } gc_vector2i; +typedef struct gc_vector3 +{ + int x; + int y; + int z; +} gc_vector3; + + float gcvector_magnitude(gc_vector2 vec); gc_vector2 gcvector2_normilize(gc_vector2 vec); diff --git a/src/components/controllable_component.c b/src/components/controllable_component.c deleted file mode 100644 index 62fa2fc..0000000 --- a/src/components/controllable_component.c +++ /dev/null @@ -1,68 +0,0 @@ -/* -** EPITECH PROJECT, 2019 -** MUL_my_runner_2019 -** File description: -** controllable_component -*/ - -#include "xml.h" -#include "component.h" -#include "components/controllable_component.h" -#include "utility.h" -#include - -static void controllable_ctr(void *component, va_list args) -{ - struct controllable_component *cmp = (struct controllable_component *)\ -component; - - cmp->moving_left = false; - cmp->moving_right = false; - cmp->jumping = false; - (void)args; -} - -static void controllable_fdctr(gc_entity *entity, gc_scene *scene, \ -void *component, node *n) -{ - struct controllable_component *cmp = (struct controllable_component *)\ -component; - - cmp->moving_left = false; - cmp->moving_right = false; - cmp->jumping = false; - (void)scene; - (void)entity; - (void)n; -} - -static void controllable_dtr(void *component) -{ - (void)component; -} - -static char *controllable_serialize(void *component) -{ - (void)component; - return (NULL); -} - -const struct controllable_component controllable_component = { - base: { - name: "controllable_component", - size: sizeof(struct controllable_component), - dependencies: (char *[]){ - "movable_component", - "transform_component", - NULL - }, - ctr: &controllable_ctr, - fdctr: &controllable_fdctr, - dtr: &controllable_dtr, - serialize: &controllable_serialize, - destroy: &component_destroy - }, - moving_left: false, - moving_right: false, - jumping: false -}; \ No newline at end of file diff --git a/src/components/controllers/keyboard_controller.c b/src/components/controllers/keyboard_controller.c deleted file mode 100644 index 9e07f2a..0000000 --- a/src/components/controllers/keyboard_controller.c +++ /dev/null @@ -1,68 +0,0 @@ -/* -** EPITECH PROJECT, 2019 -** MUL_my_runner_2019 -** File description: -** keyboard_controller -*/ - - -#include "xml.h" -#include "component.h" -#include "components/controllable_component.h" -#include "components/controllers/keyboard_controller.h" -#include "utility.h" -#include - -static void ctr(void *component, va_list args) -{ - struct keyboard_controller *cmp = (struct keyboard_controller *)\ -component; - - cmp->left_key = va_arg(args, int); - cmp->right_key = va_arg(args, int); - cmp->jump_key = va_arg(args, int); -} - -static void fdctr(gc_entity *entity, gc_scene *scene, void *component, node *n) -{ - struct keyboard_controller *cmp = (struct keyboard_controller *)\ -component; - - cmp->left_key = xml_getintprop(n, "left"); - cmp->right_key = xml_getintprop(n, "right"); - cmp->jump_key = xml_getintprop(n, "jump"); - (void)scene; - (void)entity; -} - -static void dtr(void *component) -{ - (void)component; -} - -static char *serialize(void *component) -{ - (void)component; - return (NULL); -} - -const struct keyboard_controller keyboard_controller = { - base: { - name: "keyboard_controller", - size: sizeof(struct keyboard_controller), - dependencies: (char *[]){ - "movable_component", - "transform_component", - "controllable_component", - NULL - }, - ctr: &ctr, - fdctr: &fdctr, - dtr: &dtr, - serialize: &serialize, - destroy: &component_destroy - }, - left_key: 16, - right_key: 3, - jump_key: 57 -}; \ No newline at end of file diff --git a/src/engine/engine_component_builder.c b/src/engine/engine_component_builder.c index e5feae9..510765d 100644 --- a/src/engine/engine_component_builder.c +++ b/src/engine/engine_component_builder.c @@ -12,8 +12,6 @@ #include "components/renderer.h" #include "components/camerafollow_component.h" #include "components/transform_component.h" -#include "components/controllable_component.h" -#include "components/controllers/keyboard_controller.h" #include "components/friction_component.h" #include "components/friction_giver.h" #include "components/collision_component.h" @@ -39,8 +37,6 @@ void engine_add_buildin_components(gc_engine *engine) engine->add_component(engine, &camerafollow_component); engine->add_component(engine, &fixed_to_cam); engine->add_component(engine, ¶llax_component); - engine->add_component(engine, &controllable_component); - engine->add_component(engine, &keyboard_controller); engine->add_component(engine, &friction_giver); engine->add_component(engine, &friction_component); engine->add_component(engine, &collision_component); diff --git a/src/engine/engine_system_builder.c b/src/engine/engine_system_builder.c index 76804fd..491a35b 100644 --- a/src/engine/engine_system_builder.c +++ b/src/engine/engine_system_builder.c @@ -10,7 +10,6 @@ #include "systems/sfml_renderer_system.h" #include "systems/movable_system.h" #include "systems/parallax_system.h" -#include "systems/controllers/keyboard_controller_system.h" #include "systems/friction_system.h" #include "systems/collision_system.h" #include "systems/camerafollow_system.h" @@ -35,7 +34,6 @@ void engine_add_builtin_systems(gc_engine *engine) engine->get_system = &engine_get_system; engine->finish_physics = &engine_finish_physics; engine->add_system(engine, ¶llax_system); - engine->add_system(engine, &keyboard_controller_system); engine->add_system(engine, &friction_system); engine->add_system(engine, new_system(&tooltip_system)); engine->add_system(engine, new_system(&collision_system, engine->scene)); diff --git a/src/systems/controllers/keyboard_controller_system.c b/src/systems/controllers/keyboard_controller_system.c deleted file mode 100644 index 3aa5c1f..0000000 --- a/src/systems/controllers/keyboard_controller_system.c +++ /dev/null @@ -1,44 +0,0 @@ -/* -** EPITECH PROJECT, 2019 -** MUL_my_runner_2019 -** File description: -** movable_system -*/ - -#include "entity.h" -#include "system.h" -#include "vector2.h" -#include "components/movable_component.h" -#include "components/controllable_component.h" -#include "components/controllers/keyboard_controller.h" -#include "components/renderer.h" -#include - -void keyboard_update_entity(gc_engine *engine, void *system, \ -gc_entity *entity, float dtime) -{ - struct controllable_component *con = GETCMP(entity, controllable_component); - struct keyboard_controller *key = GETCMP(entity, keyboard_controller); - - con->moving_left = engine->is_keypressed(key->left_key); - con->moving_right = engine->is_keypressed(key->right_key); - con->jumping = engine->is_keypressed(key->jump_key); - (void)system; - (void)dtime; -} - -void keyboard_destroy(void *system) -{ - (void)system; -} - -const gc_system keyboard_controller_system = { - name: "keyboard_controller_system", - component_name: "keyboard_controller", - size: sizeof(gc_system), - ctr: NULL, - dtr: NULL, - check_dependencies: &system_check_dependencies, - update_entity: &keyboard_update_entity, - destroy: &keyboard_destroy -}; \ No newline at end of file