commit d873a59e6b489204dfd7afbaec1fd0388a2bc836
Author: Anonymus Raccoon
Date: Wed Mar 25 16:31:50 2020 +0100
First push
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..891f72a
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,271 @@
+cmake_minimum_required(VERSION 3.15)
+project(My3D C)
+
+set(CMAKE_C_STANDARD 11)
+
+include_directories(include)
+include_directories(lib/gamacon/include)
+include_directories(lib/gamacon/include/components)
+include_directories(lib/gamacon/include/components/controllers)
+include_directories(lib/gamacon/include/systems)
+include_directories(lib/gamacon/include/systems/controllers)
+include_directories(lib/my/include)
+include_directories(lib/xmlparser/include)
+
+add_executable(My3D
+ include/my.h
+ include/setup.h
+ lib/gamacon/include/components/controllers/keyboard_controller.h
+ lib/gamacon/include/components/camerafollow_component.h
+ lib/gamacon/include/components/collision_component.h
+ lib/gamacon/include/components/controllable_component.h
+ lib/gamacon/include/components/fixed_to_cam_component.h
+ lib/gamacon/include/components/friction_component.h
+ lib/gamacon/include/components/friction_giver.h
+ lib/gamacon/include/components/movable_component.h
+ lib/gamacon/include/components/parallax_component.h
+ lib/gamacon/include/components/renderer.h
+ lib/gamacon/include/components/transform_component.h
+ lib/gamacon/include/components/vertex_component.h
+ lib/gamacon/include/systems/controllers/keyboard_controller_system.h
+ lib/gamacon/include/systems/camerafollow_system.h
+ lib/gamacon/include/systems/collision_system.h
+ lib/gamacon/include/systems/friction_system.h
+ lib/gamacon/include/systems/movable_system.h
+ lib/gamacon/include/systems/parallax_system.h
+ lib/gamacon/include/systems/sfml_renderer_system.h
+ lib/gamacon/include/component.h
+ lib/gamacon/include/data.h
+ lib/gamacon/include/engine.h
+ lib/gamacon/include/entity.h
+ lib/gamacon/include/entity_factory.h
+ lib/gamacon/include/list.h
+ lib/gamacon/include/my.h
+ lib/gamacon/include/prefab.h
+ lib/gamacon/include/quadtree.h
+ lib/gamacon/include/read_line.h
+ lib/gamacon/include/scene.h
+ lib/gamacon/include/sfml_renderer.h
+ lib/gamacon/include/sprite.h
+ lib/gamacon/include/system.h
+ lib/gamacon/include/tags.h
+ lib/gamacon/include/text.h
+ lib/gamacon/include/tupple.h
+ lib/gamacon/include/utility.h
+ lib/gamacon/include/vector2.h
+ lib/gamacon/include/xml.h
+ lib/gamacon/src/components/controllers/keyboard_controller.c
+ lib/gamacon/src/components/renderers/anim_renderer.c
+ lib/gamacon/src/components/renderers/map_renderer.c
+ lib/gamacon/src/components/renderers/sprite_renderer.c
+ lib/gamacon/src/components/renderers/text_renderer.c
+ lib/gamacon/src/components/camera_follow.c
+ lib/gamacon/src/components/collision_component.c
+ lib/gamacon/src/components/controllable_component.c
+ lib/gamacon/src/components/fixed_to_cam.c
+ lib/gamacon/src/components/friction_component.c
+ lib/gamacon/src/components/friction_giver.c
+ lib/gamacon/src/components/movable_component.c
+ lib/gamacon/src/components/parallax_component.c
+ lib/gamacon/src/components/renderer.c
+ lib/gamacon/src/components/transform_component.c
+ lib/gamacon/src/components/vertex_component.c
+ lib/gamacon/src/deserializer/deserialize_entity.c
+ lib/gamacon/src/deserializer/prefab.c
+ lib/gamacon/src/engine/discard_player.c
+ lib/gamacon/src/engine/engine.c
+ lib/gamacon/src/engine/engine_component_builder.c
+ lib/gamacon/src/engine/engine_dataloader.c
+ lib/gamacon/src/engine/engine_internal.c
+ lib/gamacon/src/engine/engine_system_builder.c
+ lib/gamacon/src/entity/entity.c
+ lib/gamacon/src/entity/entity_factory.c
+ lib/gamacon/src/scene/scene.c
+ lib/gamacon/src/scene/scene_destroy.c
+ lib/gamacon/src/scene/scene_loader.c
+ lib/gamacon/src/sfml_renderer/sfml_dataloaders.c
+ lib/gamacon/src/sfml_renderer/sfml_drawer.c
+ lib/gamacon/src/sfml_renderer/sfml_functions.c
+ lib/gamacon/src/sfml_renderer/sfml_music_player.c
+ lib/gamacon/src/sfml_renderer/sfml_vertex.c
+ lib/gamacon/src/sfml_renderer/texture_utility.c
+ lib/gamacon/src/systems/controllers/keyboard_controller_system.c
+ lib/gamacon/src/systems/camera_follow_system.c
+ lib/gamacon/src/systems/collision_system.c
+ lib/gamacon/src/systems/fixed_to_cam_pseudosystem.c
+ lib/gamacon/src/systems/friction_system.c
+ lib/gamacon/src/systems/movable_system.c
+ lib/gamacon/src/systems/parallax_system.c
+ lib/gamacon/src/systems/sfml_renderer_system.c
+ lib/gamacon/src/utility/arraylen.c
+ lib/gamacon/src/utility/list.c
+ lib/gamacon/src/utility/my_realloc.c
+ lib/gamacon/src/utility/tupple.c
+ lib/gamacon/src/utility/vector2.c
+ lib/gamacon/src/component.c
+ lib/gamacon/src/system.c
+ lib/my/include/formaters.h
+ lib/my/include/my.h
+ lib/my/my/alphanum_helper.c
+ lib/my/my/index_of.c
+ lib/my/my/my_compute_factorial_it.c
+ lib/my/my/my_compute_factorial_rec.c
+ lib/my/my/my_compute_power_it.c
+ lib/my/my/my_compute_square_root.c
+ lib/my/my/my_evil_str.c
+ lib/my/my/my_find_prime_sup.c
+ lib/my/my/my_getnbr.c
+ lib/my/my/my_getnbr_base.c
+ lib/my/my/my_getnbr_base.c
+ lib/my/my/my_is_prime.c
+ lib/my/my/my_isneg.c
+ lib/my/my/my_print_alpha.c
+ lib/my/my/my_print_comb.c
+ lib/my/my/my_print_comb2.c
+ lib/my/my/my_print_combn.c
+ lib/my/my/my_print_digits.c
+ lib/my/my/my_print_revalpha.c
+ lib/my/my/my_put_nbr.c
+ lib/my/my/my_putchar.c
+ lib/my/my/my_putlong_base.c
+ lib/my/my/my_putnbr_base.c
+ lib/my/my/my_putstr.c
+ lib/my/my/my_revstr.c
+ lib/my/my/my_show_words_array.c
+ lib/my/my/my_showmem.c
+ lib/my/my/my_showstr.c
+ lib/my/my/my_sort_int_array.c
+ lib/my/my/my_str_isalpha.c
+ lib/my/my/my_str_islower.c
+ lib/my/my/my_str_isnum.c
+ lib/my/my/my_str_isprintable.c
+ lib/my/my/my_str_isupper.c
+ lib/my/my/my_str_to_word_array.c
+ lib/my/my/my_strcapitalize.c
+ lib/my/my/my_strcat.c
+ lib/my/my/my_strchr.c
+ lib/my/my/my_strcmp.c
+ lib/my/my/my_strcpy.c
+ lib/my/my/my_strdup.c
+ lib/my/my/my_strlen.c
+ lib/my/my/my_strlowcase.c
+ lib/my/my/my_strncat.c
+ lib/my/my/my_strncmp.c
+ lib/my/my/my_strncpy.c
+ lib/my/my/my_strstr.c
+ lib/my/my/my_strupcase.c
+ lib/my/my/my_swap.c
+ lib/my/my/tostr.c
+ lib/my/my/utility.c
+ lib/my/src/formaters/big_hexa_formater.c
+ lib/my/src/formaters/char_formater.c
+ lib/my/src/formaters/float_formater.c
+ lib/my/src/formaters/hexa_formater.c
+ lib/my/src/formaters/int_formater.c
+ lib/my/src/formaters/no_format.c
+ lib/my/src/formaters/octal_formater.c
+ lib/my/src/formaters/ptr_formater.c
+ lib/my/src/formaters/string_formater.c
+ lib/my/src/formaters/string_nonprintable_formater.c
+ lib/my/src/formaters/ubinary_formater.c
+ lib/my/src/formaters/uint_formater.c
+ lib/my/src/get_nbr_size.c
+ lib/my/src/my_putlonglong_base.c
+ lib/my/src/printf.c
+ lib/my/src/printf_utility.c
+ lib/quadtree/include/array.h
+ lib/quadtree/include/quadtree_internal.h
+ lib/quadtree/src/utility/calloc.c
+ lib/quadtree/src/array.c
+ lib/quadtree/src/qt_collide.c
+ lib/quadtree/src/qt_destroy.c
+ lib/quadtree/src/qt_layer.c
+ lib/quadtree/src/qt_position_overlap.c
+ lib/quadtree/src/qt_split.c
+ lib/quadtree/src/quadtree.c
+ lib/xmlparser/include/my.h
+ lib/xmlparser/include/xml.h
+ lib/xmlparser/include/xml_internal.h
+ lib/xmlparser/src/child.c
+ lib/xmlparser/src/floatutils.c
+ lib/xmlparser/src/helper.c
+ lib/xmlparser/src/list_utility.c
+ lib/xmlparser/src/parsenode.c
+ lib/xmlparser/src/rawnode.c
+ lib/xmlparser/src/strangeget.c
+ lib/xmlparser/src/xml_destroy.c
+ lib/xmlparser/src/xmlget.c
+ lib/xmlparser/src/xmlparser.c
+ lib/xmlparser/src/xmlproperties.c
+ src/game_loader.c
+ src/main.c
+ lib/gamacon/include/errors.h
+ lib/gamacon/src/ui/button.c
+ lib/gamacon/src/ui/setup_ui.c
+ lib/gamacon/include/ui.h
+ src/main_menu.c
+ lib/gamacon/src/components/clickable_component.c
+ lib/gamacon/include/components/clickable_component.h
+ lib/gamacon/src/systems/clickable_system.c
+ lib/gamacon/src/sfml_renderer/sfml_events.c
+ lib/my/my/my_str_replace.c
+ lib/gamacon/src/sfml_renderer/sfml_init.c
+ lib/gamacon/src/sfml_renderer/sfml_events.c
+ lib/gamacon/src/isometry/map_utils.c
+ lib/gamacon/include/map_utils.h
+ lib/xmlparser/src/otherget.c
+ src/options.c
+ lib/gamacon/src/components/input_component.c
+ lib/gamacon/include/components/input_component.h
+ lib/xmlparser/src/otherget.c
+ src/options.c
+ lib/gamacon/src/components/input_component.c
+ lib/gamacon/include/components/input_component.h
+ src/systems/teams_system.c
+ include/systems/teams_system.h
+ include/components/teams_component.h
+ src/components/teams_component.c
+ lib/gamacon/src/components/tag_component.c
+ lib/gamacon/include/components/tag_component.h
+ src/components/game_manager.c
+ include/components/game_manager.h
+ include/dpr_errors.h
+ include/components/game_display.h
+ src/components/game_display.c
+ src/systems/game_display_system.c
+ src/isometry/tile_collision_manager.c
+ lib/gamacon/include/tile_collision_manager.h
+ lib/gamacon/src/engine/event_manager.c
+ lib/gamacon/include/event_manager.h
+ src/teams/absent.c
+ src/teams/forgot.c include/teams.h
+ src/systems/game_manager_system.c
+ include/systems/game_manager_system.h
+ lib/gamacon/include/keybindings.h
+ src/isometry/map_interactions.c
+ include/map_interactions.h
+ lib/gamacon/include/keybindings.h
+ lib/gamacon/src/ui/tooltip.c
+ lib/gamacon/src/components/tooltip_component.c
+ lib/gamacon/include/components/tooltip_component.h
+ lib/gamacon/src/systems/tooltip_system.c
+ src/components/map_manager_component.c
+ include/components/isometry/map_manager_component.h
+ lib/gamacon/src/isometry/vertex_data_loader.c
+ lib/gamacon/include/vertex_data_loader.h
+ src/toolbar.c
+ lib/gamacon/include/callbacks.h src/selectors.c
+ src/framerate.c
+ lib/gamacon/src/isometry/isometry.c
+ lib/gamacon/include/isometry.h
+)
+
+add_compile_options(-W -Wall -Wextra -Wshadow)
+
+target_link_libraries(My3D
+ csfml-system
+ csfml-graphics
+ csfml-audio
+ csfml-window
+ m
+)
\ No newline at end of file
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..87541fb
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,75 @@
+##
+## EPITECH PROJECT, 2019
+## MUL_my_runner_2019
+## File description:
+## Makefile
+##
+
+SRC = src/main.c \
+ src/game_loader.c \
+ src/framerate.c \
+ src/main_menu.c \
+ src/options.c \
+ src/selectors.c \
+ src/toolbar.c \
+ src/teams/absent.c \
+ src/teams/forgot.c \
+ src/systems/game_display_system.c \
+ src/systems/game_manager_system.c \
+ src/systems/teams_system.c \
+ src/isometry/map_interactions.c \
+ src/isometry/tile_collision_manager.c \
+ src/components/map_manager_component.c \
+ src/components/game_display.c \
+ src/components/game_manager.c \
+ src/components/teams_component.c
+
+OBJ = $(SRC:%.c=%.o)
+
+INCLUDE = -I ./include -I lib/gamacon/include -I lib/gamacon/lib/xmlparser/include
+
+CFLAGS = $(INCLUDE) -Wall -Wshadow -Wextra -Wno-unused-parameter
+
+LDFLAGS = -L lib/gamacon -L lib/my -L lib/xmlparser -L lib/quadtree\
+-lgamacon -lxmlparser -lquadtree -lmy -lcsfml-system -lcsfml-graphics -lcsfml-audio -lcsfml-window -lm
+
+NAME = my_world
+
+CC = gcc
+
+all: build
+
+build: $(OBJ)
+ $(MAKE) -C lib/gamacon
+ $(MAKE) -C lib/my
+ $(MAKE) -C lib/xmlparser
+ $(MAKE) -C lib/quadtree
+ $(CC) -o $(NAME) $(OBJ) $(LDFLAGS)
+
+clean:
+ $(MAKE) -C lib/gamacon clean
+ $(MAKE) -C lib/my clean
+ $(MAKE) -C lib/xmlparser clean
+ $(MAKE) -C lib/quadtree clean
+ $(RM) $(OBJ)
+
+fclean: clean
+ $(RM) $(NAME)
+
+ffclean: fclean
+ $(MAKE) -C lib/my fclean
+ $(MAKE) -C lib/gamacon fclean
+ $(MAKE) -C lib/xmlparser fclean
+ $(MAKE) -C lib/quadtree fclean
+
+re: fclean all
+
+dbg: CFLAGS += -g
+dbg: clean $(OBJ)
+ $(MAKE) -C lib/gamacon dbg
+ $(MAKE) -C lib/my
+ $(MAKE) -C lib/xmlparser dbg
+ $(MAKE) -C lib/quadtree dbg
+ $(CC) -o $(NAME) $(OBJ) $(LDFLAGS)
+
+.PHONY: all build clean fclean ffclean
\ No newline at end of file
diff --git a/assets/fonts/roboto.ttf b/assets/fonts/roboto.ttf
new file mode 100644
index 0000000..2b6392f
Binary files /dev/null and b/assets/fonts/roboto.ttf differ
diff --git a/assets/musics/music.m4a b/assets/musics/music.m4a
new file mode 100644
index 0000000..3d06a28
Binary files /dev/null and b/assets/musics/music.m4a differ
diff --git a/assets/musics/music.ogg b/assets/musics/music.ogg
new file mode 100644
index 0000000..d92661a
Binary files /dev/null and b/assets/musics/music.ogg differ
diff --git a/assets/sprites/bck_layer1.png b/assets/sprites/bck_layer1.png
new file mode 100644
index 0000000..ba94118
Binary files /dev/null and b/assets/sprites/bck_layer1.png differ
diff --git a/assets/sprites/bck_layer2.png b/assets/sprites/bck_layer2.png
new file mode 100644
index 0000000..795d9b0
Binary files /dev/null and b/assets/sprites/bck_layer2.png differ
diff --git a/assets/sprites/bck_layer3.png b/assets/sprites/bck_layer3.png
new file mode 100644
index 0000000..f014539
Binary files /dev/null and b/assets/sprites/bck_layer3.png differ
diff --git a/assets/sprites/bck_layer4.png b/assets/sprites/bck_layer4.png
new file mode 100644
index 0000000..9eed2cf
Binary files /dev/null and b/assets/sprites/bck_layer4.png differ
diff --git a/assets/sprites/cobblestone.png b/assets/sprites/cobblestone.png
new file mode 100644
index 0000000..b2f3fd4
Binary files /dev/null and b/assets/sprites/cobblestone.png differ
diff --git a/assets/sprites/cobblestone_mossy.png b/assets/sprites/cobblestone_mossy.png
new file mode 100644
index 0000000..4b38c68
Binary files /dev/null and b/assets/sprites/cobblestone_mossy.png differ
diff --git a/assets/sprites/command_block.png b/assets/sprites/command_block.png
new file mode 100644
index 0000000..8d2c473
Binary files /dev/null and b/assets/sprites/command_block.png differ
diff --git a/assets/sprites/comparator_on.png b/assets/sprites/comparator_on.png
new file mode 100644
index 0000000..eae1747
Binary files /dev/null and b/assets/sprites/comparator_on.png differ
diff --git a/assets/sprites/crafting_table_top.png b/assets/sprites/crafting_table_top.png
new file mode 100644
index 0000000..6ced52e
Binary files /dev/null and b/assets/sprites/crafting_table_top.png differ
diff --git a/assets/sprites/grass_side.png b/assets/sprites/grass_side.png
new file mode 100644
index 0000000..5118c1f
Binary files /dev/null and b/assets/sprites/grass_side.png differ
diff --git a/assets/sprites/grass_top.png b/assets/sprites/grass_top.png
new file mode 100644
index 0000000..193aa56
Binary files /dev/null and b/assets/sprites/grass_top.png differ
diff --git a/assets/sprites/player_sheet.png b/assets/sprites/player_sheet.png
new file mode 100644
index 0000000..31fe388
Binary files /dev/null and b/assets/sprites/player_sheet.png differ
diff --git a/assets/ui/black_background.png b/assets/ui/black_background.png
new file mode 100644
index 0000000..b46a7b6
Binary files /dev/null and b/assets/ui/black_background.png differ
diff --git a/assets/ui/button_background.png b/assets/ui/button_background.png
new file mode 100644
index 0000000..ecab5b0
Binary files /dev/null and b/assets/ui/button_background.png differ
diff --git a/assets/ui/check.png b/assets/ui/check.png
new file mode 100644
index 0000000..7affa02
Binary files /dev/null and b/assets/ui/check.png differ
diff --git a/assets/ui/clown.png b/assets/ui/clown.png
new file mode 100644
index 0000000..d4670e7
Binary files /dev/null and b/assets/ui/clown.png differ
diff --git a/assets/ui/cross.png b/assets/ui/cross.png
new file mode 100644
index 0000000..e1da5fe
Binary files /dev/null and b/assets/ui/cross.png differ
diff --git a/assets/ui/front_panel.png b/assets/ui/front_panel.png
new file mode 100644
index 0000000..7dc23c6
Binary files /dev/null and b/assets/ui/front_panel.png differ
diff --git a/assets/ui/happiness.png b/assets/ui/happiness.png
new file mode 100644
index 0000000..35fece0
Binary files /dev/null and b/assets/ui/happiness.png differ
diff --git a/assets/ui/left.png b/assets/ui/left.png
new file mode 100644
index 0000000..4ac0beb
Binary files /dev/null and b/assets/ui/left.png differ
diff --git a/assets/ui/martine_a_epi_marseille.png b/assets/ui/martine_a_epi_marseille.png
new file mode 100644
index 0000000..d5ca492
Binary files /dev/null and b/assets/ui/martine_a_epi_marseille.png differ
diff --git a/assets/ui/panel.png b/assets/ui/panel.png
new file mode 100644
index 0000000..c4cea90
Binary files /dev/null and b/assets/ui/panel.png differ
diff --git a/assets/ui/reset.png b/assets/ui/reset.png
new file mode 100644
index 0000000..a3086d2
Binary files /dev/null and b/assets/ui/reset.png differ
diff --git a/assets/ui/right.png b/assets/ui/right.png
new file mode 100644
index 0000000..4a88cfa
Binary files /dev/null and b/assets/ui/right.png differ
diff --git a/assets/ui/rotate.png b/assets/ui/rotate.png
new file mode 100644
index 0000000..03f5c9c
Binary files /dev/null and b/assets/ui/rotate.png differ
diff --git a/assets/ui/texture.png b/assets/ui/texture.png
new file mode 100644
index 0000000..fcde006
Binary files /dev/null and b/assets/ui/texture.png differ
diff --git a/assets/ui/tile_select.png b/assets/ui/tile_select.png
new file mode 100644
index 0000000..937f6f4
Binary files /dev/null and b/assets/ui/tile_select.png differ
diff --git a/assets/ui/up_down.png b/assets/ui/up_down.png
new file mode 100644
index 0000000..c56e6a2
Binary files /dev/null and b/assets/ui/up_down.png differ
diff --git a/assets/ui/vertex_select.png b/assets/ui/vertex_select.png
new file mode 100644
index 0000000..f15e04b
Binary files /dev/null and b/assets/ui/vertex_select.png differ
diff --git a/include/array.h b/include/array.h
new file mode 100644
index 0000000..959394e
--- /dev/null
+++ b/include/array.h
@@ -0,0 +1,11 @@
+/*
+** EPITECH PROJECT, 2020
+** Twac
+** File description:
+** array
+*/
+
+#pragma once
+
+void arr_add(int *arr, int n);
+int arr_len(int *arr);
\ No newline at end of file
diff --git a/include/components/game_display.h b/include/components/game_display.h
new file mode 100644
index 0000000..6629f85
--- /dev/null
+++ b/include/components/game_display.h
@@ -0,0 +1,26 @@
+//
+// Created by anonymus-raccoon on 3/3/20.
+//
+
+#ifndef _TEAMS_COMPONENT_C_
+#define _TEAMS_COMPONENT_H_
+
+#include "component.h"
+
+typedef enum display_type
+{
+ HAPPINESS_DISPLAY,
+ STUPIDITY_DISPLAY,
+ SELECT_TILE_DISPLAY
+} display_type_enum;
+
+struct game_display
+{
+ gc_component base;
+ display_type_enum type;
+};
+
+const struct game_display game_display;
+const struct gc_system game_display_system;
+
+#endif //_TEAMS_COMPONENT_C_
diff --git a/include/components/game_manager.h b/include/components/game_manager.h
new file mode 100644
index 0000000..61f35be
--- /dev/null
+++ b/include/components/game_manager.h
@@ -0,0 +1,19 @@
+//
+// Created by anonymus-raccoon on 3/3/20.
+//
+
+#ifndef _TEAMS_COMPONENT_C_
+#define _TEAMS_COMPONENT_H_
+
+#include "component.h"
+
+struct game_manager
+{
+ gc_component base;
+ int happiness;
+ int stupidity;
+};
+
+const struct game_manager game_manager;
+
+#endif //_TEAMS_COMPONENT_C_
diff --git a/include/components/isometry/map_manager_component.h b/include/components/isometry/map_manager_component.h
new file mode 100644
index 0000000..aa18548
--- /dev/null
+++ b/include/components/isometry/map_manager_component.h
@@ -0,0 +1,28 @@
+//
+// Created by anonymus-raccoon on 3/10/20.
+//
+
+#ifndef _MAP_MANAGER_COMPONENT_H_
+#define _MAP_MANAGER_COMPONENT_H_
+
+#include "component.h"
+
+enum brush
+{
+ MOVE,
+ RESET,
+ ROTATE,
+ TEXTURE
+};
+
+struct map_manager_component
+{
+ gc_component base;
+ bool tile_mode;
+ enum brush brush;
+ void *selected_texture;
+};
+
+const struct map_manager_component map_manager_component;
+
+#endif //_MAP_MANAGER_COMPONENT_H_
diff --git a/include/components/teams_component.h b/include/components/teams_component.h
new file mode 100644
index 0000000..c2224ca
--- /dev/null
+++ b/include/components/teams_component.h
@@ -0,0 +1,25 @@
+//
+// Created by anonymus-raccoon on 3/3/20.
+//
+
+#ifndef _TEAMS_COMPONENT_C_
+#define _TEAMS_COMPONENT_H_
+
+#include "component.h"
+
+struct teams_component
+{
+ gc_component base;
+ float next_teams;
+ float delay;
+ char **prefabs;
+ int *prefabs_size;
+ int prefab_count;
+};
+
+const struct teams_component teams_component;
+
+bool teams_move_up(gc_scene *scene, float amount, float y_level);
+void pm_clicked(gc_engine *engine, gc_entity *entity);
+
+#endif //_TEAMS_COMPONENT_C_
diff --git a/include/dpr_errors.h b/include/dpr_errors.h
new file mode 100644
index 0000000..58ad02b
--- /dev/null
+++ b/include/dpr_errors.h
@@ -0,0 +1,11 @@
+//
+// Created by anonymus-raccoon on 3/6/20.
+//
+
+#ifndef _DPR_ERRORS_H_
+#define _DPR_ERRORS_H_
+
+#define MULTIPLE_GAME_MGR_ERROR "Warning: two game manager exists, \
+behaviors are undefined.\n"
+
+#endif //_DPR_ERRORS_H_
diff --git a/include/map_interactions.h b/include/map_interactions.h
new file mode 100644
index 0000000..b607a06
--- /dev/null
+++ b/include/map_interactions.h
@@ -0,0 +1,28 @@
+/*
+** EPITECH PROJECT, 2020
+** Gamacon
+** File description:
+** map_interactions
+*/
+
+
+#ifndef MY3D_MAP_INTERACTIONS_H
+#define MY3D_MAP_INTERACTIONS_H
+
+#include "engine.h"
+#include "components/vertex_component.h"
+#include "keybindings.h"
+
+enum modes_on_tile {
+ VERTEX_0 = 2,
+ VERTEX_1 = 4,
+ VERTEX_2 = 8,
+ VERTEX_3 = 16,
+ ALL_VERTICES = 30,
+ INVERT_ADD_VALUE = 1
+};
+
+bool map_onclick(gc_engine *engine, gc_entity *entity, gc_vector2 pos, \
+enum gc_mousekeys key);
+
+#endif //MY3D_MAP_INTERACTIONS_H
diff --git a/include/my.h b/include/my.h
new file mode 100644
index 0000000..58414e7
--- /dev/null
+++ b/include/my.h
@@ -0,0 +1,127 @@
+/*
+** EPITECH PROJECT, 2019
+** My lib
+** File description:
+** Header file
+*/
+#pragma once
+
+char *my_str_replace(char *str, const char *to_replace, char c);
+
+int my_str_islower_or_num(const char *str);
+
+int my_printf(const char *str, ...);
+
+int count_valid_queens_placements(int n);
+
+char *my_strchr(const char *str, char c);
+
+int my_compute_power_it(int n, int p);
+
+int my_compute_power_rec(int n, int p);
+
+int my_compute_factorial_it(int n);
+
+int my_compute_factorial_rec(int n);
+
+int my_compute_square_root(int n);
+
+char *my_evil_str(char *str);
+
+int my_find_prime_sup(int n);
+
+int my_getnbr_base(const char *str, const char *base);
+
+int my_getnbr(const char *str);
+
+int my_isneg(int n);
+
+int my_is_prime(int n);
+
+void my_print_alpha(void);
+
+void my_print_comb2(void);
+
+void my_print_combn(int n);
+
+void my_print_comb(void);
+
+void my_print_digits(void);
+
+void my_print_revalpha(void);
+
+void my_putchar(char c);
+
+void my_putlong_base(long n, const char *base);
+
+void my_putnbr_base(int n, const char *base);
+
+void my_put_nbr(int n);
+
+void my_putstr(const char *str);
+
+void my_revstr(char *str);
+
+void my_showmem(char *str, int);
+
+void my_showstr(const char *str);
+
+void my_sort_int_array(int *array);
+
+int is_letter(char c);
+
+int is_alpha(char c);
+
+int is_num(char c);
+
+int is_digit(char c);
+
+char *my_strcapitalize(char *str);
+
+char *my_strcat(char *dest, const char *src);
+
+int my_strcmp(const char *s1, const char *s2);
+
+char *my_strcpy(char *dest, const char *str);
+
+int my_str_isalpha(const char *str);
+
+int is_lowercase(char c);
+
+int my_str_islower(const char *str);
+
+int my_str_isnum(const char *str);
+
+int is_printable(char c);
+int my_str_isprintable(const char *str);
+
+int is_upper(char c);
+int my_str_isupper(const char *str);
+
+int my_strlen(const char *str);
+
+int my_strlowcase(const char *str);
+
+char *my_strncat(char *dest, const char *src, int n);
+
+int my_strncmp(const char *s1, const char *s2, int n);
+
+char *my_strncpy(char *dest, const char *src, int n);
+
+char *my_strstr(const char *str, const char *to_find);
+
+int my_strupcase(const char *str);
+
+void my_swap(int *a, int *b);
+
+char *my_strdup(const char *str);
+
+char **my_str_to_word_array(const char *str);
+
+int my_show_word_array(const char **words);
+
+int is_alphanum(char c);
+
+int first_alphanum(const char *str);
+
+int index_of(const char *str, char c);
\ No newline at end of file
diff --git a/include/quadtree_internal.h b/include/quadtree_internal.h
new file mode 100644
index 0000000..22b4ab4
--- /dev/null
+++ b/include/quadtree_internal.h
@@ -0,0 +1,30 @@
+/*
+** EPITECH PROJECT, 2019
+** quadtree
+** File description:
+** quadtree_internal
+*/
+
+#pragma once
+
+#include "quadtree.h"
+#include
+
+void *my_calloc(int capacity, int size);
+
+quadtree *qt_split(quadtree *tree);
+
+bool collision_overlapx(qt_intrect r1, qt_intrect r2);
+bool collision_overlapy(qt_intrect r1, qt_intrect r2);
+
+bool collision_can_see(int l1, int l2);
+
+#define MIN(x, y) ((x) < (y) ? (x) : (y))
+#define MAX(x, y) ((x) < (y) ? (y) : (x))
+
+#define CAN_BE_SEEN 0b10
+#define CAN_SEE 0b01
+
+#define TREEOBJ_AT(x) (&((qt_object *)tree->objects)[i])
+
+#define COLLISION_MAX ((qt_collision){MAXCOL, MAXCOL, MAXCOL, MAXCOL, NULL})
\ No newline at end of file
diff --git a/include/setup.h b/include/setup.h
new file mode 100644
index 0000000..de33326
--- /dev/null
+++ b/include/setup.h
@@ -0,0 +1,38 @@
+/*
+** EPITECH PROJECT, 2019
+** MUL_my_runner_2019
+** File description:
+** runner
+*/
+
+#pragma once
+
+#define ERROR 84
+#include "scene.h"
+
+int start_game();
+
+bool start_button(gc_engine *engine, gc_entity *entity, gc_vector2 _);
+bool options(gc_engine *engine, gc_entity *entity, gc_vector2 _);
+bool goto_main_menu(gc_engine *engine, gc_entity *entity, gc_vector2 _);
+bool quit(gc_engine *engine, gc_entity *entity, gc_vector2 _);
+bool catch(gc_engine *engine, gc_entity *entity, gc_vector2 _);
+bool toggle_pause(gc_engine *engine, gc_entity *entity, gc_vector2 _);
+
+int checkbox_update(gc_scene *s, gc_entity *entity, bool checked);
+void resolution_set_text(gc_entity *entity, gc_engine *engine);
+void framerate_set_text(gc_entity *entity, gc_engine *engine);
+
+bool fullscreen(gc_engine *engine, gc_entity *entity, gc_vector2 _);
+bool resolution_down(gc_engine *engine, gc_entity *entity, gc_vector2 _);
+bool resolution_up(gc_engine *engine, gc_entity *entity, gc_vector2 _);
+bool framerate_up(gc_engine *engine, gc_entity *entity, gc_vector2 _);
+bool framerate_down(gc_engine *engine, gc_entity *entity, gc_vector2 _);
+
+bool tile_select(gc_engine *engine, gc_entity *entity, gc_vector2 _);
+bool vertex_select(gc_engine *engine, gc_entity *entity, gc_vector2 _);
+bool up_down(gc_engine *engine, gc_entity *entity, gc_vector2 _);
+bool reset(gc_engine *engine, gc_entity *entity, gc_vector2 _);
+bool rotate(gc_engine *engine, gc_entity *entity, gc_vector2 _);
+bool texture(gc_engine *engine, gc_entity *entity, gc_vector2 _);
+bool switch_texture(gc_engine *engine, gc_entity *entity, gc_vector2 _);
\ No newline at end of file
diff --git a/include/systems/game_manager_system.h b/include/systems/game_manager_system.h
new file mode 100644
index 0000000..fe18ffa
--- /dev/null
+++ b/include/systems/game_manager_system.h
@@ -0,0 +1,12 @@
+//
+// Created by anonymus-raccoon on 3/9/20.
+//
+
+#ifndef _GAME_MANAGER_SYSTEM_H_
+#define _GAME_MANAGER_SYSTEM_H_
+
+#include "system.h"
+
+const gc_system game_manager_system;
+
+#endif //_GAME_MANAGER_SYSTEM_H_
diff --git a/include/systems/teams_system.h b/include/systems/teams_system.h
new file mode 100644
index 0000000..ee190c3
--- /dev/null
+++ b/include/systems/teams_system.h
@@ -0,0 +1,12 @@
+//
+// Created by anonymus-raccoon on 3/3/20.
+//
+
+#ifndef _TEAMS_SYSTEM_H_
+#define _TEAMS_SYSTEM_H_
+
+#include "system.h"
+
+const gc_system teams_system;
+
+#endif //_TEAMS_SYSTEM_H_
diff --git a/include/teams.h b/include/teams.h
new file mode 100644
index 0000000..79ea9da
--- /dev/null
+++ b/include/teams.h
@@ -0,0 +1,17 @@
+//
+// Created by anonymus-raccoon on 3/9/20.
+//
+
+#ifndef _TEAMS_H_
+#define _TEAMS_H_
+
+#include
+#include "engine.h"
+
+bool absent_check(gc_engine *engine, int entity_id, gc_vector2 _);
+bool absent_cross(gc_engine *engine, int entity_id, gc_vector2 _);
+
+bool forgot_lmfao(gc_engine *engine, int entity_id, gc_vector2 _);
+bool forgot_ok(gc_engine *engine, int entity_id, gc_vector2 _);
+
+#endif //_TEAMS_H_
diff --git a/lib/my/Makefile b/lib/my/Makefile
new file mode 100644
index 0000000..9301443
--- /dev/null
+++ b/lib/my/Makefile
@@ -0,0 +1,62 @@
+##
+## EPITECH PROJECT, 2019
+## PSU_my_printf_bootstrap_2019
+## File description:
+## Makefile
+##
+
+SRC = src/printf.c \
+ src/printf_utility.c \
+ src/my_putlonglong_base.c \
+ src/formaters/string_formater.c \
+ src/formaters/string_nonprintable_formater.c \
+ src/formaters/char_formater.c \
+ src/formaters/int_formater.c \
+ src/formaters/uint_formater.c \
+ src/formaters/ptr_formater.c \
+ src/formaters/ubinary_formater.c \
+ src/formaters/octal_formater.c \
+ src/formaters/hexa_formater.c \
+ src/formaters/big_hexa_formater.c \
+ src/formaters/float_formater.c \
+ src/formaters/no_format.c \
+ src/get_nbr_size.c \
+ my/*.c
+
+OBJ = *.o
+
+TESTS = tests/test_printf.c
+
+INCLUDE = -I ./include
+
+COVERAGE = --coverage -lcriterion
+
+CC = gcc
+
+CFLAGS = -Wall -Wshadow -Wextra -Wno-unused-parameter
+
+NAME = libmy.a
+
+UT = ut
+
+all: $(NAME)
+
+$(NAME):
+ $(CC) -c $(SRC) $(INCLUDE) $(CFLAGS)
+ ar rc $(NAME) $(OBJ)
+
+tests_run:
+ $(CC) -o $(UT) $(SRC) $(TESTS) $(INCLUDE) $(COVERAGE) $(CFLAGS)
+ ./$(UT)
+
+clean:
+ rm -rf $(OBJ)
+ rm -rf *.gc*
+
+fclean: clean
+ rm -rf $(NAME)
+ rm -rf $(UT)
+
+re: fclean all
+
+.PHONY = all build clean fclean
\ No newline at end of file
diff --git a/lib/my/include/formaters.h b/lib/my/include/formaters.h
new file mode 100644
index 0000000..4d0d88e
--- /dev/null
+++ b/lib/my/include/formaters.h
@@ -0,0 +1,37 @@
+/*
+** EPITECH PROJECT, 2019
+** Formater struct
+** File description:
+** formaters
+*/
+
+#pragma once
+#include
+
+#define MODIFIERS_SIZE 50
+
+typedef struct formater
+{
+ int (*func)(va_list ap, char modifiers[MODIFIERS_SIZE]);
+ char flag;
+} formater_t;
+
+int string_formater(va_list ap, char modifiers[MODIFIERS_SIZE]);
+int string_nonprintable_formater(va_list ap, char modifiers[MODIFIERS_SIZE]);
+int char_formater(va_list ap, char modifiers[MODIFIERS_SIZE]);
+int int_formater(va_list ap, char modifiers[MODIFIERS_SIZE]);
+int uint_formater(va_list ap, char modifiers[MODIFIERS_SIZE]);
+int ptr_formater(va_list ap, char modifiers[MODIFIERS_SIZE]);
+int ubinary_formater(va_list ap, char modifiers[MODIFIERS_SIZE]);
+int octal_formater(va_list ap, char modifiers[MODIFIERS_SIZE]);
+int hexa_formater(va_list ap, char modifiers[MODIFIERS_SIZE]);
+int big_hexa_formater(va_list ap, char modifiers[MODIFIERS_SIZE]);
+int float_formater(va_list ap, char modifiers[MODIFIERS_SIZE]);
+int no_format(va_list ap, char modifiers[MODIFIERS_SIZE]);
+
+int count(char c, char *str);
+int contains(char c, char *str);
+int get_nbr_len(long long int n, const char *base);
+int is_modifier(char c);
+int last_mod(char *modifiers);
+int my_putlonglong_base(long long int nbr, const char *base, int length);
\ No newline at end of file
diff --git a/lib/my/include/my.h b/lib/my/include/my.h
new file mode 100644
index 0000000..81d8574
--- /dev/null
+++ b/lib/my/include/my.h
@@ -0,0 +1,129 @@
+/*
+** EPITECH PROJECT, 2019
+** My lib
+** File description:
+** Header file
+*/
+#pragma once
+
+char *my_str_replace(char *str, const char *to_replace, char c);
+
+int my_str_islower_or_num(const char *str);
+
+int my_printf(const char *str, ...);
+
+void print_ptr(void *ptr);
+
+void print_str_to(char *ptr, int max);
+
+int count_valid_queens_placements(int n);
+
+int my_compute_power_it(int n, int p);
+
+int my_compute_power_rec(int n, int p);
+
+int my_compute_factorial_it(int n);
+
+int my_compute_factorial_rec(int n);
+
+int my_sqrt(int nb);
+
+char *my_evil_str(char *str);
+
+int my_find_prime_sup(int n);
+
+int my_getnbr_base(const char *str, const char *base);
+
+int my_getnbr(const char *str);
+
+int my_isneg(int n);
+
+int my_is_prime(int n);
+
+void my_print_alpha(void);
+
+void my_print_comb2(void);
+
+void my_print_combn(int n);
+
+void my_print_comb(void);
+
+void my_print_digits(void);
+
+void my_print_revalpha(void);
+
+void my_putchar(char c);
+
+int my_putlong_base(long long nbr, const char *base);
+
+void my_putnbr_base(int n, const char *base);
+
+void my_put_nbr(int n);
+
+void my_putstr(const char *str);
+
+void my_revstr(char *str);
+
+void my_showmem(char *str, int size);
+
+void my_showstr(const char *str);
+
+void my_sort_int_array(int *array);
+
+int is_letter(char c);
+
+int is_alpha(char c);
+
+int is_num(char c);
+
+int is_digit(char c);
+
+char *my_strcapitalize(char *str);
+
+char *my_strcat(char *dest, const char *str);
+
+int my_strcmp(const char *s1, const char *s2);
+
+char *my_strcpy(char *dest, const char *src);
+
+int my_str_isalpha(const char *str);
+
+int is_lowercase(char c);
+
+int my_str_islower(const char *str);
+
+int my_str_isnum(const char *str);
+
+int is_printable(char c);
+int my_str_isprintable(const char *str);
+
+int is_upper(char c);
+int my_str_isupper(const char *str);
+
+int my_strlen(const char *str);
+
+int my_strlowcase(const char *str);
+
+char *my_strncat(char *dest, const char *str, int n);
+
+int my_strncmp(const char *s1, const char *s2, int n);
+
+char *my_strncpy(char *dest, const char *src, int n);
+
+char *my_strstr(const char *str, const char *to_find);
+
+int my_strupcase(const char *str);
+
+void my_swap(int *a, int *b);
+
+char *my_strdup(const char *str);
+
+char **my_str_to_word_array(const char *str);
+
+int my_show_word_array(const char **words);
+
+int is_alphanum(char c);
+
+int first_alphanum(const char *str);
+
+int index_of(const char *str, char c);
\ No newline at end of file
diff --git a/lib/my/my/alphanum_helper.c b/lib/my/my/alphanum_helper.c
new file mode 100644
index 0000000..25a02b9
--- /dev/null
+++ b/lib/my/my/alphanum_helper.c
@@ -0,0 +1,24 @@
+/*
+** EPITECH PROJECT, 2019
+** Helper for the task 4
+** File description:
+** alphanum_helper
+*/
+
+int is_alpha(char c);
+
+int is_digit(char c);
+
+int is_alphanum(char c)
+{
+ return (is_alpha(c) || is_digit(c));
+}
+
+int first_alphanum(const char *str)
+{
+ for (int i = 0; str[i]; i++) {
+ if (is_alphanum(str[i]))
+ return i;
+ }
+ return (-1);
+}
diff --git a/lib/my/my/index_of.c b/lib/my/my/index_of.c
new file mode 100644
index 0000000..733857c
--- /dev/null
+++ b/lib/my/my/index_of.c
@@ -0,0 +1,15 @@
+/*
+** EPITECH PROJECT, 2019
+** String helper
+** File description:
+** Index of char in a string
+*/
+
+int index_of(const char *str, const char c)
+{
+ for (int i = 0; str[i]; i++) {
+ if (str[i] == c)
+ return (i);
+ }
+ return (-1);
+}
\ No newline at end of file
diff --git a/lib/my/my/my_compute_factorial_it.c b/lib/my/my/my_compute_factorial_it.c
new file mode 100644
index 0000000..37f87bc
--- /dev/null
+++ b/lib/my/my/my_compute_factorial_it.c
@@ -0,0 +1,22 @@
+/*
+** EPITECH PROJECT, 2019
+** CPool_Day05_2019
+** File description:
+** Factorials
+*/
+
+int my_compute_factorial_it(int nb)
+{
+ if (nb < 0)
+ return 0;
+
+ int ret = 1;
+ while (nb > 0) {
+ ret *= nb;
+ nb--;
+
+ if (ret < 0)
+ return 0;
+ }
+ return ret;
+}
diff --git a/lib/my/my/my_compute_factorial_rec.c b/lib/my/my/my_compute_factorial_rec.c
new file mode 100644
index 0000000..de2d6e4
--- /dev/null
+++ b/lib/my/my/my_compute_factorial_rec.c
@@ -0,0 +1,25 @@
+/*
+** EPITECH PROJECT, 2019
+** CPool_Day05_2019
+** File description:
+** Factorials but in recursive mode
+*/
+
+int compute(int nb, int ret)
+{
+ if (ret < 0)
+ return (0);
+
+ if (nb == 0)
+ return (ret);
+
+ return (compute(nb - 1, ret * nb));
+}
+
+int my_compute_factorial_rec(int nb)
+{
+ if (nb == 0)
+ return (1);
+
+ return (compute(nb, 1));
+}
diff --git a/lib/my/my/my_compute_power_it.c b/lib/my/my/my_compute_power_it.c
new file mode 100644
index 0000000..a9481bb
--- /dev/null
+++ b/lib/my/my/my_compute_power_it.c
@@ -0,0 +1,29 @@
+/*
+** EPITECH PROJECT, 2019
+** CPool_Day05_2019
+** File description:
+** Power calculator
+*/
+
+int my_pow(int nb, int p)
+{
+ int ret = 1;
+ int mult = 1;
+
+ if (p < 0)
+ return 0;
+ if (nb < 0) {
+ nb *= -1;
+ if (p % 2 == 1)
+ mult = -1;
+ }
+ while (p > 0) {
+ ret *= nb;
+ p--;
+
+ if (ret < 0)
+ return (0);
+ }
+
+ return (ret * mult);
+}
diff --git a/lib/my/my/my_compute_square_root.c b/lib/my/my/my_compute_square_root.c
new file mode 100644
index 0000000..16e03e6
--- /dev/null
+++ b/lib/my/my/my_compute_square_root.c
@@ -0,0 +1,22 @@
+/*
+** EPITECH PROJECT, 2019
+** CPool_Day05_2019
+** File description:
+** Square root calculator
+*/
+
+int my_sqrt(int nb)
+{
+ if (nb < 0)
+ return 0;
+
+ for (int i = 0; 1; i++) {
+ int power = i * i;
+ if (power == nb)
+ return i;
+ else if (power > nb)
+ return 0;
+ }
+
+ return 0;
+}
diff --git a/lib/my/my/my_evil_str.c b/lib/my/my/my_evil_str.c
new file mode 100644
index 0000000..3487c64
--- /dev/null
+++ b/lib/my/my/my_evil_str.c
@@ -0,0 +1,28 @@
+/*
+** EPITECH PROJECT, 2019
+** CPool_Day04_2019
+** File description:
+** Reverse string
+*/
+
+int my_putchar(char c);
+
+char *my_evil_str(char *str)
+{
+ int count = 0;
+ char buf[1598246];
+
+ while (1) {
+ buf[count] = str[count];
+ if (*(str + count) != '\0')
+ count++;
+ else
+ break;
+ }
+
+ for (int i = 0; i < count; i++)
+ str[i] = buf[count - i - 1];
+
+ str[count + 1] = '\0';
+ return str;
+}
diff --git a/lib/my/my/my_find_prime_sup.c b/lib/my/my/my_find_prime_sup.c
new file mode 100644
index 0000000..50ca6a8
--- /dev/null
+++ b/lib/my/my/my_find_prime_sup.c
@@ -0,0 +1,18 @@
+/*
+** EPITECH PROJECT, 2019
+** CPool_Day05_2019
+** File description:
+** Find a prime number greater than the given number
+*/
+
+int my_is_prime(int n);
+
+int my_find_prime_sup(int n)
+{
+ if (n <= 2)
+ return (2);
+ while (!my_is_prime(n))
+ n++;
+
+ return n;
+}
diff --git a/lib/my/my/my_getnbr.c b/lib/my/my/my_getnbr.c
new file mode 100755
index 0000000..dcbac57
--- /dev/null
+++ b/lib/my/my/my_getnbr.c
@@ -0,0 +1,71 @@
+/*
+** EPITECH PROJECT, 2019
+** CPool_Day04_2019
+** File description:
+** Int parser
+*/
+
+int my_putchar(char c);
+
+static int parse(const char *str, int digit_count, int neg)
+{
+ int n = 0;
+ int add;
+ for (int power = 0; power < digit_count; power++) {
+ add = str[digit_count - power - 1] - '0';
+ if (power == 10 && add > 2)
+ return 0;
+
+ add *= neg;
+ for (int i = 0; i < power; i++) {
+ add *= 10;
+ if (add * neg < 0)
+ return 0;
+ }
+ n += add;
+
+ if ((neg == -1 && n > 0) || (neg == 1 && n < 0))
+ return 0;
+ }
+ return n;
+}
+
+static int init_print(const char *str, int count, int s_index)
+{
+ int neg = 1;
+
+ for (char c = str[s_index]; c == '-' || c == '+'; c = str[s_index]) {
+ if (c == '-')
+ neg *= -1;
+ s_index++;
+ count--;
+ }
+
+ char buf[count];
+ for (int i = 0; i < count; i++)
+ buf[i] = str[s_index + i];
+
+
+ return parse(buf, count, neg);
+}
+
+int my_getnbr(const char *str)
+{
+ int count = 0;
+ int start_index = -1;
+ char c;
+
+ for (int i = 0; str[i]; i++) {
+ c = str[i];
+ if ((c >= '0' && c <= '9') || c == '-' || c == '+') {
+ if (start_index == -1)
+ start_index = i;
+ count++;
+ }
+ else if (count > 0 || c == '\0')
+ break;
+ }
+ if (count <= 0)
+ return (0);
+ return init_print(str, count, start_index);
+}
diff --git a/lib/my/my/my_getnbr_base.c b/lib/my/my/my_getnbr_base.c
new file mode 100644
index 0000000..e309364
--- /dev/null
+++ b/lib/my/my/my_getnbr_base.c
@@ -0,0 +1,75 @@
+/*
+** EPITECH PROJECT, 2019
+** Get number with any base
+** File description:
+** Int library
+*/
+
+int my_strlen(const char *str);
+
+int my_pow(int i, int p);
+
+static int indexof(char c, const char *str)
+{
+ for (int i = 0; str[i] != '\0'; i++) {
+ if (str[i] == c)
+ return (i);
+ }
+ return (-1);
+}
+
+static int parse(char *str, const char *base, long n, int i)
+{
+ int str_length = my_strlen(str);
+ int base_length = my_strlen(base);
+ int power;
+ int neg = 1;
+
+ if (i < 0) {
+ neg = -1;
+ i *= -1;
+ }
+ power = my_pow(base_length, i - 1);
+ n += indexof(str[str_length - i], base) * power * neg;
+ if ((n > 0 && neg < 0) || (n < 0 && neg > 0))
+ return (0);
+ if (str_length - i > 0)
+ return (parse(str, base, n, (i + 1) * neg));
+ return (n);
+}
+
+static int get_digit_count(const char *str, const char *base)
+{
+ int count = 0;
+
+ for (int i = 0; str[i] != '\0'; i++) {
+ if (indexof(str[i], base) != -1)
+ count++;
+ else if (count > 0)
+ return (count);
+ }
+ return (count);
+}
+
+int my_getnbr_base(const char *str, const char *base)
+{
+ int length = get_digit_count(str, base);
+ char num[length + 1];
+ int start_index = 0;
+ int neg = 1;
+
+ if (length == 0)
+ return 0;
+ for (int i = 0; str[i] != '\0'; i++) {
+ if (indexof(str[i], base) != -1) {
+ num[start_index] = str[i];
+ start_index++;
+ }
+ else if (str[i] == '-')
+ neg *= -1;
+ else
+ break;
+ }
+ num[length] = '\0';
+ return (parse(num, base, 0, neg));
+}
diff --git a/lib/my/my/my_is_prime.c b/lib/my/my/my_is_prime.c
new file mode 100644
index 0000000..18c5723
--- /dev/null
+++ b/lib/my/my/my_is_prime.c
@@ -0,0 +1,26 @@
+/*
+** EPITECH PROJECT, 2019
+** CPool_Day05_2019
+** File description:
+** Check if a number is a prime number
+*/
+
+int my_compute_square_root(int n);
+
+int my_is_prime(int n)
+{
+ int square;
+
+ if (n <= 1)
+ return (0);
+ if (n == 2)
+ return (1);
+ for (int i = 0; i * i <= n; i++)
+ square = i;
+ for (int i = 2; i < square + 1; i++) {
+ if (n % i == 0)
+ return 0;
+ }
+
+ return (1);
+}
diff --git a/lib/my/my/my_isneg.c b/lib/my/my/my_isneg.c
new file mode 100644
index 0000000..9a91bd3
--- /dev/null
+++ b/lib/my/my/my_isneg.c
@@ -0,0 +1,17 @@
+/*
+** EPITECH PROJECT, 2019
+** CPool_Day03_2019
+** File description:
+** Task 4
+*/
+
+int my_putchar(char c);
+
+int my_isneg(int n)
+{
+ if (n < 0)
+ my_putchar('N');
+ else
+ my_putchar('P');
+ return (0);
+}
diff --git a/lib/my/my/my_print_alpha.c b/lib/my/my/my_print_alpha.c
new file mode 100644
index 0000000..9139faa
--- /dev/null
+++ b/lib/my/my/my_print_alpha.c
@@ -0,0 +1,16 @@
+/*
+** EPITECH PROJECT, 2019
+** CPool_Day03_2019
+** File description:
+** First task
+*/
+
+int my_putchar(char c);
+
+int my_print_alpha(void)
+{
+ for (char i = 'a'; i <= 'z'; i++) {
+ my_putchar(i);
+ }
+ return (0);
+}
diff --git a/lib/my/my/my_print_comb.c b/lib/my/my/my_print_comb.c
new file mode 100644
index 0000000..12b5280
--- /dev/null
+++ b/lib/my/my/my_print_comb.c
@@ -0,0 +1,46 @@
+/*
+** EPITECH PROJECT, 2019
+** CPool_Day03_2019
+** File description:
+** Task 5
+*/
+
+int my_putchar(char c);
+
+static void print_c(char x, char y, char z)
+{
+ my_putchar(x);
+ my_putchar(y);
+ my_putchar(z);
+}
+
+static void increment_y(char *x, char *y, char *z)
+{
+ *x = *x + 1;
+ *y = *x + 1;
+ *z = *y + 1;
+}
+
+int my_print_comb(void)
+{
+ char x = '0';
+ char y = '1';
+ char z = '2';
+
+ while (1) {
+ print_c(x, y, z);
+ z++;
+ if (z > '9') {
+ y++;
+ z = y + 1;
+ }
+ if (y > '8')
+ increment_y(&x, &y, &z);
+ if (x <= '7') {
+ my_putchar(',');
+ my_putchar(' ');
+ }
+ else
+ return 0;
+ }
+}
diff --git a/lib/my/my/my_print_comb2.c b/lib/my/my/my_print_comb2.c
new file mode 100644
index 0000000..fc60b16
--- /dev/null
+++ b/lib/my/my/my_print_comb2.c
@@ -0,0 +1,36 @@
+/*
+** EPITECH PROJECT, 2019
+** CPool_Day03_2019
+** File description:
+** Task 6
+*/
+
+int my_putchar(char c);
+
+static void print_c2(int i, int j)
+{
+ my_putchar('0' + i / 10);
+ my_putchar('0' + i % 10);
+ my_putchar(' ');
+ my_putchar('0' + j / 10);
+ my_putchar('0' + j % 10);
+
+ if (i != 98) {
+ my_putchar(',');
+ my_putchar(' ');
+ }
+}
+
+static void get_group2(int i)
+{
+ for (int j = i + 1; j <= 99; j++)
+ print_c2(i, j);
+}
+
+int my_print_comb2(void)
+{
+ for (int i = 0; i <= 98; i++)
+ get_group2(i);
+
+ return (0);
+}
diff --git a/lib/my/my/my_print_combn.c b/lib/my/my/my_print_combn.c
new file mode 100644
index 0000000..2907386
--- /dev/null
+++ b/lib/my/my/my_print_combn.c
@@ -0,0 +1,62 @@
+/*
+** EPITECH PROJECT, 2019
+** CPool_Day03_2019
+** File description:
+** Task 9
+*/
+
+int my_putchar(char c);
+
+static int is_nbr_valid(int n, int i)
+{
+ if (n < 9) {
+ if (n >= i)
+ return (0);
+ else
+ return (1);
+ }
+ int j = n % 10;
+
+ if (j >= i)
+ return (0);
+ return is_nbr_valid(n / 10, j);
+}
+
+static void print_cn(int n)
+{
+ if (n > 9)
+ print_cn(n / 10);
+
+ my_putchar('0' + n % 10);
+}
+
+static void process_valid_number(int n, int starting, int last_valid)
+{
+ if (last_valid) {
+ my_putchar(',');
+ my_putchar(' ');
+ }
+ if (n < starting && starting != 1)
+ my_putchar('0');
+ print_cn(n);
+}
+
+int my_print_combn(int n)
+{
+ if (n > 10)
+ return 0;
+
+ int starting = 1;
+ int last_valid = 0;
+
+ for (int i = 0; i < n - 1; i++)
+ starting *= 10;
+
+ for (int i = starting / 10; i < starting * 10; i++) {
+ if (is_nbr_valid(i, 10)) {
+ process_valid_number(i, starting, last_valid);
+ last_valid = 1;
+ }
+ }
+ return (0);
+}
diff --git a/lib/my/my/my_print_digits.c b/lib/my/my/my_print_digits.c
new file mode 100644
index 0000000..69b9d48
--- /dev/null
+++ b/lib/my/my/my_print_digits.c
@@ -0,0 +1,16 @@
+/*
+** EPITECH PROJECT, 2019
+** CPool_Day03_2019
+** File description:
+** Task 3
+*/
+
+int my_putchar(char n);
+
+int my_print_digits(void)
+{
+ for (char i = '0'; i <= '9'; i++) {
+ my_putchar(i);
+ }
+ return (0);
+}
diff --git a/lib/my/my/my_print_revalpha.c b/lib/my/my/my_print_revalpha.c
new file mode 100644
index 0000000..c70547f
--- /dev/null
+++ b/lib/my/my/my_print_revalpha.c
@@ -0,0 +1,16 @@
+/*
+** EPITECH PROJECT, 2019
+** CPool_Day03_2019
+** File description:
+** The second task
+*/
+
+int my_putchar(char c);
+
+int my_print_revalpha(void)
+{
+ for (char i = 'z'; i >= 'a'; i--) {
+ my_putchar(i);
+ }
+ return (0);
+}
diff --git a/lib/my/my/my_put_nbr.c b/lib/my/my/my_put_nbr.c
new file mode 100644
index 0000000..6291012
--- /dev/null
+++ b/lib/my/my/my_put_nbr.c
@@ -0,0 +1,30 @@
+/*
+** EPITECH PROJECT, 2019
+** CPool_Day03_2019
+** File description:
+** Task 07
+*/
+
+int my_putchar(char c);
+
+static void get_digit(long digit)
+{
+ long n = digit;
+ char c = '0' + n % 10;
+ if (n > 9) {
+ n /= 10;
+ get_digit(n);
+ }
+ my_putchar(c);
+}
+
+int my_put_nbr(int n)
+{
+ long digit = n;
+ if (n < 0) {
+ my_putchar('-');
+ digit *= -1;
+ }
+ get_digit(digit);
+ return (0);
+}
diff --git a/lib/my/my/my_putchar.c b/lib/my/my/my_putchar.c
new file mode 100644
index 0000000..9e71ab6
--- /dev/null
+++ b/lib/my/my/my_putchar.c
@@ -0,0 +1,13 @@
+/*
+** EPITECH PROJECT, 2019
+** Putchar
+** File description:
+** Yes
+*/
+
+#include
+
+void my_putchar(char c)
+{
+ write(1, &c, 1);
+}
diff --git a/lib/my/my/my_putlong_base.c b/lib/my/my/my_putlong_base.c
new file mode 100644
index 0000000..afdcd5c
--- /dev/null
+++ b/lib/my/my/my_putlong_base.c
@@ -0,0 +1,38 @@
+/*
+** EPITECH PROJECT, 2019
+** Put nbr in a custom base
+** File description:
+** Might be useful later
+*/
+
+#include
+
+int my_strlen(const char *str);
+
+static void display_a_digit(char c)
+{
+ write(1, &c, 1);
+}
+
+static void put_digit(long n, int base_length, const char *base)
+{
+ if (n > base_length - 1)
+ put_digit(n / base_length, base_length, base);
+ display_a_digit(base[n % base_length]);
+}
+
+int my_putlong_base(long nbr, const char *base)
+{
+ int base_length = my_strlen(base);
+
+ if (base_length < 2) {
+ display_a_digit('0');
+ return (0);
+ }
+ if (nbr < 0) {
+ nbr *= -1;
+ display_a_digit('-');
+ }
+ put_digit(nbr, base_length, base);
+ return (0);
+}
diff --git a/lib/my/my/my_putnbr_base.c b/lib/my/my/my_putnbr_base.c
new file mode 100644
index 0000000..ac6ad41
--- /dev/null
+++ b/lib/my/my/my_putnbr_base.c
@@ -0,0 +1,38 @@
+/*
+** EPITECH PROJECT, 2019
+** Put nbr in a custom base
+** File description:
+** Might be useful later
+*/
+
+#include
+
+int my_strlen(const char *str);
+
+static void display_a_digit(char c)
+{
+ write(1, &c, 1);
+}
+
+static void put_digit(int n, int base_length, const char *base)
+{
+ if (n > base_length - 1)
+ put_digit(n / base_length, base_length, base);
+ display_a_digit(base[n % base_length]);
+}
+
+int my_putnbr_base(int nbr, const char *base)
+{
+ int base_length = my_strlen(base);
+
+ if (base_length < 2) {
+ display_a_digit('0');
+ return (0);
+ }
+ if (nbr < 0) {
+ nbr *= -1;
+ display_a_digit('-');
+ }
+ put_digit(nbr, base_length, base);
+ return (0);
+}
diff --git a/lib/my/my/my_putstr.c b/lib/my/my/my_putstr.c
new file mode 100644
index 0000000..62611d5
--- /dev/null
+++ b/lib/my/my/my_putstr.c
@@ -0,0 +1,18 @@
+/*
+** EPITECH PROJECT, 2019
+** CPool_Day04_2019
+** File description:
+** Put string
+*/
+
+int my_putchar(char c);
+
+int my_putstr(const char *str)
+{
+ for (int i = 0; 1; i++) {
+ char c = *(str + i);
+ if (c == '\0')
+ return (0);
+ my_putchar(c);
+ }
+}
diff --git a/lib/my/my/my_revstr.c b/lib/my/my/my_revstr.c
new file mode 100644
index 0000000..1de6af6
--- /dev/null
+++ b/lib/my/my/my_revstr.c
@@ -0,0 +1,21 @@
+/*
+** EPITECH PROJECT, 2019
+** CPool_Day04_2019
+** File description:
+** Reverse string
+*/
+
+int my_strlen(char *str);
+
+char *my_revstr(char *str)
+{
+ int length = my_strlen(str);
+ char dup[length + 1];
+
+ for (int i = 0; i < length; i++)
+ dup[i] = str[i];
+ for (int i = 0; i < length; i++)
+ str[i] = dup[length - 1 - i];
+ str[length] = '\0';
+ return (str);
+}
diff --git a/lib/my/my/my_show_words_array.c b/lib/my/my/my_show_words_array.c
new file mode 100644
index 0000000..f72f5a7
--- /dev/null
+++ b/lib/my/my/my_show_words_array.c
@@ -0,0 +1,19 @@
+/*
+** EPITECH PROJECT, 2019
+** Show an array of words on the screen
+** File description:
+** Nothing to say
+*/
+
+void my_putstr(const char *str);
+
+void my_putchar(char c);
+
+int my_show_word_array(const char *words[])
+{
+ for (int i = 0; words[i]; i++) {
+ my_putstr(words[i]);
+ my_putchar('\n');
+ }
+ return (0);
+}
diff --git a/lib/my/my/my_showmem.c b/lib/my/my/my_showmem.c
new file mode 100644
index 0000000..335b155
--- /dev/null
+++ b/lib/my/my/my_showmem.c
@@ -0,0 +1,73 @@
+/*
+** EPITECH PROJECT, 2019
+** Memory dump
+** File description:
+** Debug Library
+*/
+
+const char *hex = "0123456789abcdef";
+
+#include "my.h"
+#include
+
+int get_size(long n, const char *base);
+
+void my_putchar(char c);
+
+int is_printable(char c);
+
+void display_x_char(char c, int count)
+{
+ for (int i = 0; i < count; i++)
+ write(1, &c, 1);
+}
+
+void print_ptr(void *ptr)
+{
+ write(1, "0x", 2);
+ my_putlong_base((long)ptr, hex);
+}
+
+void print_hexa(char *ptr, int size)
+{
+ for (int i = 0; i < 16; i++) {
+ if (i >= size) {
+ display_x_char(' ', 40 - (i * 2 + i / 2));
+ return;
+ }
+ if (ptr[i] < 16)
+ my_putchar('0');
+ my_putlong_base((long)ptr[i], hex);
+ if (i % 2 == 1)
+ my_putchar(' ');
+ }
+}
+
+void print_str_to(char *ptr, int max)
+{
+ int overflow = 0;
+
+ for (int i = 0; i < max; i++) {
+ if (overflow || !is_printable(ptr[i]))
+ my_putchar('.');
+ else
+ my_putchar(ptr[i]);
+ if (!overflow)
+ overflow = ptr[i] == '\0';
+ }
+}
+
+void my_showmem(char *str, int size)
+{
+ int padding = size % 16;
+ int line_count = padding == 0 ? size / 16 : size / 16 + 1;
+ char *ptr;
+
+ for (int i = 0; i < line_count; i++) {
+ ptr = (str + i * 16);
+ print_ptr((void *)(ptr - str));
+ print_hexa(ptr, size - i * 16);
+ print_str_to(ptr, 16);
+ my_putchar('\n');
+ }
+}
diff --git a/lib/my/my/my_showstr.c b/lib/my/my/my_showstr.c
new file mode 100644
index 0000000..fdcecd2
--- /dev/null
+++ b/lib/my/my/my_showstr.c
@@ -0,0 +1,33 @@
+/*
+** EPITECH PROJECT, 2019
+** Show Str With non printable values in hexa
+** File description:
+** Debugger Library
+*/
+
+#include
+
+int is_printable(char c);
+
+int my_putnbr_base(int i, const char *base);
+
+void puthex(char c)
+{
+ write(1, "\\", 1);
+ if (c < 8)
+ write(1, "0", 1);
+ if (c < 16)
+ write(1, "0", 1);
+ my_putnbr_base(c, "01234567");
+}
+
+int my_showstr(const char *str)
+{
+ for (int i = 0; str[i]; i++) {
+ if (is_printable(str[i]))
+ write(1, &(str[i]), 1);
+ else
+ puthex(str[i]);
+ }
+ return (0);
+}
diff --git a/lib/my/my/my_sort_int_array.c b/lib/my/my/my_sort_int_array.c
new file mode 100644
index 0000000..643dc42
--- /dev/null
+++ b/lib/my/my/my_sort_int_array.c
@@ -0,0 +1,24 @@
+/*
+** EPITECH PROJECT, 2019
+** CPool_Day04_2019
+** File description:
+** Int array sorter
+*/
+
+static void sort_linear(int *array, int size)
+{
+ for (int i = 0; i < size - 1; i++) {
+ if (array[i] > array[i + 1]) {
+ int buf = array[i];
+ array[i] = array[i + 1];
+ array[i + 1] = buf;
+ }
+ }
+}
+
+int my_sort_int_array(int *array, int size)
+{
+ for (int i = 0; i < size; i++)
+ sort_linear(array, size);
+ return (0);
+}
diff --git a/lib/my/my/my_str_isalpha.c b/lib/my/my/my_str_isalpha.c
new file mode 100644
index 0000000..046c0fe
--- /dev/null
+++ b/lib/my/my/my_str_isalpha.c
@@ -0,0 +1,24 @@
+/*
+** EPITECH PROJECT, 2019
+** Str is alpha
+** File description:
+** Duplicate of the string.h (I think)
+*/
+
+int is_alpha(char c)
+{
+ if (c >= 'a' && c <= 'z')
+ return (1);
+ if (c >= 'A' && c <= 'Z')
+ return (1);
+ return (0);
+}
+
+int my_str_isalpha(const char *str)
+{
+ for (int i = 0; str[i] != '\0'; i++) {
+ if (!is_alpha(str[i]))
+ return (0);
+ }
+ return (1);
+}
diff --git a/lib/my/my/my_str_islower.c b/lib/my/my/my_str_islower.c
new file mode 100644
index 0000000..56d38c5
--- /dev/null
+++ b/lib/my/my/my_str_islower.c
@@ -0,0 +1,33 @@
+/*
+** EPITECH PROJECT, 2019
+** Str is alpha
+** File description:
+** Duplicate of the string.h (I think)
+*/
+
+int is_digit(char c);
+
+int is_lowercase(char c)
+{
+ if (c >= 'a' && c <= 'z')
+ return (1);
+ return (0);
+}
+
+int my_str_islower(const char *str)
+{
+ for (int i = 0; str[i] != '\0'; i++) {
+ if (!is_lowercase(str[i]))
+ return (0);
+ }
+ return (1);
+}
+
+int my_str_islower_or_num(const char *str)
+{
+ for (int i = 0; str[i] != '\0'; i++) {
+ if (!is_lowercase(str[i]) && !is_digit(str[i]))
+ return (0);
+ }
+ return (1);
+}
diff --git a/lib/my/my/my_str_isnum.c b/lib/my/my/my_str_isnum.c
new file mode 100644
index 0000000..2978430
--- /dev/null
+++ b/lib/my/my/my_str_isnum.c
@@ -0,0 +1,22 @@
+/*
+** EPITECH PROJECT, 2019
+** Str is alpha
+** File description:
+** Duplicate of the string.h (I think)
+*/
+
+int is_digit(char c)
+{
+ if (c >= '0' && c <= '9')
+ return (1);
+ return (0);
+}
+
+int my_str_isnum(const char *str)
+{
+ for (int i = 0; str[i] != '\0'; i++) {
+ if (!is_digit(str[i]))
+ return (0);
+ }
+ return (1);
+}
diff --git a/lib/my/my/my_str_isprintable.c b/lib/my/my/my_str_isprintable.c
new file mode 100644
index 0000000..13a8f9e
--- /dev/null
+++ b/lib/my/my/my_str_isprintable.c
@@ -0,0 +1,22 @@
+/*
+** EPITECH PROJECT, 2019
+** Str is alpha
+** File description:
+** Duplicate of the string.h (I think)
+*/
+
+int is_printable(char c)
+{
+ if (c >= ' ' && c < 127)
+ return (1);
+ return (0);
+}
+
+int my_str_isprintable(const char *str)
+{
+ for (int i = 0; str[i] != '\0'; i++) {
+ if (!is_printable(str[i]))
+ return (0);
+ }
+ return (1);
+}
diff --git a/lib/my/my/my_str_isupper.c b/lib/my/my/my_str_isupper.c
new file mode 100644
index 0000000..ec4c8f7
--- /dev/null
+++ b/lib/my/my/my_str_isupper.c
@@ -0,0 +1,22 @@
+/*
+** EPITECH PROJECT, 2019
+** Str is alpha
+** File description:
+** Duplicate of the string.h (I think)
+*/
+
+int is_upper(char c)
+{
+ if (c >= 'A' && c <= 'Z')
+ return (1);
+ return (0);
+}
+
+int my_str_isupper(const char *str)
+{
+ for (int i = 0; str[i] != '\0'; i++) {
+ if (!is_upper(str[i]))
+ return (0);
+ }
+ return (1);
+}
diff --git a/lib/my/my/my_str_replace.c b/lib/my/my/my_str_replace.c
new file mode 100644
index 0000000..fd850f6
--- /dev/null
+++ b/lib/my/my/my_str_replace.c
@@ -0,0 +1,23 @@
+/*
+** EPITECH PROJECT, 2020
+** My3D
+** File description:
+** my_str_replace
+*/
+
+#include "my.h"
+
+char *my_str_replace(char *str, const char *to_replace, char c)
+{
+ char *p;
+ int len = my_strlen(to_replace);
+
+ while ((p = my_strstr(str, to_replace))) {
+ *p = c;
+ p++;
+ for (char *ptr = p + len - 1; *ptr; ptr++, p++)
+ *p = *ptr;
+ *p = '\0';
+ }
+ return (str);
+}
\ No newline at end of file
diff --git a/lib/my/my/my_str_to_word_array.c b/lib/my/my/my_str_to_word_array.c
new file mode 100644
index 0000000..97a191a
--- /dev/null
+++ b/lib/my/my/my_str_to_word_array.c
@@ -0,0 +1,70 @@
+/*
+** EPITECH PROJECT, 2019
+** Convert a string to a char **
+** File description:
+** Split with every non alpha-numerical characters
+*/
+
+#include
+
+int is_alphanum(char c);
+
+int first_alphanum(const char *str);
+
+static int count_words(const char *str)
+{
+ int count = 1;
+
+ if (first_alphanum(str) == -1)
+ return (0);
+ for (int i = first_alphanum(str); str[i + 1]; i++) {
+ if (!is_alphanum(str[i]) && is_alphanum(str[i + 1]))
+ count++;
+ }
+ return (count);
+}
+
+static int get_word_length(const char *str, int n)
+{
+ int count = 0;
+ int word_length = 0;
+
+ for (int i = first_alphanum(str); str[i]; i++) {
+ if (!is_alphanum(str[i]) && is_alphanum(str[i + 1]))
+ count++;
+ else if (count == n && is_alphanum(str[i]))
+ word_length++;
+ }
+ return (word_length);
+}
+
+static char *get_word(const char *str, int n)
+{
+ int length = get_word_length(str, n);
+ char *ret = malloc(sizeof(*ret) * (length + 1));
+ int count = 0;
+ int word_length = 0;
+
+ for (int i = first_alphanum(str); word_length != length; i++) {
+ if (!is_alphanum(str[i]) && is_alphanum(str[i + 1]))
+ count++;
+ else if (count == n) {
+ ret[word_length] = str[i];
+ word_length++;
+ }
+ }
+ ret[length] = '\0';
+ return (ret);
+}
+
+char **my_str_to_word_array(const char *str)
+{
+ int count = count_words(str);
+ char **ret = malloc(sizeof(*ret) * (count + 1));
+
+ for (int i = 0; i < count; i++) {
+ ret[i] = get_word(str, i);
+ }
+ ret[count] = 0;
+ return (ret);
+}
diff --git a/lib/my/my/my_strcapitalize.c b/lib/my/my/my_strcapitalize.c
new file mode 100644
index 0000000..65b932f
--- /dev/null
+++ b/lib/my/my/my_strcapitalize.c
@@ -0,0 +1,32 @@
+/*
+** EPITECH PROJECT, 2019
+** ToUpercase
+** File description:
+** string.h
+*/
+
+int is_num(char c)
+{
+ return (c >= '0' && c <= '9');
+}
+
+int is_letter(char c)
+{
+ return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
+}
+
+char *my_strcapitalize(char *str)
+{
+ int capitalize_next = 1;
+
+ for (int i = 0; str[i] != '\0'; i++) {
+ if (capitalize_next && str[i] > 'a' && str[i] < 'z')
+ str[i] += 'A' - 'a';
+
+ if (is_num(str[i]) || is_letter(str[i]))
+ capitalize_next = 1;
+ else
+ capitalize_next = 0;
+ }
+ return (str);
+}
diff --git a/lib/my/my/my_strcat.c b/lib/my/my/my_strcat.c
new file mode 100644
index 0000000..1bc8e8e
--- /dev/null
+++ b/lib/my/my/my_strcat.c
@@ -0,0 +1,19 @@
+/*
+** EPITECH PROJECT, 2019
+** String cat
+** File description:
+** The end of the string.h lib
+*/
+
+int my_strlen(const char *dest);
+
+char *my_strcat(char *dest, const char *src)
+{
+ int i;
+ int dest_length = my_strlen(dest);
+
+ for (i = 0; src[i]; i++)
+ dest[dest_length + i] = src[i];
+ dest[dest_length + i] = '\0';
+ return (dest);
+}
diff --git a/lib/my/my/my_strchr.c b/lib/my/my/my_strchr.c
new file mode 100644
index 0000000..8bd6717
--- /dev/null
+++ b/lib/my/my/my_strchr.c
@@ -0,0 +1,17 @@
+/*
+** EPITECH PROJECT, 2019
+** MUL_my_runner_2019
+** File description:
+** my_strchr
+*/
+
+#include "stddef.h"
+
+char *my_strchr(char *str, char c)
+{
+ for (int i = 0; str[i]; i++) {
+ if (str[i] == c)
+ return (&str[i]);
+ }
+ return (NULL);
+}
\ No newline at end of file
diff --git a/lib/my/my/my_strcmp.c b/lib/my/my/my_strcmp.c
new file mode 100644
index 0000000..e3a4972
--- /dev/null
+++ b/lib/my/my/my_strcmp.c
@@ -0,0 +1,25 @@
+/*
+** EPITECH PROJECT, 2019
+** StrCmp
+** File description:
+** String.h duplicate
+*/
+
+int my_strcmp(const char *str1, const char *str2)
+{
+ int i;
+ int ret;
+
+ for (i = 0; str1[i] != '\0'; i++) {
+ if (str2[i] == '\0')
+ return str1[i];
+ ret = str1[i] - str2[i];
+ if (ret != 0)
+ return (ret);
+ }
+
+ if (str2[i] == '\0')
+ return (0);
+ else
+ return -str2[i];
+}
diff --git a/lib/my/my/my_strcpy.c b/lib/my/my/my_strcpy.c
new file mode 100644
index 0000000..a1bf550
--- /dev/null
+++ b/lib/my/my/my_strcpy.c
@@ -0,0 +1,16 @@
+/*
+** EPITECH PROJECT, 2019
+** String copy
+** File description:
+** Copy an entire string
+*/
+
+char *my_strcpy(char *dest, const char *src)
+{
+ int i;
+
+ for (i = 0; src[i] != '\0'; i++)
+ dest[i] = src[i];
+ dest[i] = '\0';
+ return (dest);
+}
diff --git a/lib/my/my/my_strdup.c b/lib/my/my/my_strdup.c
new file mode 100644
index 0000000..bc85464
--- /dev/null
+++ b/lib/my/my/my_strdup.c
@@ -0,0 +1,23 @@
+/*
+** EPITECH PROJECT, 2019
+** Str dup replicate
+** File description:
+** MALLOC YES
+*/
+
+#include
+
+int my_strlen(const char *src);
+
+char *my_strdup(const char *src)
+{
+ int length = my_strlen(src);
+ char *ret = malloc(sizeof(char) * (length + 1));
+
+ if (!ret)
+ return (NULL);
+ for (int i = 0; i < length; i++)
+ ret[i] = src[i];
+ ret[length] = '\0';
+ return (ret);
+}
diff --git a/lib/my/my/my_strlen.c b/lib/my/my/my_strlen.c
new file mode 100644
index 0000000..82c15a2
--- /dev/null
+++ b/lib/my/my/my_strlen.c
@@ -0,0 +1,14 @@
+/*
+** EPITECH PROJECT, 2019
+** CPool_Day04_2019
+** File description:
+** Strlen
+*/
+
+int my_strlen(const char *str)
+{
+ for (int i = 0; 1; i++) {
+ if (*(str + i) == '\0')
+ return i;
+ }
+}
diff --git a/lib/my/my/my_strlowcase.c b/lib/my/my/my_strlowcase.c
new file mode 100644
index 0000000..54adc9b
--- /dev/null
+++ b/lib/my/my/my_strlowcase.c
@@ -0,0 +1,15 @@
+/*
+** EPITECH PROJECT, 2019
+** ToUpercase
+** File description:
+** string.h
+*/
+
+char *my_strlowcase(char *str)
+{
+ for (int i = 0; str[i] != '\0'; i++) {
+ if (str[i] > 'A' && str[i] < 'Z')
+ str[i] += 'a' - 'A';
+ }
+ return (str);
+}
diff --git a/lib/my/my/my_strncat.c b/lib/my/my/my_strncat.c
new file mode 100644
index 0000000..7e5622d
--- /dev/null
+++ b/lib/my/my/my_strncat.c
@@ -0,0 +1,19 @@
+/*
+** EPITECH PROJECT, 2019
+** String N Cat
+** File description:
+** End of the string.h lib
+*/
+
+int my_strlen(const char *str);
+
+char *my_strncat(char *dest, const char *src, int n)
+{
+ int i;
+ int dest_length = my_strlen(dest);
+
+ for (i = 0; i < n && src[i]; i++)
+ dest[dest_length + i] = src[i];
+ dest[dest_length + i] = '\0';
+ return (dest);
+}
diff --git a/lib/my/my/my_strncmp.c b/lib/my/my/my_strncmp.c
new file mode 100644
index 0000000..c5918a1
--- /dev/null
+++ b/lib/my/my/my_strncmp.c
@@ -0,0 +1,25 @@
+/*
+** EPITECH PROJECT, 2019
+** StrNCmp
+** File description:
+** String.h duplicate
+*/
+
+int my_strncmp(const char *str1, const char *str2, int n)
+{
+ int i;
+ int ret;
+
+ for (i = 0; i < n && str1[i] != '\0'; i++) {
+ if (str2[i] == '\0')
+ return str1[i];
+ ret = str1[i] - str2[i];
+ if (ret != 0)
+ return (ret);
+ }
+
+ if (i == n || str2[i] == '\0')
+ return (0);
+ else
+ return -str2[i];
+}
diff --git a/lib/my/my/my_strncpy.c b/lib/my/my/my_strncpy.c
new file mode 100644
index 0000000..cd39de4
--- /dev/null
+++ b/lib/my/my/my_strncpy.c
@@ -0,0 +1,21 @@
+/*
+** EPITECH PROJECT, 2019
+** String copy n first chars
+** File description:
+** Same but different
+*/
+
+char *my_strncpy(char *dest, const char* src, int n)
+{
+ int overflow = 0;
+
+ for (int i = 0; i < n; i++) {
+ if (overflow)
+ dest[i] = '\0';
+ else {
+ dest[i] = src[i];
+ overflow = (src[i] == '\0');
+ }
+ }
+ return (dest);
+}
diff --git a/lib/my/my/my_strstr.c b/lib/my/my/my_strstr.c
new file mode 100644
index 0000000..b93e9a8
--- /dev/null
+++ b/lib/my/my/my_strstr.c
@@ -0,0 +1,26 @@
+/*
+** EPITECH PROJECT, 2019
+** StrStr duplicate
+** File description:
+** A search in string function
+*/
+
+char *my_strstr(char *str, const char *to_find)
+{
+ int i;
+ int search_index = 0;
+
+ for (i = 0; str[i] != '\0'; i++) {
+ if (to_find[search_index] == '\0')
+ return (str + i - search_index);
+ if (str[i] == to_find[search_index])
+ search_index++;
+ else if (str[i] == to_find[0])
+ search_index = 1;
+ else
+ search_index = 0;
+ }
+ if (to_find[search_index] == '\0')
+ return (str + i - search_index);
+ return 0;
+}
diff --git a/lib/my/my/my_strupcase.c b/lib/my/my/my_strupcase.c
new file mode 100644
index 0000000..e2e87cc
--- /dev/null
+++ b/lib/my/my/my_strupcase.c
@@ -0,0 +1,15 @@
+/*
+** EPITECH PROJECT, 2019
+** ToUpercase
+** File description:
+** string.h
+*/
+
+char *my_strupcase(char *str)
+{
+ for (int i = 0; str[i] != '\0'; i++) {
+ if (str[i] > 'a' && str[i] < 'z')
+ str[i] += 'A' - 'a';
+ }
+ return (str);
+}
diff --git a/lib/my/my/my_swap.c b/lib/my/my/my_swap.c
new file mode 100644
index 0000000..84ff01c
--- /dev/null
+++ b/lib/my/my/my_swap.c
@@ -0,0 +1,13 @@
+/*
+** EPITECH PROJECT, 2019
+** CPool_Day04_2019
+** File description:
+** Swap int
+*/
+
+void my_swap(int *a, int *b)
+{
+ int n = *a;
+ *a = *b;
+ *b = n;
+}
diff --git a/lib/my/my/tostr.c b/lib/my/my/tostr.c
new file mode 100644
index 0000000..20e31a3
--- /dev/null
+++ b/lib/my/my/tostr.c
@@ -0,0 +1,63 @@
+/*
+** EPITECH PROJECT, 2019
+** Convering Between bases
+** File description:
+** Moldavie-Land
+*/
+
+#include
+
+static void put_digit(int n, const char *base, char *ret, int i)
+{
+ int base_length = 10;
+
+ if (n > base_length - 1)
+ put_digit(n / base_length, base, ret, i - 1);
+ ret[i] = base[n % base_length];
+}
+
+char *putnbr_in(int nbr, const char *base, char *ret, int ret_length)
+{
+ int base_length = 10;
+ int i = ret_length;
+
+ if (base_length < 2) {
+ ret = "0";
+ return (ret);
+ }
+ if (nbr < 0) {
+ nbr *= -1;
+ ret[0] = '-';
+ } else {
+ i--;
+ ret[i] = '\0';
+ }
+ put_digit(nbr, base, ret, i);
+ return (ret);
+}
+
+int get_new_size(int n)
+{
+ int base_size = 10;
+ int i = 1;
+
+ while (n >= base_size) {
+ n /= base_size;
+ i++;
+ }
+ return (i);
+}
+
+char *tostr(int n)
+{
+ const char *base = "0123456789";
+ int count = get_new_size(n);
+ char *ret = malloc(sizeof(char) * (count + 1));
+
+ if (!ret)
+ return (NULL);
+
+ putnbr_in(n, base, ret, count);
+ ret[count] = '\0';
+ return (ret);
+}
diff --git a/lib/my/my/utility.c b/lib/my/my/utility.c
new file mode 100644
index 0000000..291e646
--- /dev/null
+++ b/lib/my/my/utility.c
@@ -0,0 +1,20 @@
+/*
+** EPITECH PROJECT, 2019
+** Utility for the showmem
+** File description:
+** utility
+*/
+
+#include "my.h"
+
+int get_size(long n, const char *base)
+{
+ int base_size = my_strlen(base);
+ int i = 1;
+
+ while (n >= base_size) {
+ n /= base_size;
+ i++;
+ }
+ return (i);
+}
\ No newline at end of file
diff --git a/lib/my/src/formaters/big_hexa_formater.c b/lib/my/src/formaters/big_hexa_formater.c
new file mode 100644
index 0000000..5782ad8
--- /dev/null
+++ b/lib/my/src/formaters/big_hexa_formater.c
@@ -0,0 +1,31 @@
+/*
+** EPITECH PROJECT, 2019
+** int formater
+** File description:
+** int_formater
+*/
+
+#include "formaters.h"
+#include "my.h"
+#include
+#include
+
+int big_hexa_formater(va_list ap, char mod[MODIFIERS_SIZE])
+{
+ long long int var;
+ int nbrlen;
+
+ if (count('l', mod) >= 2)
+ var = va_arg(ap, unsigned long long int);
+ else if (count('l', mod) == 1)
+ var = va_arg(ap, unsigned long);
+ else
+ var = va_arg(ap, unsigned int);
+ if (contains('0', mod))
+ nbrlen = my_getnbr(&mod[last_mod(mod)]);
+ else
+ nbrlen = 0;
+ if (var != 0 && contains('#', mod))
+ nbrlen -= write(1, "0X", 2);
+ return (my_putlonglong_base(var, "0123456789ABCDEF", nbrlen));
+}
\ No newline at end of file
diff --git a/lib/my/src/formaters/char_formater.c b/lib/my/src/formaters/char_formater.c
new file mode 100644
index 0000000..8ab20c7
--- /dev/null
+++ b/lib/my/src/formaters/char_formater.c
@@ -0,0 +1,18 @@
+/*
+** EPITECH PROJECT, 2019
+** Char formater
+** File description:
+** char_formater
+*/
+
+#include "formaters.h"
+#include "my.h"
+#include
+#include
+
+int char_formater(va_list ap, char mod[MODIFIERS_SIZE])
+{
+ char var = (char)va_arg(ap, int);
+
+ return (write(1, &var, 1));
+}
\ No newline at end of file
diff --git a/lib/my/src/formaters/float_formater.c b/lib/my/src/formaters/float_formater.c
new file mode 100644
index 0000000..debc171
--- /dev/null
+++ b/lib/my/src/formaters/float_formater.c
@@ -0,0 +1,24 @@
+/*
+** EPITECH PROJECT, 2019
+** int formater
+** File description:
+** int_formater
+*/
+
+#include "formaters.h"
+#include "my.h"
+#include
+#include
+
+int float_formater(va_list ap, char mod[MODIFIERS_SIZE])
+{
+ double var = va_arg(ap, double);
+ int decimal = (var - (int)var) * 1000000 + 1;
+
+ while (decimal % 10 == 0)
+ decimal /= 10;
+ my_put_nbr((int)var);
+ write(1, ".", 1);
+ my_put_nbr(decimal);
+ return (0);
+}
\ No newline at end of file
diff --git a/lib/my/src/formaters/hexa_formater.c b/lib/my/src/formaters/hexa_formater.c
new file mode 100644
index 0000000..8c384ee
--- /dev/null
+++ b/lib/my/src/formaters/hexa_formater.c
@@ -0,0 +1,31 @@
+/*
+** EPITECH PROJECT, 2019
+** int formater
+** File description:
+** int_formater
+*/
+
+#include "formaters.h"
+#include "my.h"
+#include
+#include
+
+int hexa_formater(va_list ap, char mod[MODIFIERS_SIZE])
+{
+ long long int var;
+ int nbrlen;
+
+ if (count('l', mod) >= 2)
+ var = va_arg(ap, unsigned long long int);
+ else if (count('l', mod) == 1)
+ var = va_arg(ap, unsigned long);
+ else
+ var = va_arg(ap, unsigned int);
+ if (contains('0', mod))
+ nbrlen = my_getnbr(&mod[last_mod(mod)]);
+ else
+ nbrlen = 0;
+ if (var != 0 && contains('#', mod))
+ nbrlen -= write(1, "0x", 2);
+ return (my_putlonglong_base(var, "0123456789abcdef", nbrlen));
+}
\ No newline at end of file
diff --git a/lib/my/src/formaters/int_formater.c b/lib/my/src/formaters/int_formater.c
new file mode 100644
index 0000000..dc307c9
--- /dev/null
+++ b/lib/my/src/formaters/int_formater.c
@@ -0,0 +1,33 @@
+/*
+** EPITECH PROJECT, 2019
+** int formater
+** File description:
+** int_formater
+*/
+
+#include "formaters.h"
+#include "my.h"
+#include
+#include
+
+int int_formater(va_list ap, char mod[MODIFIERS_SIZE])
+{
+ long long int var;
+ int nbrlen;
+
+ if (count('l', mod) >= 2)
+ var = va_arg(ap, long long int);
+ else if (count('l', mod) == 1)
+ var = va_arg(ap, long);
+ else
+ var = va_arg(ap, int);
+ if (contains('0', mod))
+ nbrlen = my_getnbr(&mod[last_mod(mod)]);
+ else
+ nbrlen = 0;
+ if (var >= 0 && contains(' ', mod) && !contains('+', mod))
+ nbrlen -= write(1, " ", 1);
+ if (var >= 0 && contains('+', mod))
+ nbrlen -= write(1, "+", 1);
+ return (my_putlonglong_base(var, "0123456789", nbrlen));
+}
\ No newline at end of file
diff --git a/lib/my/src/formaters/no_format.c b/lib/my/src/formaters/no_format.c
new file mode 100644
index 0000000..178c22b
--- /dev/null
+++ b/lib/my/src/formaters/no_format.c
@@ -0,0 +1,16 @@
+/*
+** EPITECH PROJECT, 2019
+** int formater
+** File description:
+** int_formater
+*/
+
+#include "formaters.h"
+#include "my.h"
+#include
+#include
+
+int no_format(va_list _ap, char mod[MODIFIERS_SIZE])
+{
+ return (write(1, "%", 1));
+}
\ No newline at end of file
diff --git a/lib/my/src/formaters/octal_formater.c b/lib/my/src/formaters/octal_formater.c
new file mode 100644
index 0000000..da7c016
--- /dev/null
+++ b/lib/my/src/formaters/octal_formater.c
@@ -0,0 +1,31 @@
+/*
+** EPITECH PROJECT, 2019
+** int formater
+** File description:
+** int_formater
+*/
+
+#include "formaters.h"
+#include "my.h"
+#include
+#include
+
+int octal_formater(va_list ap, char mod[MODIFIERS_SIZE])
+{
+ long long int var;
+ int nbrlen;
+
+ if (count('l', mod) >= 2)
+ var = va_arg(ap, unsigned long long int);
+ else if (count('l', mod) == 1)
+ var = va_arg(ap, unsigned long);
+ else
+ var = va_arg(ap, unsigned int);
+ if (contains('0', mod))
+ nbrlen = my_getnbr(&mod[last_mod(mod)]);
+ else
+ nbrlen = 0;
+ if (var != 0 && contains('#', mod))
+ nbrlen -= write(1, "0", 2);
+ return (my_putlonglong_base(var, "01234567", nbrlen));
+}
\ No newline at end of file
diff --git a/lib/my/src/formaters/ptr_formater.c b/lib/my/src/formaters/ptr_formater.c
new file mode 100644
index 0000000..bcd0c41
--- /dev/null
+++ b/lib/my/src/formaters/ptr_formater.c
@@ -0,0 +1,19 @@
+/*
+** EPITECH PROJECT, 2019
+** Char formater
+** File description:
+** char_formater
+*/
+
+#include "formaters.h"
+#include "my.h"
+#include
+#include
+
+int ptr_formater(va_list ap, char mod[MODIFIERS_SIZE])
+{
+ void *var = va_arg(ap, void *);
+
+ print_ptr(var);
+ return (0);
+}
\ No newline at end of file
diff --git a/lib/my/src/formaters/string_formater.c b/lib/my/src/formaters/string_formater.c
new file mode 100644
index 0000000..a0c531c
--- /dev/null
+++ b/lib/my/src/formaters/string_formater.c
@@ -0,0 +1,27 @@
+/*
+** EPITECH PROJECT, 2019
+** String formater
+** File description:
+** string_formater
+*/
+
+#include
+#include
+#include "formaters.h"
+#include "my.h"
+
+int string_formater(va_list ap, char mod[MODIFIERS_SIZE])
+{
+ char *var = va_arg(ap, char *);
+ int length;
+
+ if (var == NULL) {
+ write(1, "(null)", 7);
+ return 7;
+ }
+ if (contains('0', mod))
+ length = my_getnbr(&mod[last_mod(mod)]);
+ else
+ length = my_strlen(var);
+ return (write(1, var, length));
+}
\ No newline at end of file
diff --git a/lib/my/src/formaters/string_nonprintable_formater.c b/lib/my/src/formaters/string_nonprintable_formater.c
new file mode 100644
index 0000000..8520e83
--- /dev/null
+++ b/lib/my/src/formaters/string_nonprintable_formater.c
@@ -0,0 +1,19 @@
+/*
+** EPITECH PROJECT, 2019
+** String formater
+** File description:
+** string_formater
+*/
+
+#include
+#include
+#include "formaters.h"
+#include "my.h"
+
+int string_nonprintable_formater(va_list ap, char mod[MODIFIERS_SIZE])
+{
+ char *var = va_arg(ap, char *);
+
+ my_showstr(var);
+ return (0);
+}
\ No newline at end of file
diff --git a/lib/my/src/formaters/ubinary_formater.c b/lib/my/src/formaters/ubinary_formater.c
new file mode 100644
index 0000000..53779aa
--- /dev/null
+++ b/lib/my/src/formaters/ubinary_formater.c
@@ -0,0 +1,29 @@
+/*
+** EPITECH PROJECT, 2019
+** int formater
+** File description:
+** int_formater
+*/
+
+#include "formaters.h"
+#include "my.h"
+#include
+#include
+
+int ubinary_formater(va_list ap, char mod[MODIFIERS_SIZE])
+{
+ long long int var;
+ int nbrlen;
+
+ if (count('l', mod) >= 2)
+ var = va_arg(ap, unsigned long long int);
+ else if (count('l', mod) == 1)
+ var = va_arg(ap, unsigned long);
+ else
+ var = va_arg(ap, unsigned int);
+ if (contains('0', mod))
+ nbrlen = my_getnbr(&mod[last_mod(mod)]);
+ else
+ nbrlen = 0;
+ return (my_putlonglong_base(var, "01", nbrlen));
+}
\ No newline at end of file
diff --git a/lib/my/src/formaters/uint_formater.c b/lib/my/src/formaters/uint_formater.c
new file mode 100644
index 0000000..47705a9
--- /dev/null
+++ b/lib/my/src/formaters/uint_formater.c
@@ -0,0 +1,29 @@
+/*
+** EPITECH PROJECT, 2019
+** int formater
+** File description:
+** int_formater
+*/
+
+#include "formaters.h"
+#include "my.h"
+#include
+#include
+
+int uint_formater(va_list ap, char mod[MODIFIERS_SIZE])
+{
+ long long int var;
+ int nbrlen;
+
+ if (count('l', mod) >= 2)
+ var = va_arg(ap, unsigned long long int);
+ else if (count('l', mod) == 1)
+ var = va_arg(ap, unsigned long);
+ else
+ var = va_arg(ap, unsigned int);
+ if (contains('0', mod))
+ nbrlen = my_getnbr(&mod[last_mod(mod)]);
+ else
+ nbrlen = 0;
+ return (my_putlonglong_base(var, "0123456789", nbrlen));
+}
\ No newline at end of file
diff --git a/lib/my/src/get_nbr_size.c b/lib/my/src/get_nbr_size.c
new file mode 100644
index 0000000..6157162
--- /dev/null
+++ b/lib/my/src/get_nbr_size.c
@@ -0,0 +1,24 @@
+/*
+** EPITECH PROJECT, 2019
+** Get nbr size
+** File description:
+** get_nbr_size
+*/
+
+#include "my.h"
+
+int get_nbr_len(long long int n, const char *base)
+{
+ int base_size = my_strlen(base);
+ int i = 1;
+
+ if (n < 0) {
+ n *= -1;
+ i++;
+ }
+ while (n >= base_size) {
+ n /= base_size;
+ i++;
+ }
+ return (i);
+}
\ No newline at end of file
diff --git a/lib/my/src/my_putlonglong_base.c b/lib/my/src/my_putlonglong_base.c
new file mode 100644
index 0000000..4d1159b
--- /dev/null
+++ b/lib/my/src/my_putlonglong_base.c
@@ -0,0 +1,42 @@
+/*
+** EPITECH PROJECT, 2019
+** Put nbr in a custom base
+** File description:
+** Might be useful later
+*/
+
+#include
+#include "formaters.h"
+
+int my_strlen(const char *str);
+
+static void display_a_digit(char c)
+{
+ write(1, &c, 1);
+}
+
+static void put_digit(long long int n, int base_length, const char *base)
+{
+ if (n > base_length - 1)
+ put_digit(n / base_length, base_length, base);
+ display_a_digit(base[n % base_length]);
+}
+
+int my_putlonglong_base(long long int nbr, const char *base, int nbrlen)
+{
+ int base_length = my_strlen(base);
+
+ if (base_length < 2) {
+ display_a_digit(base[0]);
+ return (0);
+ }
+ if (nbr < 0) {
+ nbr *= -1;
+ display_a_digit('-');
+ nbrlen--;
+ }
+ for (int i = get_nbr_len(nbr, base); i < nbrlen; i++)
+ write(1, base, 1);
+ put_digit(nbr, base_length, base);
+ return (nbrlen + nbr < 0 ? 1 : 0);
+}
diff --git a/lib/my/src/printf.c b/lib/my/src/printf.c
new file mode 100644
index 0000000..3fa08e7
--- /dev/null
+++ b/lib/my/src/printf.c
@@ -0,0 +1,96 @@
+/*
+** EPITECH PROJECT, 2019
+** Sum stdarg
+** File description:
+** sum_stdarg
+*/
+
+#include "formaters.h"
+#include "my.h"
+#include
+#include
+
+formater_t formaters[] = {{string_formater, 's'},
+ {string_nonprintable_formater, 'S'},
+ {char_formater, 'c'},
+ {int_formater, 'i'},
+ {int_formater, 'd'},
+ {octal_formater, 'o'},
+ {hexa_formater, 'x'},
+ {big_hexa_formater, 'X'},
+ {uint_formater, 'u'},
+ {ptr_formater, 'p'},
+ {ubinary_formater, 'b'},
+ {float_formater, 'f'},
+ {float_formater, 'F'},
+ {no_format, '%'},
+ {0, 0}
+};
+
+const char modifiersCst[] = "#0-+ hl";
+
+int format(va_list ap, char flag, char modifiers[MODIFIERS_SIZE])
+{
+ for (int i = 0; formaters[i].flag; i++) {
+ if (formaters[i].flag == flag) {
+ return (formaters[i].func(ap, modifiers));
+ }
+ }
+ return (0);
+}
+
+int is_flag(char c)
+{
+ for (int i = 0; formaters[i].flag; i++) {
+ if (formaters[i].flag == c) {
+ return (1);
+ }
+ }
+ return (0);
+}
+
+int is_modifier(char c)
+{
+ for (int i = 0; modifiersCst[i]; i++) {
+ if (modifiersCst[i] == c)
+ return (1);
+ }
+ return (0);
+}
+
+int get_modifiers(const char *str, char flags[MODIFIERS_SIZE])
+{
+ int i;
+
+ for (i = 0; !is_flag(str[i]); i++) {
+ if (!is_modifier(str[i]) && !is_num(str[i]))
+ return (-1);
+ flags[i] = str[i];
+ }
+ flags[i] = '\0';
+ return (i);
+}
+
+int my_printf(const char *str, ...)
+{
+ int count = 0;
+ va_list ap;
+ char modifiers[MODIFIERS_SIZE];
+ int next_is_flag;
+
+ va_start(ap, str);
+ for (int i = 0; str[i]; i++) {
+ if (str[i] == '%') {
+ next_is_flag = 1;
+ i++;
+ i += get_modifiers(&str[i], modifiers);
+ } else
+ next_is_flag = 0;
+ if (next_is_flag && is_flag(str[i]))
+ count += format(ap, str[i], modifiers);
+ else
+ count += write(1, &str[i], 1);
+ }
+ va_end(ap);
+ return (count);
+}
\ No newline at end of file
diff --git a/lib/my/src/printf_utility.c b/lib/my/src/printf_utility.c
new file mode 100644
index 0000000..22baf41
--- /dev/null
+++ b/lib/my/src/printf_utility.c
@@ -0,0 +1,37 @@
+/*
+** EPITECH PROJECT, 2019
+** Utility for the flags
+** File description:
+** utility
+*/
+
+#include "formaters.h"
+
+int count(char c, char *str)
+{
+ int count = 0;
+
+ for (int i = 0; str[i]; i++) {
+ if (str[i] == c)
+ count++;
+ }
+ return (count);
+}
+
+int contains(char c, char *str)
+{
+ for (int i = 0; str[i]; i++) {
+ if (str[i] == c)
+ return (1);
+ }
+ return (0);
+}
+
+int last_mod(char *modifiers)
+{
+ for (int i = 0; modifiers[i]; i++) {
+ if (!is_modifier(modifiers[i]))
+ return (i);
+ }
+ return (0);
+}
\ No newline at end of file
diff --git a/prefabs/game.gcprefab b/prefabs/game.gcprefab
new file mode 100644
index 0000000..b2b031b
--- /dev/null
+++ b/prefabs/game.gcprefab
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/prefabs/go/happiness.gcprefab b/prefabs/go/happiness.gcprefab
new file mode 100644
index 0000000..217f04b
--- /dev/null
+++ b/prefabs/go/happiness.gcprefab
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/prefabs/go/stupidity.gcprefab b/prefabs/go/stupidity.gcprefab
new file mode 100644
index 0000000..0ce5401
--- /dev/null
+++ b/prefabs/go/stupidity.gcprefab
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/prefabs/mainmenu.gcprefab b/prefabs/mainmenu.gcprefab
new file mode 100644
index 0000000..b430f52
--- /dev/null
+++ b/prefabs/mainmenu.gcprefab
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/prefabs/options.gcprefab b/prefabs/options.gcprefab
new file mode 100644
index 0000000..e0a6505
--- /dev/null
+++ b/prefabs/options.gcprefab
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/prefabs/pause.gcprefab b/prefabs/pause.gcprefab
new file mode 100644
index 0000000..c113209
--- /dev/null
+++ b/prefabs/pause.gcprefab
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/prefabs/teams/absent.gcprefab b/prefabs/teams/absent.gcprefab
new file mode 100644
index 0000000..31a0534
--- /dev/null
+++ b/prefabs/teams/absent.gcprefab
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/prefabs/teams/forgot_register.gcprefab b/prefabs/teams/forgot_register.gcprefab
new file mode 100644
index 0000000..43bdec5
--- /dev/null
+++ b/prefabs/teams/forgot_register.gcprefab
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/prefabs/tilemap.gcmap b/prefabs/tilemap.gcmap
new file mode 100644
index 0000000..44f0b9d
--- /dev/null
+++ b/prefabs/tilemap.gcmap
@@ -0,0 +1,280 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/game_display.c b/src/components/game_display.c
new file mode 100644
index 0000000..c899abe
--- /dev/null
+++ b/src/components/game_display.c
@@ -0,0 +1,71 @@
+/*
+** EPITECH PROJECT, 2020
+** DPR
+** File description:
+** game_stats
+*/
+
+#include
+#include
+#include "dpr_errors.h"
+#include "xml.h"
+#include "component.h"
+#include "utility.h"
+#include "components/game_display.h"
+#include
+
+static void ctr(void *component, va_list args)
+{
+ struct game_display *cmp = (struct game_display *)component;
+
+ cmp->type = va_arg(args, display_type_enum);
+}
+
+static void fdctr(gc_entity *entity, gc_scene *scene, void *component, node *n)
+{
+ struct game_display *cmp = (struct game_display *)component;
+ struct renderer *rend = GETCMP(entity, renderer);
+ char *display_type = xml_gettempprop(n, "stats");
+
+ if (!my_strcmp(display_type, "selected_tile")) {
+ cmp->type = SELECT_TILE_DISPLAY;
+ return;
+ }
+ if (!my_strcmp(display_type, "happiness"))
+ cmp->type = HAPPINESS_DISPLAY;
+ else
+ cmp->type = STUPIDITY_DISPLAY;
+ if (!rend || rend->type != GC_TXTREND) {
+ my_printf("Using a game display without a text renderer.\n");
+ return;
+ }
+ ((gc_text *)rend->data)->text = malloc(sizeof(char) * 10);
+ if (((gc_text *)rend->data)->text)
+ ((gc_text *)rend->data)->text[0] = '\0';
+}
+
+static void dtr(void *component)
+{
+ (void)component;
+}
+
+static char *serialize(void *component)
+{
+ (void)component;
+ return (NULL);
+}
+
+const struct game_display game_display = {
+ base: {
+ name: "game_display",
+ size: sizeof(struct game_display),
+ dependencies: (char *[]) {
+ NULL
+ },
+ ctr: &ctr,
+ fdctr: &fdctr,
+ dtr: &dtr,
+ serialize: &serialize,
+ destroy: &component_destroy
+ }
+};
\ No newline at end of file
diff --git a/src/components/game_manager.c b/src/components/game_manager.c
new file mode 100644
index 0000000..130b418
--- /dev/null
+++ b/src/components/game_manager.c
@@ -0,0 +1,56 @@
+/*
+** EPITECH PROJECT, 2020
+** DPR
+** File description:
+** game_stats
+*/
+
+#include "dpr_errors.h"
+#include "xml.h"
+#include "component.h"
+#include "utility.h"
+#include "components/game_manager.h"
+
+static void ctr(void *component, va_list args)
+{
+ struct game_manager *cmp = (struct game_manager *)component;
+
+ cmp->happiness = va_arg(args, int);
+ cmp->stupidity = va_arg(args, int);
+}
+
+static void fdctr(gc_entity *entity, gc_scene *scene, void *component, node *n)
+{
+ struct game_manager *cmp = (struct game_manager *)component;
+
+ cmp->happiness = xml_getintprop(n, "happiness");
+ cmp->stupidity = xml_getintprop(n, "stupidity");
+ if (scene->get_entity_by_cmp(scene, "game_manager"))
+ my_printf(MULTIPLE_GAME_MGR_ERROR);
+}
+
+static void dtr(void *component)
+{
+ (void)component;
+}
+
+static char *serialize(void *component)
+{
+ (void)component;
+ return (NULL);
+}
+
+const struct game_manager game_manager = {
+ base: {
+ name: "game_manager",
+ size: sizeof(struct game_manager),
+ dependencies: (char *[]) {
+ NULL
+ },
+ ctr: &ctr,
+ fdctr: &fdctr,
+ dtr: &dtr,
+ serialize: &serialize,
+ destroy: &component_destroy
+ }
+};
\ No newline at end of file
diff --git a/src/components/map_manager_component.c b/src/components/map_manager_component.c
new file mode 100644
index 0000000..bf10dc5
--- /dev/null
+++ b/src/components/map_manager_component.c
@@ -0,0 +1,58 @@
+/*
+** EPITECH PROJECT, 2020
+** My3D
+** File description:
+** map_manager_component
+*/
+
+#include
+#include "engine.h"
+#include "entity.h"
+#include "xml.h"
+#include "my.h"
+
+
+static void ctr(void *comp, va_list args)
+{
+ struct map_manager_component *cmp = (struct map_manager_component *)comp;
+
+ cmp->tile_mode = true;
+ cmp->brush = MOVE;
+}
+
+static void fdctr(gc_entity *entity, gc_scene *scene, void *comp, node *n)
+{
+ struct map_manager_component *cmp = (struct map_manager_component *)comp;
+ void **data = scene->get_data(scene, "tiles", NULL);
+
+ cmp->tile_mode = true;
+ cmp->brush = MOVE;
+ if (data)
+ cmp->selected_texture = data[0];
+}
+
+static void dtr(void *component)
+{
+ (void)component;
+}
+
+static char *serialize(void *component)
+{
+ (void)component;
+ return (NULL);
+}
+
+const struct map_manager_component map_manager_component = {
+ base: {
+ name: "map_manager_component",
+ size: sizeof(struct map_manager_component),
+ dependencies: (char *[]){
+ NULL
+ },
+ ctr: &ctr,
+ fdctr: &fdctr,
+ dtr: &dtr,
+ serialize: &serialize,
+ destroy: &component_destroy
+ }
+};
\ No newline at end of file
diff --git a/src/components/teams_component.c b/src/components/teams_component.c
new file mode 100644
index 0000000..c25e659
--- /dev/null
+++ b/src/components/teams_component.c
@@ -0,0 +1,69 @@
+/*
+** EPITECH PROJECT, 2020
+** Twac
+** File description:
+** camera_follow
+*/
+
+#include "xml.h"
+#include "component.h"
+#include "components/teams_component.h"
+#include "utility.h"
+#include
+
+static void ctr(void *component, va_list args)
+{
+ struct teams_component *cmp = (struct teams_component *)component;
+
+ cmp->delay = va_arg(args, double);
+ cmp->next_teams = cmp->delay;
+}
+
+static void fdctr(gc_entity *entity, gc_scene *scene, void *component, node *n)
+{
+ struct teams_component *cmp = (struct teams_component *)component;
+
+ cmp->delay = xml_getfloatprop(n, "delay");
+ cmp->next_teams = cmp->delay;
+ cmp->prefab_count = xml_getchildcount_filtered(n, "prefab");
+ cmp->prefabs = malloc(sizeof(char *) * cmp->prefab_count);
+ cmp->prefabs_size = malloc(sizeof(int) * cmp->prefab_count);
+ n = n->child;
+ if (!cmp->prefabs || !cmp->prefab_count) {
+ cmp->prefabs = NULL;
+ cmp->prefabs_size = NULL;
+ cmp->prefab_count = 0;
+ return;
+ }
+ for (int i = 0; i < cmp->prefab_count; i++) {
+ cmp->prefabs[i] = xml_getproperty(n, "src");
+ cmp->prefabs_size[i] = xml_getintprop(n, "height");
+ n = n->next;
+ }
+}
+
+static void dtr(void *component)
+{
+ (void)component;
+}
+
+static char *serialize(void *component)
+{
+ (void)component;
+ return (NULL);
+}
+
+const struct teams_component teams_component = {
+ base: {
+ name: "teams_component",
+ size: sizeof(struct teams_component),
+ dependencies: (char *[]) {
+ NULL
+ },
+ ctr: &ctr,
+ fdctr: &fdctr,
+ dtr: &dtr,
+ serialize: &serialize,
+ destroy: &component_destroy
+ }
+};
\ No newline at end of file
diff --git a/src/framerate.c b/src/framerate.c
new file mode 100644
index 0000000..7e11cf2
--- /dev/null
+++ b/src/framerate.c
@@ -0,0 +1,69 @@
+/*
+** EPITECH PROJECT, 2020
+** My3D
+** File description:
+** framerate
+*/
+
+#include "entity.h"
+#include "engine.h"
+#include
+#include "utility.h"
+#include "components/renderer.h"
+#include "systems/sfml_renderer_system.h"
+#include "limits.h"
+
+static const int framerates[] = {
+ 30,
+ 60,
+ 120,
+ INT_MAX
+};
+
+void framerate_set_text(gc_entity *entity, gc_engine *engine)
+{
+ struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system);
+ struct renderer *renderer;
+ char *framerate;
+
+ if (!entity)
+ return;
+ renderer = GETCMP(entity, renderer);
+ if (!rend || !renderer || renderer->type != GC_TXTREND)
+ return;
+ framerate = tostr(rend->framerate);
+ free(((gc_text *)renderer->data)->text);
+ ((gc_text *)renderer->data)->text = framerate;
+}
+
+bool framerate_down(gc_engine *engine, gc_entity *entity, gc_vector2 _)
+{
+ struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system);
+ int i = 2;
+
+ if (!rend || rend->is_fullscreen)
+ return (false);
+ while (i > 0 && framerates[i] >= rend->framerate)
+ i--;
+ sfRenderWindow_setFramerateLimit(rend->window, framerates[i]);
+ rend->framerate = framerates[i];
+ framerate_set_text(engine->scene->get_entity(engine->scene, 52), engine);
+ return (true);
+}
+
+bool framerate_up(gc_engine *engine, gc_entity *entity, gc_vector2 _)
+{
+ struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system);
+ int i = 0;
+
+ if (!rend || rend->is_fullscreen)
+ return (false);
+ while (framerates[i] <= rend->framerate)
+ i++;
+ if (framerates[i] == INT_MAX)
+ return (true);
+ sfRenderWindow_setFramerateLimit(rend->window, framerates[i]);
+ rend->framerate = framerates[i];
+ framerate_set_text(engine->scene->get_entity(engine->scene, 52), engine);
+ return (true);
+}
\ No newline at end of file
diff --git a/src/game_loader.c b/src/game_loader.c
new file mode 100644
index 0000000..37c3233
--- /dev/null
+++ b/src/game_loader.c
@@ -0,0 +1,92 @@
+/*
+** EPITECH PROJECT, 2019
+** MUL_my_runner_2019
+** File description:
+** game_loader
+*/
+
+#include "engine.h"
+#include "setup.h"
+#include "components/teams_component.h"
+#include "components/isometry/map_manager_component.h"
+#include "systems/teams_system.h"
+#include
+#include "teams.h"
+#include "callbacks.h"
+#include "components/game_display.h"
+#include "components/game_manager.h"
+#include "systems/game_manager_system.h"
+#include "map_interactions.h"
+#include "my.h"
+
+const struct callback callbacks[] = {
+ {"start_button", &start_button},
+ {"options", &options},
+ {"goto_main_menu", &goto_main_menu},
+ {"quit", &quit},
+ {"fullscreen", &fullscreen},
+ {"map_manage_click", &map_onclick},
+ {"resolution_down", &resolution_down},
+ {"resolution_up", &resolution_up},
+ {"framerate_up", &framerate_up},
+ {"framerate_down", &framerate_down},
+ {"absent_check", &absent_check},
+ {"absent_cross", &absent_cross},
+ {"forgot_lmfao", &forgot_lmfao},
+ {"forgot_ok", &forgot_ok},
+ {"catch", &catch},
+ {"toggle_pause", &toggle_pause},
+ {"toggle_pause", &toggle_pause},
+ {"tile_select", &tile_select},
+ {"vertex_select", &vertex_select},
+ {"up_down", &up_down},
+ {"reset", &reset},
+ {"rotate", &rotate},
+ {"texture", &texture},
+ {"switch_texture", &switch_texture},
+ {NULL, NULL}
+};
+
+int register_customcmps(gc_engine *engine)
+{
+ engine->add_component(engine, &map_manager_component);
+ engine->add_component(engine, &game_manager);
+ engine->add_system(engine, new_system(&game_manager_system, engine));
+ engine->add_component(engine, &game_display);
+ engine->add_system(engine, &game_display_system);
+ engine->add_component(engine, &teams_component);
+ engine->add_system(engine, &teams_system);
+ engine->finish_physics(engine);
+ for (int i = 0; callbacks[i].func; i++)
+ engine->add_callback(engine, my_strdup(callbacks[i].name), \
+callbacks[i].func);
+ return (0);
+}
+
+int create_game_scene(gc_engine *engine)
+{
+ gc_scene *scene;
+
+ register_customcmps(engine);
+ scene = scene_create(engine, "prefabs/mainmenu.gcprefab");
+ if (!scene)
+ return (-1);
+ engine->change_scene(engine, scene);
+ return (0);
+}
+
+int start_game(void)
+{
+ gc_engine *engine = engine_create();
+ sfClock *clock = sfClock_create();
+
+ if (!engine || engine_use_sfml(engine, "DPR tycoon", 60) < 0)
+ return (ERROR);
+ if (create_game_scene(engine) < 0)
+ return (ERROR);
+ while (engine->is_open(engine))
+ engine->game_loop(engine, sfTime_asSeconds(sfClock_restart(clock)));
+ engine->destroy(engine);
+ sfClock_destroy(clock);
+ return (0);
+}
\ No newline at end of file
diff --git a/src/isometry/map_interactions.c b/src/isometry/map_interactions.c
new file mode 100644
index 0000000..2fa8078
--- /dev/null
+++ b/src/isometry/map_interactions.c
@@ -0,0 +1,71 @@
+/*
+** EPITECH PROJECT, 2020
+** Gamacon
+** File description:
+** map_interactions
+*/
+
+#include "map_interactions.h"
+#include "components/clickable_component.h"
+#include "entity.h"
+#include "my.h"
+#include
+#include "components/transform_component.h"
+#include "map_utils.h"
+#include
+#include "components/isometry/map_manager_component.h"
+
+void click_tile(gc_engine *engine, struct map_manager_component *manager, \
+struct tile *ret, bool is_left)
+{
+ bool r = manager->brush == RESET;
+
+ switch (manager->brush) {
+ case ROTATE:
+ ret->data = (ret->data + (is_left ? 1 : -1U)) % 4;
+ break;
+ case TEXTURE:
+ ret->texture = manager->selected_texture;
+ break;
+ case MOVE:
+ case RESET:
+ move_verticies(engine, ret, ALL_VERTICES | is_left, r);
+ break;
+ }
+}
+
+bool map_onclick(gc_engine *engine, gc_entity *entity, gc_vector2 pos, \
+enum gc_mousekeys key)
+{
+ struct vertex_component *map = GETCMP(entity, vertex_component);
+ struct map_manager_component *m = GETCMP(entity, map_manager_component);
+ struct transform_component *tc = GETCMP(entity, transform_component);
+ struct tile *t = get_tile_from_pos(map, gc_vector2_add(pos, tc->position));
+ bool r;
+ int ind;
+
+ if (!map || !m) {
+ my_printf("map not found\n");
+ return (false);
+ }
+ r = m->brush == RESET;
+ if (!t)
+ return (false);
+ if (m->tile_mode)
+ click_tile(engine, m, t, key == GC_LEFT);
+ else {
+ ind = get_index_nearest_vertex(t, gc_vector2_add(pos, tc->position));
+ move_verticies(engine, t, (int)pow(2, ind + 1) | (key == GC_LEFT), r);
+ }
+ return (false);
+}
+
+void move_verticies(gc_engine *engine, struct tile *ret, char mode, bool r)
+{
+ int val = (mode & INVERT_ADD_VALUE) ? ADD_VALUE : -ADD_VALUE;
+
+ for (int i = 0; i < 4; i++) {
+ if (mode & (int)pow(2, i + 1))
+ ret->corners[i]->z += (r) ? -ret->corners[i]->z : val;
+ }
+}
\ No newline at end of file
diff --git a/src/isometry/tile_collision_manager.c b/src/isometry/tile_collision_manager.c
new file mode 100644
index 0000000..d6c82de
--- /dev/null
+++ b/src/isometry/tile_collision_manager.c
@@ -0,0 +1,82 @@
+/*
+** EPITECH PROJECT, 2020
+** Gamacon
+** File description:
+** tile collision_managment
+*/
+
+#include "tile_collision_manager.h"
+#include "map_utils.h"
+#include
+
+#define INF 10000
+
+bool is_on_segment(gc_vector2 p, gc_vector2 q, gc_vector2 r)
+{
+ if (q.x <= fmaxf(p.x, r.x) && q.x >= fminf(p.x, r.x) && \
+q.y <= fmaxf(p.y, r.y) && q.y >= fminf(p.y, r.y))
+ return (true);
+ return (false);
+}
+
+int orientation(gc_vector2 p, gc_vector2 q, gc_vector2 r)
+{
+ int tmp = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
+
+ if (tmp == 0)
+ return (0);
+ return ((tmp > 0) ? 1 : 2);
+}
+
+bool gc_vector2_do_intersect(gc_vector2 p1, gc_vector2 q1, \
+gc_vector2 p2, gc_vector2 q2)
+{
+ int o1 = orientation(p1, q1, p2);
+ int o2 = orientation(p1, q1, q2);
+ int o3 = orientation(p2, q2, p1);
+ int o4 = orientation(p2, q2, q1);
+
+ if (o1 != o2 && o3 != o4)
+ return (true);
+ if (o1 == 0 && is_on_segment(p1, p2, q1))
+ return (true);
+ if (o2 == 0 && is_on_segment(p1, q2, q1))
+ return (true);
+ if (o3 == 0 && is_on_segment(p2, p1, q2))
+ return (true);
+ if (o4 == 0 && is_on_segment(p2, q1, q2))
+ return (true);
+ return (false);
+}
+
+bool is_point_in_polygon(gc_vector2 *polygon, int n, gc_vector2 p)
+{
+ gc_vector2 segment = {-INF, p.y};
+ int count = 0;
+ int next = 0;
+ int i = 0;
+
+ if (n < 3)
+ return (false);
+ do {
+ next = (i + 1) % n;
+ if (gc_vector2_do_intersect(polygon[i], polygon[next], p, segment)) {
+ if (orientation(polygon[i], p, polygon[next]) == 0)
+ return (is_on_segment(polygon[i], p, polygon[next]));
+ count++;
+ }
+ i = next;
+ } while (i != 0);
+ return (count & 1);
+}
+
+bool is_pos_in_tile(gc_vector2 pos, struct tile *tile)
+{
+ struct vertex **c = tile->corners;
+ gc_vector2 corners[4];
+
+ pos.y *= -1;
+ for (int i = 0; i < 4; i++)
+ corners[i] = gc_vector2_from_coords(c[i]->x, c[i]->y, c[i]->z);
+ return (is_point_in_polygon(corners, 4, pos));
+}
\ No newline at end of file
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..2fce2e3
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,21 @@
+/*
+** EPITECH PROJECT, 2019
+** MUL_my_runner_2019
+** File description:
+** main
+*/
+
+#include "setup.h"
+#include "my.h"
+
+int usage(char *bin)
+{
+ return (0);
+}
+
+int main(int argc, char **argv)
+{
+ if (argc != 1 && !my_strcmp(argv[1], "-h"))
+ return (usage(argv[0]));
+ return (start_game());
+}
\ No newline at end of file
diff --git a/src/main_menu.c b/src/main_menu.c
new file mode 100644
index 0000000..09cd80f
--- /dev/null
+++ b/src/main_menu.c
@@ -0,0 +1,68 @@
+/*
+** EPITECH PROJECT, 2020
+** My3D
+** File description:
+** main_menu
+*/
+
+#include
+#include "engine.h"
+#include "scene.h"
+#include "setup.h"
+#include "my.h"
+
+bool start_button(gc_engine *engine, gc_entity *entity, gc_vector2 _)
+{
+ gc_scene *scene = scene_create(engine, "prefabs/game.gcprefab");
+ if (!scene) {
+ engine->should_close = true;
+ my_printf("The game scene couldn't be loaded.\n");
+ return (true);
+ }
+ engine->change_scene(engine, scene);
+ return (true);
+}
+
+bool options(gc_engine *engine, gc_entity *entity, gc_vector2 _)
+{
+ gc_scene *scene = scene_create(engine, "prefabs/options.gcprefab");
+ struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system);
+
+ if (!scene) {
+ engine->should_close = true;
+ my_printf("The option scene couldn't be loaded.\n");
+ return (true);
+ }
+ engine->change_scene(engine, scene);
+ entity = engine->scene->get_entity(engine->scene, 50);
+ if (rend)
+ checkbox_update(engine->scene, entity, rend->is_fullscreen);
+ entity = engine->scene->get_entity(engine->scene, 51);
+ resolution_set_text(entity, engine);
+ entity = engine->scene->get_entity(engine->scene, 52);
+ framerate_set_text(entity, engine);
+ return (true);
+}
+
+bool goto_main_menu(gc_engine *engine, gc_entity *entity, gc_vector2 _)
+{
+ gc_scene *scene = scene_create(engine, "prefabs/mainmenu.gcprefab");
+ if (!scene) {
+ engine->should_close = true;
+ my_printf("The option scene couldn't be loaded.\n");
+ return (true);
+ }
+ engine->change_scene(engine, scene);
+ return (true);
+}
+
+bool quit(gc_engine *engine, gc_entity *entity, gc_vector2 _)
+{
+ engine->should_close = true;
+ return (true);
+}
+
+bool catch(gc_engine *engine, gc_entity *entity, gc_vector2 _)
+{
+ return (true);
+}
\ No newline at end of file
diff --git a/src/options.c b/src/options.c
new file mode 100644
index 0000000..14373ae
--- /dev/null
+++ b/src/options.c
@@ -0,0 +1,115 @@
+/*
+** EPITECH PROJECT, 2020
+** My3D
+** File description:
+** options
+*/
+
+#include "engine.h"
+#include "setup.h"
+#include
+#include "sprite.h"
+#include
+#include
+#include "my.h"
+#include "components/renderer.h"
+#include "systems/sfml_renderer_system.h"
+#include
+
+static const gc_vector2i resolutions[] = {
+ {800, 600},
+ {1280, 720},
+ {1920, 1080},
+ {INT_MAX, INT_MAX}
+};
+
+int checkbox_update(gc_scene *s, gc_entity *entity, bool checked)
+{
+ struct renderer *renderer;
+ char *sprite = checked ? "check" : "cross";
+
+ if (!entity)
+ return (-1);
+ renderer = GETCMP(entity, renderer);
+ if (!renderer || renderer->type != GC_TEXTUREREND)
+ return (-1);
+
+ ((gc_sprite *)renderer->data)->texture = s->get_data(s, "sprite", sprite);
+ return (0);
+}
+
+void resolution_set_text(gc_entity *entity, gc_engine *engine)
+{
+ struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system);
+ struct renderer *renderer;
+ char *resolution = malloc(sizeof(char) * 10);
+
+ if (!entity)
+ return;
+ renderer = GETCMP(entity, renderer);
+ if (!rend || !renderer || renderer->type != GC_TXTREND)
+ return;
+ snprintf(resolution, 10, "%ix%i", rend->resolution.x, rend->resolution.y);
+ if (rend->is_fullscreen)
+ my_strcpy(resolution, "auto");
+ free(((gc_text *)renderer->data)->text);
+ ((gc_text *)renderer->data)->text = resolution;
+}
+
+bool fullscreen(gc_engine *engine, gc_entity *entity, gc_vector2 _)
+{
+ struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system);
+
+ if (!rend)
+ return (false);
+ rend->is_fullscreen = !rend->is_fullscreen;
+ if (checkbox_update(engine->scene, entity, rend->is_fullscreen) < 0)
+ return (false);
+ sfRenderWindow_destroy(rend->window);
+ if (rend->is_fullscreen)
+ rend->window = sfRenderWindow_create(sfVideoMode_getDesktopMode(), \
+"My3D", sfFullscreen | sfClose, NULL);
+ else
+ rend->window = sfRenderWindow_create((sfVideoMode){rend->resolution.x, \
+rend->resolution.y, 32}, "My3D", sfDefaultStyle, NULL);
+ resolution_set_text(engine->scene->get_entity(engine->scene, 51), engine);
+ return (true);
+}
+
+bool resolution_down(gc_engine *engine, gc_entity *entity, gc_vector2 _)
+{
+ struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system);
+ int i = 2;
+
+ if (!rend || rend->is_fullscreen)
+ return (false);
+ while (i > 0 && resolutions[i].x >= rend->resolution.x)
+ i--;
+ sfRenderWindow_setSize(rend->window, (sfVector2u){
+ resolutions[i].x,
+ resolutions[i].y
+ });
+ rend->resolution = resolutions[i];
+ resolution_set_text(engine->scene->get_entity(engine->scene, 51), engine);
+ return (true);
+}
+
+bool resolution_up(gc_engine *engine, gc_entity *entity, gc_vector2 _)
+{
+ struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system);
+ int i = 0;
+
+ if (!rend || rend->is_fullscreen)
+ return (false);
+ while (resolutions[i].x <= rend->resolution.x)
+ i++;
+ if (resolutions[i].x == INT_MAX)
+ return (true);
+ sfRenderWindow_setSize(rend->window, (sfVector2u){
+ resolutions[i].x,
+ resolutions[i].y
+ });
+ rend->resolution = resolutions[i];
+ resolution_set_text(engine->scene->get_entity(engine->scene, 51), engine);
+ return (true);
+}
\ No newline at end of file
diff --git a/src/selectors.c b/src/selectors.c
new file mode 100644
index 0000000..7db211d
--- /dev/null
+++ b/src/selectors.c
@@ -0,0 +1,37 @@
+/*
+** EPITECH PROJECT, 2020
+** My3D
+** File description:
+** selectors
+*/
+
+#include
+#include
+#include "engine.h"
+#include "entity.h"
+
+bool tile_select(gc_engine *engine, gc_entity *entity, gc_vector2 _)
+{
+ gc_scene *scene = engine->scene;
+ gc_list *list = scene->get_entity_by_cmp(scene, "map_manager_component");
+ struct map_manager_component *manager;
+
+ if (!list)
+ return (false);
+ manager = GETCMP(list->data, map_manager_component);
+ manager->tile_mode = true;
+ return (true);
+}
+
+bool vertex_select(gc_engine *engine, gc_entity *entity, gc_vector2 _)
+{
+ gc_scene *scene = engine->scene;
+ gc_list *list = scene->get_entity_by_cmp(scene, "map_manager_component");
+ struct map_manager_component *manager;
+
+ if (!list)
+ return (false);
+ manager = GETCMP(list->data, map_manager_component);
+ manager->tile_mode = false;
+ return (true);
+}
\ No newline at end of file
diff --git a/src/systems/game_display_system.c b/src/systems/game_display_system.c
new file mode 100644
index 0000000..08d5657
--- /dev/null
+++ b/src/systems/game_display_system.c
@@ -0,0 +1,69 @@
+/*
+** EPITECH PROJECT, 2019
+** MUL_my_runner_2019
+** File description:
+** teams_system
+*/
+
+#include "entity.h"
+#include "system.h"
+#include
+#include "components/game_display.h"
+#include "components/game_manager.h"
+#include "components/isometry/map_manager_component.h"
+#include "text.h"
+#include "components/renderer.h"
+#include
+#include "sprite.h"
+
+void display_current_texture(gc_scene *scene, struct renderer *rend)
+{
+ gc_list *li = scene->get_entity_by_cmp(scene, "map_manager_component");
+ struct map_manager_component *map;
+
+ if (!li)
+ return;
+ map = GETCMP(li->data, map_manager_component);
+ ((gc_sprite *)rend->data)->texture = map->selected_texture;
+
+}
+
+static void update_entity(gc_engine *engine, void *system, gc_entity *entity, \
+float dtime)
+{
+ struct game_display *disp = GETCMP(entity, game_display);
+ struct renderer *rend = GETCMP(entity, renderer);
+ struct game_manager *manager;
+ gc_scene *scene = engine->scene;
+ gc_list *entities = scene->get_entity_by_cmp(scene, "game_manager");
+
+ if (!entities)
+ return;
+ manager = GETCMP(entities->data, game_manager);
+ if (disp->type == SELECT_TILE_DISPLAY && rend->type == GC_TEXTUREREND){
+ display_current_texture(scene, rend);
+ return;
+ }
+ if (rend->type != GC_TXTREND)
+ return;
+ if (disp->type == HAPPINESS_DISPLAY)
+ sprintf(((gc_text *)rend->data)->text, "%d%%", manager->happiness);
+ else
+ sprintf(((gc_text *)rend->data)->text, "%d%%", manager->stupidity);
+}
+
+static void destroy(void *system)
+{
+ (void)system;
+}
+
+const gc_system game_display_system = {
+ name: "game_display_system",
+ component_name: "game_display",
+ size: sizeof(gc_system),
+ ctr: NULL,
+ dtr: NULL,
+ check_dependencies: &system_check_dependencies,
+ update_entity: &update_entity,
+ destroy: &destroy
+};
\ No newline at end of file
diff --git a/src/systems/game_manager_system.c b/src/systems/game_manager_system.c
new file mode 100644
index 0000000..adb1907
--- /dev/null
+++ b/src/systems/game_manager_system.c
@@ -0,0 +1,82 @@
+/*
+** EPITECH PROJECT, 2020
+** My3D
+** File description:
+** game_manager_system
+*/
+
+#include
+#include
+#include "my.h"
+#include "prefab.h"
+#include "keybindings.h"
+#include "system.h"
+#include "components/game_manager.h"
+
+bool toggle_pause(gc_engine *engine)
+{
+ gc_scene *scene = engine->scene;
+ gc_list *list;
+
+ scene->is_paused = !scene->is_paused;
+ if (scene->is_paused) {
+ prefab_load(engine, "prefabs/pause.gcprefab");
+ return (true);
+ }
+ list = scene->get_entity_by_cmp(scene, "tag_component");
+ for (gc_list *li = list; li; li = li->next) {
+ if (!my_strcmp(GETCMP(li->data, tag_component)->tag, "pause"))
+ ((gc_entity *)li->data)->destroy(li->data, scene);
+ }
+ return (true);
+}
+
+static void key_pressed(gc_engine *engine, va_list args)
+{
+ gc_keybindings key = va_arg(args, gc_keybindings);
+
+ if (key == ESCAPE)
+ toggle_pause(engine);
+}
+
+static void update_entity(gc_engine *engine, void *system, gc_entity *entity, \
+float dtime)
+{
+ struct game_manager *manager = GETCMP(entity, game_manager);
+ struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system);
+ gc_scene *gameover_scene = NULL;
+
+ if (manager->happiness <= 0)
+ gameover_scene = scene_create(engine, "prefabs/go/happiness.gcprefab");
+ if (manager->stupidity >= 100)
+ gameover_scene = scene_create(engine, "prefabs/go/stupidity.gcprefab");
+
+ if (gameover_scene)
+ engine->change_scene(engine, gameover_scene);
+ if (engine->is_keypressed(sfKeyLeft))
+ sfView_move(rend->view, (sfVector2f){-10, 0});
+ if (engine->is_keypressed(sfKeyRight))
+ sfView_move(rend->view, (sfVector2f){10, 0});
+ if (engine->is_keypressed(sfKeyDown))
+ sfView_move(rend->view, (sfVector2f){0, 10});
+ if (engine->is_keypressed(sfKeyUp))
+ sfView_move(rend->view, (sfVector2f){0, -10});
+}
+
+static void ctr(void *system, va_list list)
+{
+ gc_engine *engine = va_arg(list, gc_engine *);
+
+ engine->add_event_listener(engine, "key_pressed", &key_pressed);
+}
+
+const gc_system game_manager_system = {
+ name: "game_cycle",
+ component_name: "game_manager",
+ size: sizeof(gc_system),
+ ctr: ctr,
+ dtr: NULL,
+ check_dependencies: &system_check_dependencies,
+ update_entity: &update_entity,
+ destroy: &system_destroy
+};
\ No newline at end of file
diff --git a/src/systems/teams_system.c b/src/systems/teams_system.c
new file mode 100644
index 0000000..708ea2d
--- /dev/null
+++ b/src/systems/teams_system.c
@@ -0,0 +1,94 @@
+/*
+** EPITECH PROJECT, 2019
+** MUL_my_runner_2019
+** File description:
+** teams_system
+*/
+
+#include "entity.h"
+#include "system.h"
+#include "prefab.h"
+#include "components/teams_component.h"
+#include
+#include
+#include "components/tag_component.h"
+#include "components/fixed_to_cam_component.h"
+#include "components/game_manager.h"
+#include "my.h"
+
+void pm_destroy(gc_scene *scene, int prefab_id)
+{
+ for (gc_list *ent = scene->entities; ent; ent = ent->next)
+ if (((gc_entity *)ent->data)->prefab_id == prefab_id)
+ ((gc_entity *)ent->data)->destroy(ent->data, scene);
+}
+
+void pm_clicked(gc_engine *engine, gc_entity *entity)
+{
+ float y_pos = GETCMP(entity, fixed_to_cam)->pos.y;
+
+ pm_destroy(engine->scene, entity->prefab_id);
+ teams_move_up(engine->scene, -15, y_pos);
+}
+
+bool teams_move_up(gc_scene *scene, float amount, float y_level)
+{
+ gc_list *list = scene->get_entity_by_cmp(scene, "tag_component");
+ struct fixed_to_cam *fc;
+ struct tag_component *tc;
+ int pm_to_destroy = -1;
+
+ for (; list; list = list->next) {
+ tc = GETCMP(list->data, tag_component);
+ if (my_strcmp(tc->tag, "teams"))
+ continue;
+ fc = GETCMP(list->data, fixed_to_cam);
+ if (!fc || fc->pos.y > y_level)
+ continue;
+ fc->pos.y -= amount;
+ if (fc->pos.y < 15)
+ pm_to_destroy = ((gc_entity *)list->data)->prefab_id;
+ }
+ if (pm_to_destroy != -1)
+ pm_destroy(scene, pm_to_destroy);
+ return (pm_to_destroy != -1);
+}
+
+static void update_entity(gc_engine *engine, void *system, gc_entity *entity, \
+float dtime)
+{
+ struct teams_component *team = GETCMP(entity, teams_component);
+ struct game_manager *manager = GETCMP(entity, game_manager);
+ int index;
+
+ if (!manager) {
+ my_printf("No game manager found. Teams is disabled.\n");
+ return;
+ }
+ if (engine->scene->is_paused)
+ return;
+ team->next_teams -= dtime;
+ if (team->next_teams < 0 && team->prefab_count) {
+ index = random() % team->prefab_count;
+ team->next_teams = team->delay;
+ if (teams_move_up(engine->scene, team->prefabs_size[index], 1000))
+ manager->happiness -= 10;
+ prefab_load(engine, team->prefabs[index]);
+ }
+}
+
+static void destroy(void *system)
+{
+ (void)system;
+}
+
+const gc_system teams_system = {
+ name: "teams_system",
+ component_name: "teams_component",
+ size: sizeof(gc_system),
+ ctr: NULL,
+ dtr: NULL,
+ check_dependencies: &system_check_dependencies,
+ update_entity: &update_entity,
+ destroy: &destroy
+};
\ No newline at end of file
diff --git a/src/teams/absent.c b/src/teams/absent.c
new file mode 100644
index 0000000..328d307
--- /dev/null
+++ b/src/teams/absent.c
@@ -0,0 +1,38 @@
+/*
+** EPITECH PROJECT, 2020
+** My3D
+** File description:
+** absent
+*/
+
+#include
+#include "components/game_manager.h"
+#include
+#include "components/teams_component.h"
+#include "engine.h"
+
+bool absent_check(gc_engine *engine, gc_entity *entity)
+{
+ gc_scene *scene = engine->scene;
+ gc_list *li = scene->get_entity_by_cmp(scene, "game_manager");
+
+ if (!li)
+ return (false);
+ GETCMP(li->data, game_manager)->happiness += 3;
+ GETCMP(li->data, game_manager)->stupidity += random() % 5;
+ pm_clicked(engine, entity);
+ return (true);
+}
+
+bool absent_cross(gc_engine *engine, gc_entity *entity)
+{
+ gc_scene *scene = engine->scene;
+ gc_list *li = scene->get_entity_by_cmp(scene, "game_manager");
+
+ if (!li)
+ return (false);
+ GETCMP(li->data, game_manager)->happiness -= 3;
+ GETCMP(li->data, game_manager)->stupidity -= random() % 5;
+ pm_clicked(engine, entity);
+ return (true);
+}
\ No newline at end of file
diff --git a/src/teams/forgot.c b/src/teams/forgot.c
new file mode 100644
index 0000000..f9397de
--- /dev/null
+++ b/src/teams/forgot.c
@@ -0,0 +1,37 @@
+/*
+** EPITECH PROJECT, 2020
+** My3D
+** File description:
+** forgot
+*/
+
+#include
+#include "components/game_manager.h"
+#include "components/teams_component.h"
+#include "engine.h"
+
+bool forgot_lmfao(gc_engine *engine, gc_entity *entity)
+{
+ gc_scene *scene = engine->scene;
+ gc_list *li = scene->get_entity_by_cmp(scene, "game_manager");
+
+ if (!li)
+ return (false);
+ GETCMP(li->data, game_manager)->happiness -= 5;
+ GETCMP(li->data, game_manager)->stupidity -= 5;
+ pm_clicked(engine, entity);
+ return (true);
+}
+
+bool forgot_ok(gc_engine *engine, gc_entity *entity)
+{
+ gc_scene *scene = engine->scene;
+ gc_list *li = scene->get_entity_by_cmp(scene, "game_manager");
+
+ if (!li)
+ return (false);
+ GETCMP(li->data, game_manager)->happiness += 2;
+ GETCMP(li->data, game_manager)->stupidity += 6;
+ pm_clicked(engine, entity);
+ return (true);
+}
\ No newline at end of file
diff --git a/src/toolbar.c b/src/toolbar.c
new file mode 100644
index 0000000..dadf82d
--- /dev/null
+++ b/src/toolbar.c
@@ -0,0 +1,83 @@
+/*
+** EPITECH PROJECT, 2020
+** My3D
+** File description:
+** toolbar
+*/
+
+#include
+#include
+#include
+#include "engine.h"
+#include "entity.h"
+
+bool up_down(gc_engine *engine, gc_entity *entity, gc_vector2 _)
+{
+ gc_scene *scene = engine->scene;
+ gc_list *list = scene->get_entity_by_cmp(scene, "map_manager_component");
+ struct map_manager_component *manager;
+
+ if (!list)
+ return (false);
+ manager = GETCMP(list->data, map_manager_component);
+ manager->brush = MOVE;
+ return (true);
+}
+
+bool reset(gc_engine *engine, gc_entity *entity, gc_vector2 _)
+{
+ gc_scene *scene = engine->scene;
+ gc_list *list = scene->get_entity_by_cmp(scene, "map_manager_component");
+ struct map_manager_component *manager;
+
+ if (!list)
+ return (false);
+ manager = GETCMP(list->data, map_manager_component);
+ manager->brush = RESET;
+ return (true);
+}
+
+bool rotate(gc_engine *engine, gc_entity *entity, gc_vector2 _)
+{
+ gc_scene *scene = engine->scene;
+ gc_list *list = scene->get_entity_by_cmp(scene, "map_manager_component");
+ struct map_manager_component *manager;
+
+ if (!list)
+ return (false);
+ manager = GETCMP(list->data, map_manager_component);
+ manager->brush = ROTATE;
+ return (true);
+}
+
+bool texture(gc_engine *engine, gc_entity *entity, gc_vector2 _)
+{
+ gc_scene *scene = engine->scene;
+ gc_list *list = scene->get_entity_by_cmp(scene, "map_manager_component");
+ struct map_manager_component *manager;
+
+ if (!list)
+ return (false);
+ manager = GETCMP(list->data, map_manager_component);
+ manager->brush = TEXTURE;
+ return (true);
+}
+
+bool switch_texture(gc_engine *engine, gc_entity *entity, gc_vector2 _)
+{
+ gc_scene *scene = engine->scene;
+ gc_list *list = scene->get_entity_by_cmp(scene, "map_manager_component");
+ struct map_manager_component *manager;
+ void **data = scene->get_data(scene, "tiles", NULL);
+ static int index = 0;
+ void *next = NULL;
+
+ if (!list)
+ return (false);
+ manager = GETCMP(list->data, map_manager_component);
+ index++;
+ if (data)
+ next = data[index % (arraylen(data) - 1)];
+ manager->selected_texture = next;
+ return (true);
+}
\ No newline at end of file