Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Include Singleton library #39

Merged
merged 20 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
276786b
feat: add Singleton dependency and update compiler options
MasterLaplace Nov 7, 2024
5aa0585
feat: add compile-time configuration parameters file for Flakkari
MasterLaplace Nov 7, 2024
71ae985
refactor: update ClientManager to use Singleton pattern and improve i…
MasterLaplace Nov 7, 2024
571959c
style: apply linter
github-actions[bot] Nov 7, 2024
90eb2bb
feat: refactor ResourceManager to implement Singleton pattern and upd…
MasterLaplace Nov 7, 2024
14f9c87
style: apply linter
github-actions[bot] Nov 7, 2024
f370cf7
refactor: GameManager to implement Singleton pattern and streamline g…
MasterLaplace Nov 7, 2024
bbcd3dc
style: apply linter
github-actions[bot] Nov 7, 2024
72016b6
refactor: consolidate build checker workflows into a single file for …
MasterLaplace Nov 7, 2024
acf040d
refactor: update build checker and release workflows for clarity and …
MasterLaplace Nov 7, 2024
1936628
refactor: update creation dates in header files to 2024
MasterLaplace Nov 7, 2024
8d0c2bd
refactor: update Socket and UDPServer constructors to improve paramet…
MasterLaplace Nov 7, 2024
7a5d15b
style: apply linter
github-actions[bot] Nov 7, 2024
6e2c1d6
refactor: implement assignment operators for various component structs
MasterLaplace Nov 7, 2024
8224c8f
refactor: update event handling to use size_t and unsigned short for …
MasterLaplace Nov 7, 2024
deaaf67
style: apply linter
github-actions[bot] Nov 7, 2024
b993a1c
refactor: update WSA class to improve socket handling and error manag…
MasterLaplace Nov 8, 2024
9718db5
style: apply linter
github-actions[bot] Nov 8, 2024
c2a70c3
refactor: replace PACKED macros with LPL_PACKED macros for better str…
MasterLaplace Nov 8, 2024
c521655
refactor: update Client and ClientManager methods for consistent refe…
MasterLaplace Nov 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/build_checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build Checker Windows

on:
push:
branches-ignore:
- 'ga-ignore-**'
- 'gh-pages'

jobs:
build_checker_windows:
name: Build Checker Windows
runs-on: windows-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v4

- name: Install dependencies
run: |
choco install cmake -y

- name: Configure and Build
run: |
mkdir build && cd build
cmake .. && cmake --build .

build_checker_ubuntu:
name: Build Checker Ubuntu
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt update
sudo apt install cmake

- name: Configure and Build
run: |
mkdir build && cd build
cmake .. && cmake --build .

build_checker_macos:
name: Build Checker MacOS
runs-on: macos-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v4

- name: Install dependencies
run: |
brew install ninja

- name: Configure and Build
run: |
mkdir build && cd build
cmake -G Ninja .. && ninja
27 changes: 0 additions & 27 deletions .github/workflows/build_checker_macos.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/build_checker_ubuntu.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/build_checker_windows.yml

This file was deleted.

21 changes: 7 additions & 14 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ permissions:
contents: write

jobs:
bump_version:
name: Bump version
bump_version_and_create_release:
name: Bump version and create release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -41,25 +41,18 @@ jobs:
git commit -m "chore: bump the Flakkari version to ${{ steps.test_tag_version.outputs.new_tag }}" || true
git push || true

create_release:
name: Create release
needs: bump_version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Bump version and push tag
- name: Create Tag
id: tag_version
uses: mathieudutour/[email protected]
with:
env:
github_token: ${{ secrets.GITHUB_TOKEN }}
run: |
git tag ${{ steps.test_tag_version.outputs.new_tag }}
git push origin ${{ steps.test_tag_version.outputs.new_tag }}

- name: Create a GitHub release
uses: ncipollo/[email protected]
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Flakkari ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
draft: false
prerelease: false
generateReleaseNotes: true
7 changes: 4 additions & 3 deletions .github/workflows/deploy_doxygen_page.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Doxygen GitHub Pages Deploy Action
on:
release:
types: [released]
pull_request:
types: [closed]
branches: [master, main]

jobs:
generate:
Expand All @@ -10,7 +11,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: "true"
submodules: true

