-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into 97-feat-create-game-f…
…older
- Loading branch information
Showing
21 changed files
with
660 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Windows | ||
on: [check_run, pull_request] | ||
jobs: | ||
cmake-build-windows: | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- name: Checkout project | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cache vcpkg | ||
uses: actions/cache@v4 | ||
with: | ||
path: vcpkg | ||
key: vcpkg-cache-${{ runner.os }} | ||
|
||
- name: Install dependencies on Windows (vcpkg) | ||
shell: pwsh | ||
run: | | ||
if (-Not (Test-Path "vcpkg")) { | ||
git clone https://github.com/microsoft/vcpkg.git | ||
.\vcpkg\bootstrap-vcpkg.bat | ||
} | ||
.\vcpkg\vcpkg install | ||
- name: Build project | ||
run: | | ||
cmake -B build -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake | ||
cmake --build build/ --config Debug | ||
- name: Run tests | ||
run: | | ||
cd build/tests/ | ||
ctest -C Debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** DrawOBJSystem | ||
** File description: | ||
** DrawOBJSystem | ||
*/ | ||
|
||
#include "DrawOBJSystem.hpp" | ||
#include "ObjPathComponent.hpp" | ||
#include "Position3DComponent.hpp" | ||
#include "ScaleComponent.hpp" | ||
#include "GetGraphicalLibrary.hpp" | ||
#include "SparseArray.hpp" | ||
|
||
#include <exception> | ||
|
||
DrawOBJSystem::DrawOBJSystem() : | ||
ASystem("DrawOBJSystem") | ||
{ | ||
} | ||
|
||
void DrawOBJSystem::_drawOBJ(ECS::Registry& reg, int idxPacketEntities) | ||
{ | ||
std::shared_ptr<IGraphic> libGraphic = getGraphicalLibrary(); | ||
|
||
ECS::SparseArray<IComponent> objPathComponents = reg.get_components<IComponent>("ObjPathComponent"); | ||
ECS::SparseArray<IComponent> position3DComponents = reg.get_components<IComponent>("Position3DComponent"); | ||
ECS::SparseArray<IComponent> scaleComponents = reg.get_components<IComponent>("ScaleComponent"); | ||
|
||
for (ECS::entity_t entity = 0; objPathComponents.size() >= entity + 1; entity++) { | ||
std::shared_ptr<ObjPathComponent> obj = std::dynamic_pointer_cast<ObjPathComponent>(objPathComponents[entity]); | ||
|
||
std::shared_ptr<Position3DComponent> pos = (position3DComponents.size() >= entity + 1) ? | ||
std::dynamic_pointer_cast<Position3DComponent>(position3DComponents[entity]) : nullptr; | ||
|
||
std::shared_ptr<ScaleComponent> scale = (scaleComponents.size() >= entity + 1) ? | ||
std::dynamic_pointer_cast<ScaleComponent>(scaleComponents[entity]) : nullptr; | ||
|
||
float modelScale; | ||
|
||
if (!obj) | ||
continue; | ||
modelScale = (scale) ? scale->scale : 1.0; | ||
if (pos) | ||
libGraphic->drawOBJ(obj->path, pos->x, pos->y, pos->z, modelScale); | ||
else | ||
libGraphic->drawOBJ(obj->path, 0, 0, 0, modelScale); | ||
} | ||
} | ||
|
||
extern "C" ISystem* loadSystemInstance() | ||
{ | ||
return new DrawOBJSystem(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** DrawOBJSystem | ||
** File description: | ||
** DrawOBJSystem | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <iostream> | ||
|
||
#include "ISystem.hpp" | ||
|
||
/** | ||
* @brief System to draw an OBJ Model. | ||
* | ||
*/ | ||
class DrawOBJSystem : public ASystem { | ||
|
||
public: | ||
|
||
/** | ||
* @brief Construct a new Draw OBJ System object. | ||
* | ||
*/ | ||
DrawOBJSystem(); | ||
|
||
/** | ||
* @brief Destroy the Draw OBJ System object. | ||
* | ||
*/ | ||
~DrawOBJSystem() = default; | ||
|
||
/** | ||
* @brief Get the Function object. | ||
* | ||
* @return std::function<void(ECS::Registry& reg, int idxPacketEntities)> | ||
*/ | ||
std::function<void(ECS::Registry& reg, int idxPacketEntities)> getFunction() | ||
{ | ||
return [this](ECS::Registry& reg, int idxPacketEntities) { | ||
_drawOBJ(reg, idxPacketEntities); | ||
}; | ||
} | ||
|
||
private: | ||
|
||
void _drawOBJ(ECS::Registry& reg, int idxPacketEntities); //< Function to init the player. | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.