From 8407f31ab9e471127bd8acfe6cc76d1c8e4ce626 Mon Sep 17 00:00:00 2001 From: Flavien Chenu Date: Fri, 22 Mar 2024 09:00:03 +0100 Subject: [PATCH 01/15] build: update common sub repo to last version --- common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common b/common index 740723c..2ffb166 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 740723c681c0c106ffdba313aea8fd3b153f40ea +Subproject commit 2ffb1665c651d1ed4e78226651328e385d638c6f From 6d5ec1eb59d2dc08cf9f8167d678e0c6c7d7c179 Mon Sep 17 00:00:00 2001 From: Flavien Chenu Date: Fri, 22 Mar 2024 09:14:18 +0100 Subject: [PATCH 02/15] refactor: move src folder to core --- CMakeLists.txt | 2 +- Makefile | 2 +- {src => core}/CMakeLists.txt | 0 {src => core}/main.cpp | 0 4 files changed, 2 insertions(+), 2 deletions(-) rename {src => core}/CMakeLists.txt (100%) rename {src => core}/main.cpp (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index d7479f7..1fdb18c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,5 +4,5 @@ project(arcade) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20") -add_subdirectory(src) +add_subdirectory(core) target_include_directories (arcade PUBLIC ${CMAKE_CURRENT_LIST_DIR}/common/) diff --git a/Makefile b/Makefile index 88a6311..0bed2df 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ BUILD_PATH = build all: update @cmake -S . -B build cmake --build $(BUILD_PATH) - @cp $(BUILD_PATH)/src/$(NAME) . + @cp $(BUILD_PATH)/core/$(NAME) . clean: @rm -rf $(BUILD_PATH) diff --git a/src/CMakeLists.txt b/core/CMakeLists.txt similarity index 100% rename from src/CMakeLists.txt rename to core/CMakeLists.txt diff --git a/src/main.cpp b/core/main.cpp similarity index 100% rename from src/main.cpp rename to core/main.cpp From 8d3e5ad9b354aa6d786ead8a61e738a0ce0ba9d7 Mon Sep 17 00:00:00 2001 From: Flavien Chenu Date: Fri, 22 Mar 2024 09:51:31 +0100 Subject: [PATCH 03/15] build: remove common submodule --- .gitignore | 1 + .gitmodules | 3 --- common | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) delete mode 100644 .gitmodules delete mode 160000 common diff --git a/.gitignore b/.gitignore index 8c5ced8..4662a6a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ ## CMake build +cmake-build-debug ## MacOS .DS_Store diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 9e25602..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "common"] - path = common - url = https://github.com/G-Epitech/MAYBDF-ArcadeShared.git diff --git a/common b/common deleted file mode 160000 index 2ffb166..0000000 --- a/common +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2ffb1665c651d1ed4e78226651328e385d638c6f From 84a8fcb0999cb20556e12569016a37f6b0222967 Mon Sep 17 00:00:00 2001 From: Flavien Chenu Date: Fri, 22 Mar 2024 09:52:46 +0100 Subject: [PATCH 04/15] refactor: add common without submodule system --- common/.github/ISSUE_TEMPLATE/bug-report.yml | 44 +++++ common/.github/ISSUE_TEMPLATE/new-feature.yml | 37 +++++ common/.github/ISSUE_TEMPLATE/tests.yml | 32 ++++ common/.github/pull_request_template.md | 11 ++ common/.gitignore | 1 + common/README.md | 11 ++ common/games/IEntity.hpp | 58 +++++++ common/games/IGame.hpp | 69 ++++++++ .../games/components/ICollidableComponent.hpp | 29 ++++ common/games/components/IComponent.hpp | 49 ++++++ .../components/IDisplayableComponent.hpp | 71 ++++++++ .../games/components/IKeyboardComponent.hpp | 72 ++++++++ .../games/components/IPositionComponent.hpp | 26 +++ common/games/components/ISoundComponent.hpp | 67 ++++++++ common/games/types/GameManifest.hpp | 28 ++++ common/graphics/IGraphicsFactory.hpp | 55 +++++++ common/graphics/ISound.hpp | 69 ++++++++ common/graphics/ITexture.hpp | 17 ++ common/graphics/events/IEvent.hpp | 35 ++++ common/graphics/events/key/AKeyEvent.hpp | 87 ++++++++++ common/graphics/events/key/KeyPressEvent.hpp | 19 +++ .../graphics/events/key/KeyReleaseEvent.hpp | 18 ++ .../events/mouse/AMouseButtonEvent.hpp | 39 +++++ common/graphics/events/mouse/AMouseEvent.hpp | 50 ++++++ .../events/mouse/MouseButtonPressEvent.hpp | 24 +++ .../events/mouse/MouseButtonReleaseEvent.hpp | 24 +++ .../graphics/events/mouse/MouseMoveEvent.hpp | 22 +++ .../events/window/WindowCloseEvent.hpp | 29 ++++ .../events/window/WindowResizeEvent.hpp | 43 +++++ common/graphics/types/EntityProps.hpp | 32 ++++ common/graphics/window/IWindow.hpp | 155 ++++++++++++++++++ common/graphics/window/IWindowIcon.hpp | 17 ++ common/pull.sh | 40 +++++ common/types/UUId.cpp | 63 +++++++ common/types/UUId.hpp | 89 ++++++++++ common/types/Vector.hpp | 27 +++ common/types/types.hpp | 11 ++ 37 files changed, 1570 insertions(+) create mode 100644 common/.github/ISSUE_TEMPLATE/bug-report.yml create mode 100644 common/.github/ISSUE_TEMPLATE/new-feature.yml create mode 100644 common/.github/ISSUE_TEMPLATE/tests.yml create mode 100644 common/.github/pull_request_template.md create mode 100644 common/.gitignore create mode 100644 common/README.md create mode 100644 common/games/IEntity.hpp create mode 100644 common/games/IGame.hpp create mode 100644 common/games/components/ICollidableComponent.hpp create mode 100644 common/games/components/IComponent.hpp create mode 100644 common/games/components/IDisplayableComponent.hpp create mode 100644 common/games/components/IKeyboardComponent.hpp create mode 100644 common/games/components/IPositionComponent.hpp create mode 100644 common/games/components/ISoundComponent.hpp create mode 100644 common/games/types/GameManifest.hpp create mode 100644 common/graphics/IGraphicsFactory.hpp create mode 100644 common/graphics/ISound.hpp create mode 100644 common/graphics/ITexture.hpp create mode 100644 common/graphics/events/IEvent.hpp create mode 100644 common/graphics/events/key/AKeyEvent.hpp create mode 100644 common/graphics/events/key/KeyPressEvent.hpp create mode 100644 common/graphics/events/key/KeyReleaseEvent.hpp create mode 100644 common/graphics/events/mouse/AMouseButtonEvent.hpp create mode 100644 common/graphics/events/mouse/AMouseEvent.hpp create mode 100644 common/graphics/events/mouse/MouseButtonPressEvent.hpp create mode 100644 common/graphics/events/mouse/MouseButtonReleaseEvent.hpp create mode 100644 common/graphics/events/mouse/MouseMoveEvent.hpp create mode 100644 common/graphics/events/window/WindowCloseEvent.hpp create mode 100644 common/graphics/events/window/WindowResizeEvent.hpp create mode 100644 common/graphics/types/EntityProps.hpp create mode 100644 common/graphics/window/IWindow.hpp create mode 100644 common/graphics/window/IWindowIcon.hpp create mode 100755 common/pull.sh create mode 100644 common/types/UUId.cpp create mode 100644 common/types/UUId.hpp create mode 100644 common/types/Vector.hpp create mode 100644 common/types/types.hpp diff --git a/common/.github/ISSUE_TEMPLATE/bug-report.yml b/common/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 0000000..e1caf1f --- /dev/null +++ b/common/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,44 @@ +name: Bug Report +description: Report a bug +labels: ["bug"] + +body: + + - type: markdown + attributes: + value: | + Please fill out the sections below to help everyone identify and fix the bug + + - type: textarea + id: description + attributes: + label: Describe your issue + placeholder: When I use a file this happens... + validations: + required: true + + - type: textarea + id: steps + attributes: + label: Steps to reproduce + placeholder: | + 1. Send this file + 2. Set the covergance... + validations: + required: true + + - type: textarea + id: expected + attributes: + label: What was the expected result? + placeholder: I expected it not to crash + + - type: textarea + id: screenshots + attributes: + label: Put here any screenshots or videos (optional) + + - type: markdown + attributes: + value: | + Thanks for reporting this issue! diff --git a/common/.github/ISSUE_TEMPLATE/new-feature.yml b/common/.github/ISSUE_TEMPLATE/new-feature.yml new file mode 100644 index 0000000..df803cd --- /dev/null +++ b/common/.github/ISSUE_TEMPLATE/new-feature.yml @@ -0,0 +1,37 @@ +name: New feature +description: Suggest or request a new feature +labels: ["enhancement"] + +body: + + - type: markdown + attributes: + value: | + Please fill out the sections below to properly describe the new feature you are suggesting. + + - type: textarea + id: description + attributes: + label: Describe the feature + placeholder: Describe the feature that you want to add to this project + validations: + required: true + + - type: textarea + id: example + attributes: + label: Example Feature Purpose + placeholder: | + Please add a concrete example related to the project to prove the relevance of your feature. + + - type: textarea + id: context + attributes: + label: Additional context + placeholder: | + Add any other context or screenshots about the feature request here. + + - type: markdown + attributes: + value: | + Thanks for your suggestion! Let's see together if it can be implemented. diff --git a/common/.github/ISSUE_TEMPLATE/tests.yml b/common/.github/ISSUE_TEMPLATE/tests.yml new file mode 100644 index 0000000..a0b5365 --- /dev/null +++ b/common/.github/ISSUE_TEMPLATE/tests.yml @@ -0,0 +1,32 @@ +name: Tests +description: Add, update or delete tests +labels: ["tests"] + +body: + + - type: textarea + id: description + attributes: + label: Describe why you need this Issue + placeholder: I need it because my project reacts strangely to instructions and I need to run some tests to find out the cause of my problem.... + validations: + required: true + + - type: dropdown + id: type + attributes: + label: What kind of tests will you be doing? + options: + - "Unit Tests" + - "Functional Tests" + - "Unit Tests and Functional Tests" + + - type: textarea + id: context + attributes: + label: Put here any additionnal content like screenshots or videos (optional) + + - type: markdown + attributes: + value: | + Thanks for reporting this issue! diff --git a/common/.github/pull_request_template.md b/common/.github/pull_request_template.md new file mode 100644 index 0000000..68f008b --- /dev/null +++ b/common/.github/pull_request_template.md @@ -0,0 +1,11 @@ +## Changes made + +_Please replace this line with a description of the changes in this PR. Include +a summary of the change and relevant motivation and context._ + +## Added/updated tests? + +- [ ] Yes +- [ ] No, and this is why: _please replace this line with details on why tests + have not been included_ +- [ ] I need help with writing tests diff --git a/common/.gitignore b/common/.gitignore new file mode 100644 index 0000000..1d74e21 --- /dev/null +++ b/common/.gitignore @@ -0,0 +1 @@ +.vscode/ diff --git a/common/README.md b/common/README.md new file mode 100644 index 0000000..bf34730 --- /dev/null +++ b/common/README.md @@ -0,0 +1,11 @@ +# 📦 Arcade Shared Library +Shared library for Arcade project + +## Description +This library contains shared code for the Arcade project in order to unify interfaces between collaborative groups. + +## Groups + - **[G-Epitech](https://github.com/G-Epitech/FMY-Arcade)** : [Flavien Chenu](https://github.com/flavien-chenu), [Math](https://github.com/tekmath) & [Yann Masson](https://github.com/Yann-Masson) + + - **[Carapace Retro](https://github.com/G-Epitech)** : [Baptiste Moreau](https://github.com/BxptisteM), [Axel Fradet](https://github.com/AxelF44) & [Suceveanu Dragos](https://github.com/sdragos1) + diff --git a/common/games/IEntity.hpp b/common/games/IEntity.hpp new file mode 100644 index 0000000..e8b6c2d --- /dev/null +++ b/common/games/IEntity.hpp @@ -0,0 +1,58 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** IEntity +*/ + +#pragma once + +#include +#include + +#include "IGame.hpp" +#include "../../types/UUId.hpp" + +namespace shared::games +{ + namespace game + { + class IGame; + + typedef std::unique_ptr UniqueGame; + } + + namespace entity + { + class IEntity; + + typedef std::map> EntitiesMap; + } + + namespace components + { + class IComponent; + + typedef std::map> ComponentsMap; + } +} + +class shared::games::entity::IEntity +{ +public: + virtual ~IEntity() = default; + + /** + * @brief Get the id of the entity + * + * @return Entity unique id + */ + virtual const types::UUId &getId(void) const noexcept = 0; + + /** + * @brief Get the components of the entity + * + * @return Components of the entity + */ + virtual const components::ComponentsMap &getComponents(void) const noexcept = 0; +}; diff --git a/common/games/IGame.hpp b/common/games/IGame.hpp new file mode 100644 index 0000000..6b71789 --- /dev/null +++ b/common/games/IGame.hpp @@ -0,0 +1,69 @@ +/* +** EPITECH PROJECT, 2024 +** shared-arcade +** File description: +** IGame +*/ + +#pragma once + +#include +#include "../IEntity.hpp" +#include "../../types/types.hpp" +#include "../types/GameManifest.hpp" + +using namespace shared::types; + +namespace shared::games::game +{ + class IGame; + + typedef std::unique_ptr UniqueGame; + typedef unsigned long DeltaTime; +} + +class shared::games::game::IGame +{ +public: + virtual ~IGame() = default; + + /** + * @brief Compute the game each tick of the program + * + * @param dt Time since last tick (Time in `milliseconds`) + */ + virtual void compute(DeltaTime dt) = 0; + + /** + * @brief Manifest with informations of the game + * + */ + virtual const GameManifest getManifest(void) const noexcept = 0; + + /** + * @brief The minimum window size required for the game (pixels) + * + */ + virtual const Vector2u getWindowMinSize(void) const noexcept = 0; + + /** + * @brief Number of tiles that represent the game + * Tile size is managed by the renderer + * + */ + virtual const Vector2u getSize(void) const noexcept = 0; + + /** + * @brief Get map of entities + * + */ + virtual const entity::EntitiesMap &getEntities(void) const = 0; + + /** + * @brief Get entity by id + * + * @param id Id of the entity + * @return The specific entity + */ + virtual std::shared_ptr getEntityById(const UUId &id) const = 0; +}; diff --git a/common/games/components/ICollidableComponent.hpp b/common/games/components/ICollidableComponent.hpp new file mode 100644 index 0000000..cc7ced8 --- /dev/null +++ b/common/games/components/ICollidableComponent.hpp @@ -0,0 +1,29 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** ICollidableComponent +*/ + +#pragma once + +#include "../IGame.hpp" +#include "IPositionComponent.hpp" +#include "../../types/Vector.hpp" + +namespace shared::games::components { + class ICollidableComponent; +} + +class shared::games::components::ICollidableComponent: public virtual IPositionComponent +{ +public: + virtual ~ICollidableComponent() = default; + + /** + * @brief On collide event handler for the component + * @param ctx Context of the game + * @param target Target entity + */ + virtual void onCollide(game::UniqueGame &ctx, std::shared_ptr target) = 0; +}; diff --git a/common/games/components/IComponent.hpp b/common/games/components/IComponent.hpp new file mode 100644 index 0000000..a0be931 --- /dev/null +++ b/common/games/components/IComponent.hpp @@ -0,0 +1,49 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** IComponent +*/ + +#pragma once + +#include "../IEntity.hpp" +#include "../../types/UUId.hpp" + +namespace shared::games::components { + typedef enum { + DISPLAYABLE, + SOUND, + COLLIDABLE, + POSITION, + KEYBOARD + } ComponentType; + + class IComponent; +} + +class shared::games::components::IComponent { +public: + virtual ~IComponent() = default; + + /** + * @brief Get the type of the component + * + * @return Type of the component + */ + virtual const ComponentType getType() const noexcept = 0; + + /** + * @brief Get the uuid of component + * + * @return Component id + */ + virtual const types::UUId &getId() const noexcept = 0; + + /** + * @brief Get the parent entity of the component + * + * @return Entity of the component + */ + virtual std::shared_ptr getEntity() noexcept = 0; +}; diff --git a/common/games/components/IDisplayableComponent.hpp b/common/games/components/IDisplayableComponent.hpp new file mode 100644 index 0000000..dea44b3 --- /dev/null +++ b/common/games/components/IDisplayableComponent.hpp @@ -0,0 +1,71 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared [WSL: Ubuntu-22.04] +** File description: +** ADisplaybleComponent +*/ + +#pragma once + +#include "IPositionComponent.hpp" +#include "../IGame.hpp" +#include "../../types/Vector.hpp" + +namespace shared::games::components { + class IDisplayableComponent; + + typedef struct + { + const std::string ascii; // ASCII image representation path + const std::string bin; // Binary image path + Vector2f binTileSize; // Size of the binary tile + } TextureSources; + + typedef struct + { + TextureSources sources; // Sources of textures + Vector2u origin; // Origin of the texture + } TextureProps; +} + +class shared::games::components::IDisplayableComponent: public virtual IPositionComponent +{ +public: + virtual ~IDisplayableComponent() = default; + + /** + * @brief Get size of the entity (tiles) + * + */ + virtual Vector2u &getSize(void) noexcept = 0; + + /** + * @brief Get Z index that is usefull for display prioroty + * + */ + virtual unsigned int &getZIndex(void) noexcept = 0; + + /** + * @brief Get texture properties + * + */ + virtual TextureProps &getTextureProps(void) noexcept = 0; + + /** + * @brief On click event handler for the entity + * @param ctx Context of the game + */ + virtual void onMousePress(game::UniqueGame &ctx) = 0; + + /** + * @brief On release event handler for the entity + * @param ctx Context of the game + */ + virtual void onMouseRelease(game::UniqueGame &ctx) = 0; + + /** + * @brief On hover event handler for the entity + * @param ctx Context of the game + */ + virtual void onMouseHover(game::UniqueGame &ctx) = 0; +}; diff --git a/common/games/components/IKeyboardComponent.hpp b/common/games/components/IKeyboardComponent.hpp new file mode 100644 index 0000000..8e5638e --- /dev/null +++ b/common/games/components/IKeyboardComponent.hpp @@ -0,0 +1,72 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** IKeyboardComponent +*/ + +#pragma once + +#include "IComponent.hpp" + +namespace shared::games::components { + class IKeyboardComponent; + + typedef enum + { + CONTROL, // Control key (`Ctrl`, `Shift`, `Alt`) + ARROW, // Arrow key (`Up`, `Down`, `Left`, `Right`) + FUNC, // Function key (`F1`, `F2`, `F3`, etc.) + CHAR, // Character key (`a`, `1`, `&`, etc.) + UNKNOWN // Unknown key + } KeyType; + + typedef enum + { + CTRL, // `Ctrl` key + SHIFT, // `Shift` key + ALT // `Alt` key + } ControlCode; + + typedef enum + { + UP, // `Up` arrow key + DOWN, // `Down` arrow key + LEFT, // `Left` arrow key + RIGHT // `Right` arrow key + } ArrowCode; + + typedef union + { + ControlCode control; // Control key + ArrowCode arrow; // Arrow key + char character; // ASCII character value + unsigned char func; // Function key number + } KeyCode; + + typedef struct + { + KeyCode code; // Key code. Interpretation depends on the type + KeyType type; // Type of the key + } KeyData; +} + +class shared::games::components::IKeyboardComponent: public virtual IComponent +{ +public: + virtual ~IKeyboardComponent() = default; + + /** + * @brief On key pressed event handler for the entity + * @param ctx Context of the game + * @param keyData Key data of key pressed + */ + virtual void onKeyPress(game::UniqueGame &ctx, KeyData keyData) = 0; + + /** + * @brief On key release event handler for the entity + * @param ctx Context of the game + * @param keyData Key data of key released + */ + virtual void onKeyRelease(game::UniqueGame &ctx, KeyData keyData) = 0; +}; diff --git a/common/games/components/IPositionComponent.hpp b/common/games/components/IPositionComponent.hpp new file mode 100644 index 0000000..8323712 --- /dev/null +++ b/common/games/components/IPositionComponent.hpp @@ -0,0 +1,26 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** IPositionComponent +*/ + +#pragma once + +#include "IComponent.hpp" + +namespace shared::games::components { + class IPositionComponent; +} + +class shared::games::components::IPositionComponent: public virtual IComponent +{ + public: + virtual ~IPositionComponent() = default; + + /** + * @brief Get position of the entity (tiles) + * + */ + virtual Vector2i &getPosition(void) noexcept = 0; +}; diff --git a/common/games/components/ISoundComponent.hpp b/common/games/components/ISoundComponent.hpp new file mode 100644 index 0000000..943bd64 --- /dev/null +++ b/common/games/components/ISoundComponent.hpp @@ -0,0 +1,67 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** ISoundComponent +*/ + +#pragma once + +#include "IComponent.hpp" +#include "../IGame.hpp" +#include "../../types/Vector.hpp" + +namespace shared::games::components { + class ISoundComponent; + + typedef enum + { + PLAY, + PAUSE, + STOP + } SoundState; + + typedef unsigned char SoundVolume; +} + +class shared::games::components::ISoundComponent: public virtual IComponent +{ +public: + virtual ~ISoundComponent() = default; + + /** + * @brief Get path of the sound + * + * @return Sound path + */ + virtual const std::string &getPath(void) const noexcept = 0; + + /** + * @brief Get state of the sound + * + * @return Sound state + */ + virtual SoundState &getState(void) noexcept = 0; + + /** + * @brief Get volume of the sound + * + * @return Sound volume + */ + virtual SoundVolume &getVolume(void) noexcept = 0; + + /** + * @brief Get loop of the sound + * + * @return Sound loop + */ + virtual bool &getLoop(void) noexcept = 0; + + /** + * @brief On state change event handler for the component + * + * @param ctx Context of the game + * @param state New state of the sound + */ + virtual void onStateChange(game::UniqueGame &ctx, SoundState state) = 0; +}; diff --git a/common/games/types/GameManifest.hpp b/common/games/types/GameManifest.hpp new file mode 100644 index 0000000..4c6efbf --- /dev/null +++ b/common/games/types/GameManifest.hpp @@ -0,0 +1,28 @@ +/* +** EPITECH PROJECT, 2024 +** shared-arcade +** File description: +** GameManifest +*/ + +#pragma once +#include +#include + +namespace shared::games +{ + typedef struct + { + std::string name; // Name of the author + std::string email; // Public contact email + std::string website; // Website of the author (`github`, `gitlab`, etc.) + } Author; + + typedef struct + { + const std::string name; // Name of the game + const std::string description; // Description of the game + const std::string version; // Version of the game + const std::vector authors; // Authors + } GameManifest; +} diff --git a/common/graphics/IGraphicsFactory.hpp b/common/graphics/IGraphicsFactory.hpp new file mode 100644 index 0000000..3b751df --- /dev/null +++ b/common/graphics/IGraphicsFactory.hpp @@ -0,0 +1,55 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** IRendererFactory +*/ + +#pragma once + +#include + +#include "ISound.hpp" +#include "ITexture.hpp" +#include "window/IWindow.hpp" + +namespace shared::graphics { + class IGraphicsFactory; +} + +class shared::graphics::IGraphicsFactory { + public: + virtual ~IGraphicsFactory() = default; + + /** + * @brief Create a renderer object + * + * @param windowProps Properties to use to init the window + * @return Created renderer object + */ + virtual std::unique_ptr createWindow(const WindowInitProps &windowProps) = 0; + + /** + * @brief Create a sound object + * + * @param path Path of the sound file + * @return Created sound object + */ + virtual std::shared_ptr createSound(const std::string &path) = 0; + + /** + * @brief Create a texture object + * + * @param path Path of the texture file + * @return Created texture object + */ + virtual std::shared_ptr createTexture(const std::string &path) = 0; + + /** + * @brief Create a window icon object + * + * @param path Path of the window icon file + * @return Created window icon object + */ + virtual std::unique_ptr createWindowIcon(const std::string &path) = 0; +}; diff --git a/common/graphics/ISound.hpp b/common/graphics/ISound.hpp new file mode 100644 index 0000000..96f192c --- /dev/null +++ b/common/graphics/ISound.hpp @@ -0,0 +1,69 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** ISound +*/ + +#pragma once + +namespace shared::graphics +{ + class ISound; + + typedef unsigned char SoundVolume; + typedef enum + { + PLAY, + PAUSE, + STOP + } SoundState; +} + +class shared::graphics::ISound { + public: + virtual ~ISound() = default; + + /** + * @brief Get the state of the sound + * + * @param state State of sound playing + * @return SoundState + */ + virtual void setState(SoundState state) = 0; + + /** + * @brief Get the state of the sound + * + * @return Current state of the sound + */ + virtual SoundState getState() const = 0; + + /** + * @brief Set the volume of the sound + * + * @param volume Volume of the sound + */ + virtual void setVolume(SoundVolume volume) = 0; + + /** + * @brief Get the volume of the sound + * + * @return Volume of the sound + */ + virtual SoundVolume getVolume() const = 0; + + /** + * @brief Set the loop state of sound + * + * @param loop Loop state of sound + */ + virtual void setLoopState(bool loop) = 0; + + /** + * @brief Get the loop state of sound + * + * @return Loop state of sound + */ + virtual bool getLoopState(void) const = 0; +}; diff --git a/common/graphics/ITexture.hpp b/common/graphics/ITexture.hpp new file mode 100644 index 0000000..69649da --- /dev/null +++ b/common/graphics/ITexture.hpp @@ -0,0 +1,17 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** ITexture +*/ + +#pragma once + +namespace shared::graphics { + class ITexture; +} + +class ITexture { + public: + virtual ~ITexture() = default; +}; diff --git a/common/graphics/events/IEvent.hpp b/common/graphics/events/IEvent.hpp new file mode 100644 index 0000000..ab455d0 --- /dev/null +++ b/common/graphics/events/IEvent.hpp @@ -0,0 +1,35 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** IEvent +*/ + +#pragma once + +namespace shared::graphics::events +{ + class IEvent; + + typedef enum + { + KEY_PRESS, // Key pressed + KEY_RELEASE, // Key released + MOUSE_BTN_PRESS, // Mouse button pressed + MOUSE_BTN_RELEASE, // Mouse button released + MOUSE_MOVE, // Mouse moved + WINDOW_CLOSE, // Window closed + WINDOW_RESIZE, // Window resized + } EventType; +} + +class shared::graphics::events::IEvent +{ + public: + virtual ~IEvent() = default; + + /** + * @brief Event type + */ + virtual const EventType getType() const noexcept = 0; +}; diff --git a/common/graphics/events/key/AKeyEvent.hpp b/common/graphics/events/key/AKeyEvent.hpp new file mode 100644 index 0000000..ff4c436 --- /dev/null +++ b/common/graphics/events/key/AKeyEvent.hpp @@ -0,0 +1,87 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** AKeyEvent +*/ + +#pragma once + +#include "../IEvent.hpp" + +namespace shared::graphics::events { + template + class AKeyEvent; + + typedef enum + { + CONTROL, // Control key (`Ctrl`, `Shift`, `Alt`) + ARROW, // Arrow key (`Up`, `Down`, `Left`, `Right`) + FUNC, // Function key (`F1`, `F2`, `F3`, etc.) + CHAR, // Character key (`a`, `1`, `&`, etc.) + UNKNOWN // Unknown key + } KeyType; + + typedef enum + { + CTRL, // `Ctrl` key + SHIFT, // `Shift` key + ALT // `Alt` key + } ControlCode; + + typedef enum + { + UP, // `Up` arrow key + DOWN, // `Down` arrow key + LEFT, // `Left` arrow key + RIGHT // `Right` arrow key + } ArrowCode; + + typedef union + { + ControlCode control; // Control key + ArrowCode arrow; // Arrow key + char character; // ASCII character value + unsigned char func; // Function key number + } KeyCode; +} + +template +class shared::graphics::events::AKeyEvent: public IEvent { + public: + ~AKeyEvent() = default; + + /** + * @brief Event type + * + */ + const EventType getType(void) const noexcept + { + return this->_type; + } + + /** + * @brief Key code content + * + */ + const KeyCode getKeyCode(void) const noexcept + { + return this->_keyCode; + } + + /** + * @brief Key type + * + */ + const KeyType getKeyType(void) const noexcept + { + return this->_keyType; + } + + protected: + AKeyEvent(KeyType keyType, KeyCode keyCode) : _keyType(keyType), _keyCode(keyCode) {} + + EventType _type = T; + KeyType _keyType; + KeyCode _keyCode; +}; diff --git a/common/graphics/events/key/KeyPressEvent.hpp b/common/graphics/events/key/KeyPressEvent.hpp new file mode 100644 index 0000000..58016b8 --- /dev/null +++ b/common/graphics/events/key/KeyPressEvent.hpp @@ -0,0 +1,19 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** AKeyEvent +*/ + +#pragma once + +#include "AKeyEvent.hpp" + +namespace shared::graphics::events { + class KeyPressEvent; +} + +class shared::graphics::events::KeyPressEvent: public AKeyEvent { + public: + KeyPressEvent(KeyType keyType, KeyCode keyCode): AKeyEvent(keyType, keyCode) {} +}; diff --git a/common/graphics/events/key/KeyReleaseEvent.hpp b/common/graphics/events/key/KeyReleaseEvent.hpp new file mode 100644 index 0000000..8800f90 --- /dev/null +++ b/common/graphics/events/key/KeyReleaseEvent.hpp @@ -0,0 +1,18 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** IKeyEvent +*/ + +#pragma once + +#include "AKeyEvent.hpp" + +namespace shared::graphics::events { + class KeyReleaseEvent; +} +class shared::graphics::events::KeyReleaseEvent: public AKeyEvent { + public: + KeyReleaseEvent(KeyType keyType, KeyCode keyCode): AKeyEvent(keyType, keyCode) {} +}; diff --git a/common/graphics/events/mouse/AMouseButtonEvent.hpp b/common/graphics/events/mouse/AMouseButtonEvent.hpp new file mode 100644 index 0000000..17342c3 --- /dev/null +++ b/common/graphics/events/mouse/AMouseButtonEvent.hpp @@ -0,0 +1,39 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** IMouseEvent +*/ + +#pragma once + +#include "AMouseEvent.hpp" + +namespace shared::graphics::events +{ + template + class AMouseButtonEvent; +} + +template +class shared::graphics::events::AMouseButtonEvent: public AMouseEvent +{ + public: + ~AMouseButtonEvent() = default; + + /** + * @brief Mouse button released + * + */ + const MouseButton getButton(void) const noexcept { + return this->_button; + } + + protected: + AMouseButtonEvent( + MouseButton button, + types::Vector2f position + ): AMouseEvent(position), _button(button) {} + + MouseButton _button; +}; diff --git a/common/graphics/events/mouse/AMouseEvent.hpp b/common/graphics/events/mouse/AMouseEvent.hpp new file mode 100644 index 0000000..18bc030 --- /dev/null +++ b/common/graphics/events/mouse/AMouseEvent.hpp @@ -0,0 +1,50 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** IMouseEvent +*/ + +#pragma once + +#include "../../../types/types.hpp" +#include "../IEvent.hpp" + +namespace shared::graphics::events +{ + template + class AMouseEvent; + + typedef enum { + LEFT, + RIGHT + } MouseButton; +} + +template +class shared::graphics::events::AMouseEvent : public IEvent +{ + public: + ~AMouseEvent() = default; + + /** + * @brief Event type + * + */ + const EventType getType(void) const noexcept { + return T; + } + + /** + * @brief Mouse position + * + */ + const shared::types::Vector2f getPosition(void) const noexcept { + return this->_position; + } + + protected: + AMouseEvent(types::Vector2f position): _position(position) {} + + types::Vector2f _position; +}; diff --git a/common/graphics/events/mouse/MouseButtonPressEvent.hpp b/common/graphics/events/mouse/MouseButtonPressEvent.hpp new file mode 100644 index 0000000..3a92d1e --- /dev/null +++ b/common/graphics/events/mouse/MouseButtonPressEvent.hpp @@ -0,0 +1,24 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** IMouseEvent +*/ + +#pragma once + +#include "AMouseButtonEvent.hpp" + +namespace shared::graphics::events +{ + class MouseButtonPressEvent; +} + +class shared::graphics::events::MouseButtonPressEvent : + public AMouseButtonEvent +{ + public: + MouseButtonPressEvent(MouseButton button, types::Vector2f position) + : AMouseButtonEvent(button, position) {} + ~MouseButtonPressEvent() = default; +}; diff --git a/common/graphics/events/mouse/MouseButtonReleaseEvent.hpp b/common/graphics/events/mouse/MouseButtonReleaseEvent.hpp new file mode 100644 index 0000000..960c6bc --- /dev/null +++ b/common/graphics/events/mouse/MouseButtonReleaseEvent.hpp @@ -0,0 +1,24 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** IMouseEvent +*/ + +#pragma once + +#include "AMouseButtonEvent.hpp" + +namespace shared::graphics::events +{ + class MouseButtonReleaseEvent; +} + +class shared::graphics::events::MouseButtonReleaseEvent : + public AMouseButtonEvent +{ + public: + MouseButtonReleaseEvent(MouseButton button, types::Vector2f position) + : AMouseButtonEvent(button, position) {} + ~MouseButtonReleaseEvent() = default; +}; diff --git a/common/graphics/events/mouse/MouseMoveEvent.hpp b/common/graphics/events/mouse/MouseMoveEvent.hpp new file mode 100644 index 0000000..c0be8db --- /dev/null +++ b/common/graphics/events/mouse/MouseMoveEvent.hpp @@ -0,0 +1,22 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** IMouseEvent +*/ + +#pragma once + +#include "AMouseEvent.hpp" + +namespace shared::graphics::events +{ + class MouseMoveEvent; +} + +class shared::graphics::events::MouseMoveEvent : public AMouseEvent +{ + public: + MouseMoveEvent(types::Vector2f position) : AMouseEvent(position) {} + ~MouseMoveEvent() = default; +}; diff --git a/common/graphics/events/window/WindowCloseEvent.hpp b/common/graphics/events/window/WindowCloseEvent.hpp new file mode 100644 index 0000000..dcf9d52 --- /dev/null +++ b/common/graphics/events/window/WindowCloseEvent.hpp @@ -0,0 +1,29 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** IWindowCloseEvent +*/ + +#pragma once + +#include "../IEvent.hpp" + +namespace shared::graphics::events { + class WindowCloseEvent; +} + +class shared::graphics::events::WindowCloseEvent: public IEvent { + public: + WindowCloseEvent() = default; + ~WindowCloseEvent() = default; + + /** + * @brief Event type + * + */ + const EventType getType() const noexcept + { + return WINDOW_CLOSE; + } +}; diff --git a/common/graphics/events/window/WindowResizeEvent.hpp b/common/graphics/events/window/WindowResizeEvent.hpp new file mode 100644 index 0000000..e8bddce --- /dev/null +++ b/common/graphics/events/window/WindowResizeEvent.hpp @@ -0,0 +1,43 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** IWindowResizeEvent +*/ + +#pragma once + +#include "../IEvent.hpp" +#include "../../../types/types.hpp" + +namespace shared::graphics::events { + class WindowResizeEvent; +} + +class shared::graphics::events::WindowResizeEvent: public IEvent { + public: + WindowResizeEvent(types::Vector2u newSize) : _newSize(newSize) {} + ~WindowResizeEvent() = default; + + /** + * @brief Event type + * + */ + const EventType getType() const noexcept + { + return WINDOW_RESIZE; + } + + /** + * @brief Get the new window size + * + * @return New window size + */ + const types::Vector2u &getNewSize() const noexcept + { + return this->_newSize; + } + + protected: + types::Vector2u _newSize; +}; diff --git a/common/graphics/types/EntityProps.hpp b/common/graphics/types/EntityProps.hpp new file mode 100644 index 0000000..2e3b8e5 --- /dev/null +++ b/common/graphics/types/EntityProps.hpp @@ -0,0 +1,32 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** Texture +*/ + +#pragma once + +#include + +#include "../ITexture.hpp" +#include "../../types/types.hpp" + +using namespace shared::types; + +namespace shared::graphics +{ + typedef struct + { + const std::shared_ptr texture; // Texture of the entity + const Vector2f binTileSize; // Size of a binary tile + const Vector2u origin; // Origin of the texture + } EntityTextureProps; + + typedef struct + { + EntityTextureProps textureProps; // Properties to use with the texture for the entity + Vector2u size; // Size of the entity + Vector2i position; // Position of the entity + } EntityProps; +} diff --git a/common/graphics/window/IWindow.hpp b/common/graphics/window/IWindow.hpp new file mode 100644 index 0000000..0c655fd --- /dev/null +++ b/common/graphics/window/IWindow.hpp @@ -0,0 +1,155 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** IWindow +*/ + +#pragma once + +#include +#include + +#include "IWindowIcon.hpp" +#include "events/IEvent.hpp" +#include "../../types/types.hpp" +#include "../types/EntityProps.hpp" + +using namespace shared::types; + +namespace shared::graphics +{ + class IWindow; + + typedef enum + { + WINDOWED, + FULLSCREEN + } WindowMode; + + typedef struct { + Vector2u size; //Initial size of the window + WindowMode mode; //Initial mode of the window + unsigned int fps; //Initial framerate of the window + const std::string title; //Initial title of the window + const std::string icon; //Initial icon of the window + } WindowInitProps; +} + +class shared::graphics::IWindow { + public: + virtual ~IWindow() = default; + + /** + * @brief Set the title of current window + * + * @param title Title of the window + */ + virtual void setTitle(const std::string &title) = 0; + + /** + * @brief Get the title of current window + * + * @return Title of the window + */ + virtual std::string getTitle() const = 0; + + /** + * @brief Set the size of the window + * + * @param size Size of the window + */ + virtual void setSize(Vector2u size) = 0; + + /** + * @brief Get the size of the window + * + * @return Size of the window + */ + virtual Vector2u getSize() const = 0; + + /** + * @brief Set the framerate Limit of the window + * + * @param fps Frame per seconds + */ + virtual void setFramerateLimit(unsigned int fps) = 0; + + /** + * @brief Get the framerate Limit of the window + * + * @return Frame per seconds + */ + virtual unsigned int getFramerateLimit() const = 0; + + /** + * @brief Set the mode of the window + * + * @param mode Mode to apply to the window + */ + virtual void setMode(WindowMode mode) = 0; + + /** + * @brief Get the mode of the window + * + * @return Mode of the window + */ + virtual WindowMode getMode(void) const = 0; + + /** + * @brief Set the icon of the window + * + * @param icon Icon to use + */ + virtual void setIcon(const IWindowIcon &icon) = 0; + + /** + * @brief Get the icon of the window + * + * @return Icon object of the window + */ + virtual const IWindowIcon &getIcon(void) const = 0; + + /** + * @brief Render the entity with given properties + * + * @param props Properties of the entity to render + */ + virtual void render(const EntityProps &props) = 0; + + /** + * @brief Clear the content of the window + * + */ + virtual void clear(void) = 0; + + /** + * @brief Display the content of the window + * + */ + virtual void display(void) = 0; + + /** + * @brief Close the window + * + */ + virtual void close(void) = 0; + + /** + * @brief Check if the window is open + * + * @return Open status of the window + */ + virtual bool isOpen(void) const = 0; + + /** + * @brief Get the events object + * + * @return Last events occured + * @warning Call successively this method will result in losing events + * @note Call `A` return `eventsA` containing 2 events, + * but make another call `B` (directly after call `A`) `eventsB` + * will result to an empty vector + */ + virtual std::vector getEvents(void) = 0; +}; diff --git a/common/graphics/window/IWindowIcon.hpp b/common/graphics/window/IWindowIcon.hpp new file mode 100644 index 0000000..9dfdb83 --- /dev/null +++ b/common/graphics/window/IWindowIcon.hpp @@ -0,0 +1,17 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** IWindowIcon +*/ + +#pragma once + +namespace shared::graphics { + class IWindowIcon; +} + +class shared::graphics::IWindowIcon { + public: + virtual ~IWindowIcon() = default; +}; diff --git a/common/pull.sh b/common/pull.sh new file mode 100755 index 0000000..057581f --- /dev/null +++ b/common/pull.sh @@ -0,0 +1,40 @@ +#! /bin/bash + +gitfiles=(.git .gitmodules .gitattributes) +tmp_dir="/tmp/$(uuidgen)" +repo_url=git@github.com:G-Epitech/MAYBDF-ArcadeShared.git + +if [ -z "$1" ]; then + echo "Usage: pull.sh " + exit 1 +fi + +echo "Pulling from remote repository" +git clone $repo_url $tmp_dir + +if [ $? -ne 0 ]; then + echo "Error: unable to clone the remote repository" + exit 1 +fi + +echo "Removing git files" +for i in ${gitfiles[@]}; do + rm -rf $tmp_dir/$i +done + +## Are you sure to proceed? +if [ -d $1 ]; then + echo -n "Are you sure to proceed? (y/n): " + read proceed + if [ "$proceed" != "y" ]; then + echo "Aborted." + rm -rf $tmp_dir + exit 0 + fi +fi + +## Clear current directory except current shell script +find $1 -maxdepth 1 ! -wholename $0 ! -name "." ! -name ".." ! -name "pull.sh" -exec rm -rf {} \; +cp -r $tmp_dir/. $1 +rm -rf $tmp_dir +echo "Done. Up to date." diff --git a/common/types/UUId.cpp b/common/types/UUId.cpp new file mode 100644 index 0000000..87086f2 --- /dev/null +++ b/common/types/UUId.cpp @@ -0,0 +1,63 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** UUId +*/ + +#include "UUId.hpp" + + +shared::types::UUId::UUId() +{ + uuid_generate(_uuid); +} + +shared::types::UUId::~UUId() +{ +} + +shared::types::UUId &shared::types::UUId::operator=(const UUId &other) +{ + if (this != &other) + uuid_copy(_uuid, other._uuid); + return *this; +} + +bool shared::types::UUId::operator==(const UUId &other) const +{ + return uuid_compare(_uuid, other._uuid) == 0; +} + +bool shared::types::UUId::operator!=(const UUId &other) const +{ + return uuid_compare(_uuid, other._uuid) != 0; +} + +bool shared::types::UUId::operator<(const UUId &other) const +{ + return uuid_compare(_uuid, other._uuid) < 0; +} + +bool shared::types::UUId::operator>(const UUId &other) const +{ + return uuid_compare(_uuid, other._uuid) > 0; +} + +bool shared::types::UUId::operator<=(const UUId &other) const +{ + return uuid_compare(_uuid, other._uuid) <= 0; +} + +bool shared::types::UUId::operator>=(const UUId &other) const +{ + return uuid_compare(_uuid, other._uuid) >= 0; +} + +std::string shared::types::UUId::toString() const +{ + char str[37]; + + uuid_unparse(_uuid, str); + return std::string(str); +} diff --git a/common/types/UUId.hpp b/common/types/UUId.hpp new file mode 100644 index 0000000..39ad2ad --- /dev/null +++ b/common/types/UUId.hpp @@ -0,0 +1,89 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** UUId +*/ + +#pragma once + +#include + +#include + +namespace shared::types { + class UUId; +} + +class shared::types::UUId +{ + public: + UUId(void); + ~UUId(); + + /** + * @brief Assign same value to this UUId + * + * @param other UUId in whcih value is to be assigned + * @return Passed instance of UUId + */ + UUId &operator=(const UUId &other); + + /** + * @brief Equality operator + * + * @param other UUId to be compared + * @return Equality status + */ + bool operator==(const UUId &other) const; + + /** + * @brief Different operator + * + * @param other UUId to be compared + * @return Difference status + */ + bool operator!=(const UUId &other) const; + + /** + * @brief Operator to compare if current UUId is less than other UUId + * + * @param other Other UUId to be compared + * @return Status of comparison + */ + bool operator<(const UUId &other) const; + + /** + * @brief Operator to compare if current UUId is greter than other UUId + * + * @param other Other UUId to be compared + * @return Status of comparison + */ + bool operator>(const UUId &other) const; + + /** + * @brief Operator to compare if current UUId is less than or equal to other UUId + * + * @param other Other UUId to be compared + * @return Status of comparison + */ + bool operator<=(const UUId &other) const; + + /** + * @brief Operator to compare if current UUId is greater than or equal to other UUId + * + * @param other Other UUId to be compared + * @return Status of comparison + */ + bool operator>=(const UUId &other) const; + + /** + * @brief Convert UUId to string + * + * @return String representation of UUId + */ + std::string toString(void) const; + + private: + uuid_t _uuid; +}; diff --git a/common/types/Vector.hpp b/common/types/Vector.hpp new file mode 100644 index 0000000..5905a04 --- /dev/null +++ b/common/types/Vector.hpp @@ -0,0 +1,27 @@ +/* +** EPITECH PROJECT, 2024 +** shared-arcade +** File description: +** Vector +*/ + +#pragma once + +namespace shared::types +{ + template + struct Vector; + + typedef struct Vector Vector2i; + typedef struct Vector Vector2f; + typedef struct Vector Vector2u; +} + +template +struct shared::types::Vector +{ + Vector(T x, T y) : x(x), y(y){}; + + T x; + T y; +}; diff --git a/common/types/types.hpp b/common/types/types.hpp new file mode 100644 index 0000000..2fa7a26 --- /dev/null +++ b/common/types/types.hpp @@ -0,0 +1,11 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** types +*/ + +#pragma once + +#include "Vector.hpp" +#include "UUId.hpp" From da127aadcd72bb9a093a47520b2c232296827d8f Mon Sep 17 00:00:00 2001 From: Flavien Chenu Date: Fri, 22 Mar 2024 10:30:16 +0100 Subject: [PATCH 05/15] build: update output directories --- CMakeLists.txt | 6 ++++++ Makefile | 1 - games/CMakeLists.txt | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 games/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fdb18c..b90f79c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,14 @@ cmake_minimum_required(VERSION 3.27) project(arcade) +set(ARCADE_BIN_DIR ${CMAKE_CURRENT_LIST_DIR}) +set(ARCADE_LIB_DIR ${CMAKE_CURRENT_LIST_DIR}/lib) + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ARCADE_BIN_DIR}) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${ARCADE_LIB_DIR}) + add_subdirectory(core) target_include_directories (arcade PUBLIC ${CMAKE_CURRENT_LIST_DIR}/common/) diff --git a/Makefile b/Makefile index 0bed2df..10f58f1 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,6 @@ BUILD_PATH = build all: update @cmake -S . -B build cmake --build $(BUILD_PATH) - @cp $(BUILD_PATH)/core/$(NAME) . clean: @rm -rf $(BUILD_PATH) diff --git a/games/CMakeLists.txt b/games/CMakeLists.txt new file mode 100644 index 0000000..8ba6cad --- /dev/null +++ b/games/CMakeLists.txt @@ -0,0 +1 @@ +add_library() \ No newline at end of file From baf71a1adc55b485b5850d29d5035ba8fc72bc90 Mon Sep 17 00:00:00 2001 From: Flavien Chenu Date: Fri, 22 Mar 2024 10:40:46 +0100 Subject: [PATCH 06/15] refactor: Makefile --- Makefile | 21 ++++++++++----------- common/pull.sh | 40 ---------------------------------------- 2 files changed, 10 insertions(+), 51 deletions(-) delete mode 100755 common/pull.sh diff --git a/Makefile b/Makefile index 10f58f1..5c0ffb4 100644 --- a/Makefile +++ b/Makefile @@ -5,27 +5,26 @@ ## Makefile ## -NAME = arcade -BUILD_PATH = build +NAME = arcade +BUILD_PATH = build -all: update - @cmake -S . -B build - cmake --build $(BUILD_PATH) +all: + @cmake -S . -B build + cmake --build $(BUILD_PATH) clean: - @rm -rf $(BUILD_PATH) + @rm -rf $(BUILD_PATH) fclean: clean - @rm -f $(NAME) + @rm -f $(NAME) -re: fclean all +re: fclean all tests_run: - echo "pass" + echo "pass" update: - @git submodule init - @git submodule update + @common/pull.sh common .PHONY: all clean fclean re tests_run update DEFAULT_GOAL := all diff --git a/common/pull.sh b/common/pull.sh deleted file mode 100755 index 057581f..0000000 --- a/common/pull.sh +++ /dev/null @@ -1,40 +0,0 @@ -#! /bin/bash - -gitfiles=(.git .gitmodules .gitattributes) -tmp_dir="/tmp/$(uuidgen)" -repo_url=git@github.com:G-Epitech/MAYBDF-ArcadeShared.git - -if [ -z "$1" ]; then - echo "Usage: pull.sh " - exit 1 -fi - -echo "Pulling from remote repository" -git clone $repo_url $tmp_dir - -if [ $? -ne 0 ]; then - echo "Error: unable to clone the remote repository" - exit 1 -fi - -echo "Removing git files" -for i in ${gitfiles[@]}; do - rm -rf $tmp_dir/$i -done - -## Are you sure to proceed? -if [ -d $1 ]; then - echo -n "Are you sure to proceed? (y/n): " - read proceed - if [ "$proceed" != "y" ]; then - echo "Aborted." - rm -rf $tmp_dir - exit 0 - fi -fi - -## Clear current directory except current shell script -find $1 -maxdepth 1 ! -wholename $0 ! -name "." ! -name ".." ! -name "pull.sh" -exec rm -rf {} \; -cp -r $tmp_dir/. $1 -rm -rf $tmp_dir -echo "Done. Up to date." From 03ab4292e97032de9d687de46ebe6e31d656d37a Mon Sep 17 00:00:00 2001 From: Yann Date: Fri, 22 Mar 2024 10:48:28 +0100 Subject: [PATCH 07/15] build: add CMakeList shared lib --- .gitignore | 1 + CMakeLists.txt | 3 +++ Makefile | 2 ++ games/CMakeLists.txt | 2 +- games/snake/CMakeLists.txt | 5 +++++ games/snake/src/main.cpp | 13 +++++++++++++ 6 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 games/snake/CMakeLists.txt create mode 100644 games/snake/src/main.cpp diff --git a/.gitignore b/.gitignore index 4662a6a..40254cb 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ cmake-build-debug ## Binary arcade +lib *.gcno *.gcda *.o diff --git a/CMakeLists.txt b/CMakeLists.txt index b90f79c..f7da8ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,9 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ARCADE_BIN_DIR}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${ARCADE_LIB_DIR}) +set(CMAKE_SHARED_LIBRARY_PREFIX "arcade_") add_subdirectory(core) +add_subdirectory(games) + target_include_directories (arcade PUBLIC ${CMAKE_CURRENT_LIST_DIR}/common/) diff --git a/Makefile b/Makefile index 5c0ffb4..52a5805 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ NAME = arcade BUILD_PATH = build +LIB_PATH = lib all: @cmake -S . -B build @@ -17,6 +18,7 @@ clean: fclean: clean @rm -f $(NAME) + @rm -rf $(LIB_PATH) re: fclean all diff --git a/games/CMakeLists.txt b/games/CMakeLists.txt index 8ba6cad..4c39731 100644 --- a/games/CMakeLists.txt +++ b/games/CMakeLists.txt @@ -1 +1 @@ -add_library() \ No newline at end of file +add_subdirectory(snake) diff --git a/games/snake/CMakeLists.txt b/games/snake/CMakeLists.txt new file mode 100644 index 0000000..dab7a02 --- /dev/null +++ b/games/snake/CMakeLists.txt @@ -0,0 +1,5 @@ +project(snake) + +add_library(${PROJECT_NAME} SHARED + src/main.cpp +) diff --git a/games/snake/src/main.cpp b/games/snake/src/main.cpp new file mode 100644 index 0000000..c17bdd9 --- /dev/null +++ b/games/snake/src/main.cpp @@ -0,0 +1,13 @@ +/* +** EPITECH PROJECT, 2024 +** arcade +** File description: +** main +*/ + +int main(int ac, char **av) +{ + (void) ac; + (void) av; + return 0; +} From 5fe51ce19db695462c370ed7990990f9b5a2856a Mon Sep 17 00:00:00 2001 From: Yann Date: Fri, 22 Mar 2024 10:53:21 +0100 Subject: [PATCH 08/15] build: add CMakeList grahpics shared lib --- CMakeLists.txt | 1 + graphics/CMakeLists.txt | 1 + graphics/ncurses/CMakeLists.txt | 5 +++++ graphics/ncurses/src/main.cpp | 13 +++++++++++++ 4 files changed, 20 insertions(+) create mode 100644 graphics/CMakeLists.txt create mode 100644 graphics/ncurses/CMakeLists.txt create mode 100644 graphics/ncurses/src/main.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index f7da8ea..3c3e8e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,5 +13,6 @@ set(CMAKE_SHARED_LIBRARY_PREFIX "arcade_") add_subdirectory(core) add_subdirectory(games) +add_subdirectory(graphics) target_include_directories (arcade PUBLIC ${CMAKE_CURRENT_LIST_DIR}/common/) diff --git a/graphics/CMakeLists.txt b/graphics/CMakeLists.txt new file mode 100644 index 0000000..c166dc2 --- /dev/null +++ b/graphics/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(ncurses) diff --git a/graphics/ncurses/CMakeLists.txt b/graphics/ncurses/CMakeLists.txt new file mode 100644 index 0000000..fc9d7f8 --- /dev/null +++ b/graphics/ncurses/CMakeLists.txt @@ -0,0 +1,5 @@ +project(ncurses) + +add_library(${PROJECT_NAME} SHARED + src/main.cpp +) diff --git a/graphics/ncurses/src/main.cpp b/graphics/ncurses/src/main.cpp new file mode 100644 index 0000000..c17bdd9 --- /dev/null +++ b/graphics/ncurses/src/main.cpp @@ -0,0 +1,13 @@ +/* +** EPITECH PROJECT, 2024 +** arcade +** File description: +** main +*/ + +int main(int ac, char **av) +{ + (void) ac; + (void) av; + return 0; +} From c56921de31889e5044496351fc0b15a8ad88089b Mon Sep 17 00:00:00 2001 From: Flavien Chenu Date: Fri, 22 Mar 2024 11:03:22 +0100 Subject: [PATCH 09/15] build: update common dependency --- Makefile | 2 +- common/games/IEntity.hpp | 10 ++-------- common/games/IGame.hpp | 13 ++++++------- common/games/components/ICollidableComponent.hpp | 2 +- common/games/components/IDisplayableComponent.hpp | 6 +++--- common/games/components/IKeyboardComponent.hpp | 5 +++-- common/games/components/IPositionComponent.hpp | 5 +++-- common/games/components/ISoundComponent.hpp | 2 +- common/graphics/window/IWindow.hpp | 4 ++-- common/types/types.hpp | 1 + 10 files changed, 23 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index 52a5805..b0ddc84 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ tests_run: echo "pass" update: - @common/pull.sh common + @cd common && ./pull.sh . .PHONY: all clean fclean re tests_run update DEFAULT_GOAL := all diff --git a/common/games/IEntity.hpp b/common/games/IEntity.hpp index e8b6c2d..e251824 100644 --- a/common/games/IEntity.hpp +++ b/common/games/IEntity.hpp @@ -10,17 +10,11 @@ #include #include -#include "IGame.hpp" -#include "../../types/UUId.hpp" +#include "../types/UUId.hpp" namespace shared::games { - namespace game - { - class IGame; - - typedef std::unique_ptr UniqueGame; - } + class IGame; namespace entity { diff --git a/common/games/IGame.hpp b/common/games/IGame.hpp index 6b71789..d888a3f 100644 --- a/common/games/IGame.hpp +++ b/common/games/IGame.hpp @@ -8,21 +8,20 @@ #pragma once #include -#include "../IEntity.hpp" -#include "../../types/types.hpp" -#include "../types/GameManifest.hpp" +#include "IEntity.hpp" +#include "../types/types.hpp" +#include "types/GameManifest.hpp" using namespace shared::types; -namespace shared::games::game +namespace shared::games { class IGame; - typedef std::unique_ptr UniqueGame; typedef unsigned long DeltaTime; } -class shared::games::game::IGame +class shared::games::IGame { public: virtual ~IGame() = default; @@ -38,7 +37,7 @@ class shared::games::game::IGame * @brief Manifest with informations of the game * */ - virtual const GameManifest getManifest(void) const noexcept = 0; + virtual const GameManifest &getManifest(void) const noexcept = 0; /** * @brief The minimum window size required for the game (pixels) diff --git a/common/games/components/ICollidableComponent.hpp b/common/games/components/ICollidableComponent.hpp index cc7ced8..f6ce1c3 100644 --- a/common/games/components/ICollidableComponent.hpp +++ b/common/games/components/ICollidableComponent.hpp @@ -25,5 +25,5 @@ class shared::games::components::ICollidableComponent: public virtual IPositionC * @param ctx Context of the game * @param target Target entity */ - virtual void onCollide(game::UniqueGame &ctx, std::shared_ptr target) = 0; + virtual void onCollide(std::shared_ptr &ctx, std::shared_ptr target) = 0; }; diff --git a/common/games/components/IDisplayableComponent.hpp b/common/games/components/IDisplayableComponent.hpp index dea44b3..c492e3b 100644 --- a/common/games/components/IDisplayableComponent.hpp +++ b/common/games/components/IDisplayableComponent.hpp @@ -55,17 +55,17 @@ class shared::games::components::IDisplayableComponent: public virtual IPosition * @brief On click event handler for the entity * @param ctx Context of the game */ - virtual void onMousePress(game::UniqueGame &ctx) = 0; + virtual void onMousePress(std::shared_ptr &ctx) = 0; /** * @brief On release event handler for the entity * @param ctx Context of the game */ - virtual void onMouseRelease(game::UniqueGame &ctx) = 0; + virtual void onMouseRelease(std::shared_ptr &ctx) = 0; /** * @brief On hover event handler for the entity * @param ctx Context of the game */ - virtual void onMouseHover(game::UniqueGame &ctx) = 0; + virtual void onMouseHover(std::shared_ptr &ctx) = 0; }; diff --git a/common/games/components/IKeyboardComponent.hpp b/common/games/components/IKeyboardComponent.hpp index 8e5638e..097b293 100644 --- a/common/games/components/IKeyboardComponent.hpp +++ b/common/games/components/IKeyboardComponent.hpp @@ -7,6 +7,7 @@ #pragma once +#include "../IGame.hpp" #include "IComponent.hpp" namespace shared::games::components { @@ -61,12 +62,12 @@ class shared::games::components::IKeyboardComponent: public virtual IComponent * @param ctx Context of the game * @param keyData Key data of key pressed */ - virtual void onKeyPress(game::UniqueGame &ctx, KeyData keyData) = 0; + virtual void onKeyPress(std::shared_ptr &ctx, KeyData keyData) = 0; /** * @brief On key release event handler for the entity * @param ctx Context of the game * @param keyData Key data of key released */ - virtual void onKeyRelease(game::UniqueGame &ctx, KeyData keyData) = 0; + virtual void onKeyRelease(std::shared_ptr &ctx, KeyData keyData) = 0; }; diff --git a/common/games/components/IPositionComponent.hpp b/common/games/components/IPositionComponent.hpp index 8323712..4e508df 100644 --- a/common/games/components/IPositionComponent.hpp +++ b/common/games/components/IPositionComponent.hpp @@ -8,9 +8,10 @@ #pragma once #include "IComponent.hpp" +#include "../../types/Vector.hpp" namespace shared::games::components { - class IPositionComponent; + class IPositionComponent; } class shared::games::components::IPositionComponent: public virtual IComponent @@ -22,5 +23,5 @@ class shared::games::components::IPositionComponent: public virtual IComponent * @brief Get position of the entity (tiles) * */ - virtual Vector2i &getPosition(void) noexcept = 0; + virtual types::Vector2i &getPosition(void) noexcept = 0; }; diff --git a/common/games/components/ISoundComponent.hpp b/common/games/components/ISoundComponent.hpp index 943bd64..fd4ab9c 100644 --- a/common/games/components/ISoundComponent.hpp +++ b/common/games/components/ISoundComponent.hpp @@ -63,5 +63,5 @@ class shared::games::components::ISoundComponent: public virtual IComponent * @param ctx Context of the game * @param state New state of the sound */ - virtual void onStateChange(game::UniqueGame &ctx, SoundState state) = 0; + virtual void onStateChange(std::shared_ptr &ctx, SoundState state) = 0; }; diff --git a/common/graphics/window/IWindow.hpp b/common/graphics/window/IWindow.hpp index 0c655fd..95fac0f 100644 --- a/common/graphics/window/IWindow.hpp +++ b/common/graphics/window/IWindow.hpp @@ -11,7 +11,7 @@ #include #include "IWindowIcon.hpp" -#include "events/IEvent.hpp" +#include "../events/IEvent.hpp" #include "../../types/types.hpp" #include "../types/EntityProps.hpp" @@ -101,7 +101,7 @@ class shared::graphics::IWindow { * * @param icon Icon to use */ - virtual void setIcon(const IWindowIcon &icon) = 0; + virtual void setIcon(std::unique_ptr icon) = 0; /** * @brief Get the icon of the window diff --git a/common/types/types.hpp b/common/types/types.hpp index 2fa7a26..dcfa739 100644 --- a/common/types/types.hpp +++ b/common/types/types.hpp @@ -9,3 +9,4 @@ #include "Vector.hpp" #include "UUId.hpp" +#include "Libraries.hpp" From 51f186e997f902e095a5c89206f6109650301fb8 Mon Sep 17 00:00:00 2001 From: Flavien Chenu Date: Fri, 22 Mar 2024 11:03:44 +0100 Subject: [PATCH 10/15] build: update common dependency --- common/games/IGameProvider.hpp | 36 +++++++++++++++++ common/games/export.cpp.example | 21 ++++++++++ ...phicsFactory.hpp => IGraphicsProvider.hpp} | 15 +++++-- common/graphics/export.cpp.example | 21 ++++++++++ common/graphics/types/GraphicsManifest.hpp | 28 +++++++++++++ common/pull.sh | 40 +++++++++++++++++++ common/types/Libraries.hpp | 28 +++++++++++++ 7 files changed, 186 insertions(+), 3 deletions(-) create mode 100644 common/games/IGameProvider.hpp create mode 100644 common/games/export.cpp.example rename common/graphics/{IGraphicsFactory.hpp => IGraphicsProvider.hpp} (77%) create mode 100644 common/graphics/export.cpp.example create mode 100644 common/graphics/types/GraphicsManifest.hpp create mode 100755 common/pull.sh create mode 100644 common/types/Libraries.hpp diff --git a/common/games/IGameProvider.hpp b/common/games/IGameProvider.hpp new file mode 100644 index 0000000..bd4b07d --- /dev/null +++ b/common/games/IGameProvider.hpp @@ -0,0 +1,36 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** IGameProvider +*/ + +#pragma once + +#include +#include "IGame.hpp" +#include "types/GameManifest.hpp" + +namespace shared::games { + class IGameProvider; +} + +class shared::games::IGameProvider +{ +public: + virtual ~IGameProvider() = default; + + /** + * @brief Provides the game manifest + * + * @return Manifest of current game + */ + virtual const GameManifest &getManifest() const noexcept = 0; + + /** + * @brief Provides a new instance of the game + * + * @return Created game instance + */ + virtual std::shared_ptr createInstance(void) = 0; +}; diff --git a/common/games/export.cpp.example b/common/games/export.cpp.example new file mode 100644 index 0000000..4fe9f03 --- /dev/null +++ b/common/games/export.cpp.example @@ -0,0 +1,21 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** export +*/ + +#include "IGame.hpp" +#include "../types/LibraryType.hpp" + +extern "C" { + shared::types::LibraryType SHARED_LIBRARY_TYPE_GETTER_NAME(void) + { + return shared::types::LibraryType::GAME; + } + + std::shared_ptr SHARED_GRAPHICS_FACTORY_LOADER_NAME(void) + { + return std::make_shared(...) + } +} diff --git a/common/graphics/IGraphicsFactory.hpp b/common/graphics/IGraphicsProvider.hpp similarity index 77% rename from common/graphics/IGraphicsFactory.hpp rename to common/graphics/IGraphicsProvider.hpp index 3b751df..16dc666 100644 --- a/common/graphics/IGraphicsFactory.hpp +++ b/common/graphics/IGraphicsProvider.hpp @@ -12,14 +12,23 @@ #include "ISound.hpp" #include "ITexture.hpp" #include "window/IWindow.hpp" +#include "types/GraphicsManifest.hpp" namespace shared::graphics { - class IGraphicsFactory; + class IGraphicsProvider; } -class shared::graphics::IGraphicsFactory { +class shared::graphics::IGraphicsProvider { public: - virtual ~IGraphicsFactory() = default; + virtual ~IGraphicsProvider() = default; + + + /** + * @brief Get the manifest of the graphics library + * + * @return Manifest of the graphics library + */ + virtual const GameManifest &getManifest(void) const noexcept = 0; /** * @brief Create a renderer object diff --git a/common/graphics/export.cpp.example b/common/graphics/export.cpp.example new file mode 100644 index 0000000..ae4ef20 --- /dev/null +++ b/common/graphics/export.cpp.example @@ -0,0 +1,21 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** export +*/ + +#include "IGraphicsFactory.hpp" +#include "../types/Libraries.hpp" + +extern "C" { + shared::types::LibraryType SHARED_LIBRARY_TYPE_GETTER_NAME(void) + { + return shared::types::LibraryType::GRAPHIC; + } + + std::shared_ptr SHARED_GAME_PROVIDER_LOADER_NAME(void) + { + return std::make_shared(...); + } +} diff --git a/common/graphics/types/GraphicsManifest.hpp b/common/graphics/types/GraphicsManifest.hpp new file mode 100644 index 0000000..fc45e15 --- /dev/null +++ b/common/graphics/types/GraphicsManifest.hpp @@ -0,0 +1,28 @@ +/* +** EPITECH PROJECT, 2024 +** shared-arcade +** File description: +** GameManifest +*/ + +#pragma once +#include +#include + +namespace shared::graphics +{ + typedef struct + { + std::string name; // Name of the author + std::string email; // Public contact email + std::string website; // Website of the author (`github`, `gitlab`, etc.) + } Author; + + typedef struct + { + const std::string name; // Name of the graphics library + const std::string description; // Description of the library + const std::string version; // Version of the library + const std::vector authors; // Authors + } GraphicsManifest; +} diff --git a/common/pull.sh b/common/pull.sh new file mode 100755 index 0000000..057581f --- /dev/null +++ b/common/pull.sh @@ -0,0 +1,40 @@ +#! /bin/bash + +gitfiles=(.git .gitmodules .gitattributes) +tmp_dir="/tmp/$(uuidgen)" +repo_url=git@github.com:G-Epitech/MAYBDF-ArcadeShared.git + +if [ -z "$1" ]; then + echo "Usage: pull.sh " + exit 1 +fi + +echo "Pulling from remote repository" +git clone $repo_url $tmp_dir + +if [ $? -ne 0 ]; then + echo "Error: unable to clone the remote repository" + exit 1 +fi + +echo "Removing git files" +for i in ${gitfiles[@]}; do + rm -rf $tmp_dir/$i +done + +## Are you sure to proceed? +if [ -d $1 ]; then + echo -n "Are you sure to proceed? (y/n): " + read proceed + if [ "$proceed" != "y" ]; then + echo "Aborted." + rm -rf $tmp_dir + exit 0 + fi +fi + +## Clear current directory except current shell script +find $1 -maxdepth 1 ! -wholename $0 ! -name "." ! -name ".." ! -name "pull.sh" -exec rm -rf {} \; +cp -r $tmp_dir/. $1 +rm -rf $tmp_dir +echo "Done. Up to date." diff --git a/common/types/Libraries.hpp b/common/types/Libraries.hpp new file mode 100644 index 0000000..08c954b --- /dev/null +++ b/common/types/Libraries.hpp @@ -0,0 +1,28 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** LibraryType +*/ + +#pragma once + +#include "../games/IGameProvider.hpp" +#include "../graphics/IGraphicsProvider.hpp" + +#define SHARED_GAME_PROVIDER_LOADER_NAME arcadeLibGetGameProvider +#define SHARED_GRAPHICS_PROVIDER_LOADER_NAME arcadeLibGetGraphicsProvider +#define SHARED_LIBRARY_TYPE_GETTER_NAME arcadeLibGetType +#define SHARED_STRINGIFY(x) #x + +namespace shared::types +{ + typedef enum { + GAME, + GRAPHIC, + } LibraryType; + + typedef std::shared_ptr (*GameProvider)(void); + typedef std::shared_ptr (*GraphicsProvider)(void); + typedef LibraryType (*LibraryTypeGetter)(void); +} From 787dd9305c4355731633cf49302408894313e99f Mon Sep 17 00:00:00 2001 From: Yann Date: Fri, 22 Mar 2024 11:05:56 +0100 Subject: [PATCH 11/15] ci: remove useless things in pull request template --- .github/pull_request_template.md | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index d5e5e60..68f008b 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,16 +1,3 @@ -## Related Tickets & Documents - -- Related Issue # -- Closes (optional) # - -## What type of PR is this? (check all applicable) - -- [ ] Refactor -- [ ] Feature -- [ ] Bug Fix -- [ ] Optimization -- [ ] Documentation Update - ## Changes made _Please replace this line with a description of the changes in this PR. Include From cbde1f7b737d8b9453235df50635d4841503e58c Mon Sep 17 00:00:00 2001 From: Yann Date: Fri, 22 Mar 2024 11:11:18 +0100 Subject: [PATCH 12/15] ci: remove useless CI step --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f09f005..eaeff67 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,6 @@ pipeline { stages { stage('Project setup') { steps { - sh 'git rm --cached common' sh 'make update' } } From 8cbfa2897e701544a4f2413a8485fe8379b37654 Mon Sep 17 00:00:00 2001 From: Yann Date: Fri, 22 Mar 2024 11:12:28 +0100 Subject: [PATCH 13/15] ci: remove useless CI step --- Jenkinsfile | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index eaeff67..11a238f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,12 +2,6 @@ pipeline { agent any stages { - stage('Project setup') { - steps { - sh 'make update' - } - } - stage('Project compilation') { agent { docker { From 63590e6efff0aa68e558a5b4d44c7f106e4a0477 Mon Sep 17 00:00:00 2001 From: Yann Date: Fri, 22 Mar 2024 11:18:18 +0100 Subject: [PATCH 14/15] ci: remove useless common files --- .gitignore | 4 ++ common/.github/ISSUE_TEMPLATE/bug-report.yml | 44 ------------------- common/.github/ISSUE_TEMPLATE/new-feature.yml | 37 ---------------- common/.github/ISSUE_TEMPLATE/tests.yml | 32 -------------- common/.github/pull_request_template.md | 11 ----- common/.gitignore | 1 - 6 files changed, 4 insertions(+), 125 deletions(-) delete mode 100644 common/.github/ISSUE_TEMPLATE/bug-report.yml delete mode 100644 common/.github/ISSUE_TEMPLATE/new-feature.yml delete mode 100644 common/.github/ISSUE_TEMPLATE/tests.yml delete mode 100644 common/.github/pull_request_template.md delete mode 100644 common/.gitignore diff --git a/.gitignore b/.gitignore index 40254cb..16569a8 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,10 @@ cmake-build-debug .vscode .idea +## Github +# common/.gihub +# common/.gitignore + ## Binary arcade lib diff --git a/common/.github/ISSUE_TEMPLATE/bug-report.yml b/common/.github/ISSUE_TEMPLATE/bug-report.yml deleted file mode 100644 index e1caf1f..0000000 --- a/common/.github/ISSUE_TEMPLATE/bug-report.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Bug Report -description: Report a bug -labels: ["bug"] - -body: - - - type: markdown - attributes: - value: | - Please fill out the sections below to help everyone identify and fix the bug - - - type: textarea - id: description - attributes: - label: Describe your issue - placeholder: When I use a file this happens... - validations: - required: true - - - type: textarea - id: steps - attributes: - label: Steps to reproduce - placeholder: | - 1. Send this file - 2. Set the covergance... - validations: - required: true - - - type: textarea - id: expected - attributes: - label: What was the expected result? - placeholder: I expected it not to crash - - - type: textarea - id: screenshots - attributes: - label: Put here any screenshots or videos (optional) - - - type: markdown - attributes: - value: | - Thanks for reporting this issue! diff --git a/common/.github/ISSUE_TEMPLATE/new-feature.yml b/common/.github/ISSUE_TEMPLATE/new-feature.yml deleted file mode 100644 index df803cd..0000000 --- a/common/.github/ISSUE_TEMPLATE/new-feature.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: New feature -description: Suggest or request a new feature -labels: ["enhancement"] - -body: - - - type: markdown - attributes: - value: | - Please fill out the sections below to properly describe the new feature you are suggesting. - - - type: textarea - id: description - attributes: - label: Describe the feature - placeholder: Describe the feature that you want to add to this project - validations: - required: true - - - type: textarea - id: example - attributes: - label: Example Feature Purpose - placeholder: | - Please add a concrete example related to the project to prove the relevance of your feature. - - - type: textarea - id: context - attributes: - label: Additional context - placeholder: | - Add any other context or screenshots about the feature request here. - - - type: markdown - attributes: - value: | - Thanks for your suggestion! Let's see together if it can be implemented. diff --git a/common/.github/ISSUE_TEMPLATE/tests.yml b/common/.github/ISSUE_TEMPLATE/tests.yml deleted file mode 100644 index a0b5365..0000000 --- a/common/.github/ISSUE_TEMPLATE/tests.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Tests -description: Add, update or delete tests -labels: ["tests"] - -body: - - - type: textarea - id: description - attributes: - label: Describe why you need this Issue - placeholder: I need it because my project reacts strangely to instructions and I need to run some tests to find out the cause of my problem.... - validations: - required: true - - - type: dropdown - id: type - attributes: - label: What kind of tests will you be doing? - options: - - "Unit Tests" - - "Functional Tests" - - "Unit Tests and Functional Tests" - - - type: textarea - id: context - attributes: - label: Put here any additionnal content like screenshots or videos (optional) - - - type: markdown - attributes: - value: | - Thanks for reporting this issue! diff --git a/common/.github/pull_request_template.md b/common/.github/pull_request_template.md deleted file mode 100644 index 68f008b..0000000 --- a/common/.github/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ -## Changes made - -_Please replace this line with a description of the changes in this PR. Include -a summary of the change and relevant motivation and context._ - -## Added/updated tests? - -- [ ] Yes -- [ ] No, and this is why: _please replace this line with details on why tests - have not been included_ -- [ ] I need help with writing tests diff --git a/common/.gitignore b/common/.gitignore deleted file mode 100644 index 1d74e21..0000000 --- a/common/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.vscode/ From a6ceab2eb0c42bb32cca00b20429349812b65246 Mon Sep 17 00:00:00 2001 From: Yann Date: Fri, 22 Mar 2024 11:19:48 +0100 Subject: [PATCH 15/15] ci: update .gitignore --- .gitignore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 16569a8..5b89776 100644 --- a/.gitignore +++ b/.gitignore @@ -10,8 +10,8 @@ cmake-build-debug .idea ## Github -# common/.gihub -# common/.gitignore +common/.github +common/.gitignore ## Binary arcade