- name: Install Doxygen
run: |
Expand Down
15 changes: 11 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ set(HEADERS
Flakkari/Logger/Logger.hpp

Flakkari/Network/Network.hpp
Flakkari/Network/Packed.hpp
Flakkari/Network/Address.hpp
Flakkari/Network/Buffer.hpp
Flakkari/Network/Socket.hpp
Expand Down Expand Up @@ -78,7 +77,6 @@ set(HEADER_LIB_LOGGER

set(HEADER_LIB_NETWORK
Flakkari/Network/Network.hpp
Flakkari/Network/Packed.hpp
Flakkari/Network/Address.hpp
Flakkari/Network/Buffer.hpp
Flakkari/Network/Socket.hpp
Expand All @@ -105,7 +103,14 @@ FetchContent_Declare(
GIT_TAG v3.11.3
)

FetchContent_Declare(
Singleton
GIT_REPOSITORY https://github.com/MasterLaplace/Singleton.git
GIT_TAG v1.0.2
)

FetchContent_MakeAvailable(nlohmann_json)
FetchContent_MakeAvailable(Singleton)

# Separate Build Artifacts:
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/build)
Expand All @@ -122,16 +127,17 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (MSVC)
add_compile_options(/W4)
elseif (WIN32)
add_compile_options(-Wall -Wextra)
add_compile_options(-Wall -Wextra -ggdb -O0 -g3)
else()
add_compile_options(-Wall -Wextra)
add_compile_options(-Wall -Wextra -ggdb -O0 -g3)
endif()

# Create the executable
add_executable(flakkari ${SOURCES} ${HEADERS})

# Include Directories:
target_include_directories(flakkari PRIVATE ${CMAKE_SOURCE_DIR}/Flakkari)
target_include_directories(flakkari PRIVATE ${singleton_SOURCE_DIR})

# Link Libraries:
target_link_libraries(flakkari PRIVATE nlohmann_json::nlohmann_json)
Expand Down Expand Up @@ -190,6 +196,7 @@ add_library(flakkari_network SHARED ${SOURCES_LIB_NETWORK} ${HEADER_LIB_NETWORK}

# Include Directories:
target_include_directories(flakkari_network PRIVATE ${CMAKE_SOURCE_DIR}/Flakkari)
target_include_directories(flakkari_network PRIVATE ${singleton_SOURCE_DIR})

# Link Libraries:
target_link_libraries(flakkari_network PRIVATE nlohmann_json::nlohmann_json)
Expand Down
14 changes: 10 additions & 4 deletions Flakkari/Engine/EntityComponentSystem/Components/2D/Collider.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@
#include "../../../Math/Vector.hpp"
#include <string>

#include "Network/Packed.hpp"

namespace Flakkari::Engine::ECS::Components::_2D {
PACKED_START
LPL_PACKED_START

/**
* @brief Collider component for ECS entities that have a script attached to them
Expand All @@ -30,10 +28,18 @@ struct Collider {
Collider(Math::Vector2f nsize) : _size(nsize) {}
Collider(const Collider &other) : _size(other._size) {}

Collider &operator=(const Collider &other)
{
if (this != &other)
_size = other._size;

return *this;
}

std::size_t size() const { return sizeof(_size); }
};

PACKED_END
LPL_PACKED_END
} // namespace Flakkari::Engine::ECS::Components::_2D

#endif /* !COLLIDER_HPP_ */
20 changes: 17 additions & 3 deletions Flakkari/Engine/EntityComponentSystem/Components/2D/Control.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
** EPITECH PROJECT, 2024
** Title: Flakkari
** Author: MasterLaplace
** Created: 2023-01-11
** Created: 2024-01-11
** File description:
** Control
*/
Expand All @@ -13,7 +13,7 @@
#include "../../../Math/Vector.hpp"

namespace Flakkari::Engine::ECS::Components::_2D {
PACKED_START
LPL_PACKED_START

/**
* @brief Control component for 2D entities (player, enemies, etc...)
Expand All @@ -38,10 +38,24 @@ struct Control {
Control(const Control &other)
: up(other.up), down(other.down), left(other.left), right(other.right), shoot(other.shoot){};

Control &operator=(const Control &other)
{
if (this != &other)
{
up = other.up;
down = other.down;
left = other.left;
right = other.right;
shoot = other.shoot;
}

return *this;
}

std::size_t size() const { return sizeof(*this); }
};

PACKED_END
LPL_PACKED_END
} // namespace Flakkari::Engine::ECS::Components::_2D

#endif /* !FLAKKARI_CONTROL_HPP_ */
17 changes: 14 additions & 3 deletions Flakkari/Engine/EntityComponentSystem/Components/2D/Movable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
** EPITECH PROJECT, 2024
** Title: Flakkari
** Author: MasterLaplace
** Created: 2023-01-06
** Created: 2024-01-06
** File description:
** Movable
*/
Expand All @@ -13,7 +13,7 @@
#include "../../../Math/Vector.hpp"

namespace Flakkari::Engine::ECS::Components::_2D {
PACKED_START
LPL_PACKED_START

struct Movable {
Math::Vector2f velocity; // pixels / second
Expand All @@ -24,10 +24,21 @@ struct Movable {
: velocity(velocity), acceleration(acceleration){};
Movable(const Movable &other) : velocity(other.velocity), acceleration(other.acceleration){};

Movable &operator=(const Movable &other)
{
if (this != &other)
{
velocity = other.velocity;
acceleration = other.acceleration;
}

return *this;
}

std::size_t size() const { return sizeof(*this); }
};

PACKED_END
LPL_PACKED_END
} // namespace Flakkari::Engine::ECS::Components::_2D

#endif /* !FLAKKARI_MOVABLE_HPP_ */
Loading
Loading