From 3d5ea204b640815ba1f23512a12d66cfe705c5ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Mon, 24 May 2021 11:33:19 +0200 Subject: [PATCH] adding a RectangleDrawable2DComponent and moving files --- CMakeLists.txt | 4 +-- lib/Ray/sources/Drawables/3D/Circle.cpp | 3 +-- lib/wal/CMakeLists.txt | 4 --- .../Drawable/Drawable2DComponent.cpp | 13 +++++++++ .../Drawable/Drawable2DComponent.hpp | 23 ++++++++++++++++ .../Drawable/RectangleDrawable2DComponent.cpp | 16 +++++++++++ .../Drawable/RectangleDrawable2DComponent.hpp | 27 +++++++++++++++++++ .../Component/Movable/MovableComponent.cpp | 0 .../Component/Movable/MovableComponent.hpp | 0 .../Component/Position/PositionComponent.cpp | 0 .../Component/Position/PositionComponent.hpp | 0 .../System/Movable/MovableSystem.cpp | 0 .../System/Movable/MovableSystem.hpp | 0 .../System/Renderer}/RendererSystem.cpp | 0 .../System/Renderer}/RendererSystem.hpp | 0 sources/main.cpp | 2 +- 16 files changed, 83 insertions(+), 9 deletions(-) create mode 100644 sources/Component/Drawable/Drawable2DComponent.cpp create mode 100644 sources/Component/Drawable/Drawable2DComponent.hpp create mode 100644 sources/Component/Drawable/RectangleDrawable2DComponent.cpp create mode 100644 sources/Component/Drawable/RectangleDrawable2DComponent.hpp rename {lib/wal/sources => sources}/Component/Movable/MovableComponent.cpp (100%) rename {lib/wal/sources => sources}/Component/Movable/MovableComponent.hpp (100%) rename {lib/wal/sources => sources}/Component/Position/PositionComponent.cpp (100%) rename {lib/wal/sources => sources}/Component/Position/PositionComponent.hpp (100%) rename {lib/wal/sources => sources}/System/Movable/MovableSystem.cpp (100%) rename {lib/wal/sources => sources}/System/Movable/MovableSystem.hpp (100%) rename {lib/wal/sources/System/Movable => sources/System/Renderer}/RendererSystem.cpp (100%) rename {lib/wal/sources/System/Movable => sources/System/Renderer}/RendererSystem.hpp (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8960730e..1b4b1159 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ add_subdirectory(${PROJECT_SOURCE_DIR}/lib/wal) add_subdirectory(${PROJECT_SOURCE_DIR}/lib/Ray) add_executable(bomberman - sources/main.cpp -) + sources/main.cpp + sources/Component/Drawable/RectangleDrawable2DComponent.cpp sources/Component/Drawable/RectangleDrawable2DComponent.hpp) target_link_libraries(bomberman wal ray) \ No newline at end of file diff --git a/lib/Ray/sources/Drawables/3D/Circle.cpp b/lib/Ray/sources/Drawables/3D/Circle.cpp index c174a30e..414ff98e 100644 --- a/lib/Ray/sources/Drawables/3D/Circle.cpp +++ b/lib/Ray/sources/Drawables/3D/Circle.cpp @@ -13,7 +13,6 @@ RAY::Drawables::Drawables3D::Circle::Circle(const Vector3 ¢erPosition, int r } - int RAY::Drawables::Drawables3D::Circle::getRadius(void) const { return this->_radius; @@ -34,4 +33,4 @@ void RAY::Drawables::Drawables3D::Circle::drawOn(RAY::Window &) { DrawCircle3D(this->_centerPos, this->_radius,this->_rotationAxis, this->_rotationAngle, this->_color); -} +} \ No newline at end of file diff --git a/lib/wal/CMakeLists.txt b/lib/wal/CMakeLists.txt index 5259a6e2..8d1c350e 100644 --- a/lib/wal/CMakeLists.txt +++ b/lib/wal/CMakeLists.txt @@ -15,11 +15,7 @@ add_library(wal sources/Exception/WalError.hpp sources/Entity/Entity.cpp sources/Component/Component.cpp - sources/Component/Position/PositionComponent.cpp - sources/Component/Position/PositionComponent.hpp sources/Models/Vector3.hpp - sources/Component/Movable/MovableComponent.cpp - sources/Component/Movable/MovableComponent.hpp sources/System/Movable/MovableSystem.cpp sources/System/Movable/MovableSystem.hpp sources/System/System.cpp diff --git a/sources/Component/Drawable/Drawable2DComponent.cpp b/sources/Component/Drawable/Drawable2DComponent.cpp new file mode 100644 index 00000000..3c72b23b --- /dev/null +++ b/sources/Component/Drawable/Drawable2DComponent.cpp @@ -0,0 +1,13 @@ +// +// Created by cbihan on 24/05/2021. +// + +#include "Drawable2DComponent.hpp" + +namespace BBM +{ + Drawable2DComponent::Drawable2DComponent(WAL::Entity &entity) + : Component(entity) + { + } +} \ No newline at end of file diff --git a/sources/Component/Drawable/Drawable2DComponent.hpp b/sources/Component/Drawable/Drawable2DComponent.hpp new file mode 100644 index 00000000..fad4ce83 --- /dev/null +++ b/sources/Component/Drawable/Drawable2DComponent.hpp @@ -0,0 +1,23 @@ +// +// Created by cbihan on 24/05/2021. +// + +#pragma once + +#include "Component/Component.hpp" +#include "Drawables/ADrawable2D.hpp" +#include "Color.hpp" + +namespace BBM +{ + class Drawable2DComponent : public WAL::Component + { + public: + //! @brief color of the drawable + RAY::Color color; + //! @brief The rotation (clock wise) + int rotation; + + explicit Drawable2DComponent(WAL::Entity &entity); + }; +} \ No newline at end of file diff --git a/sources/Component/Drawable/RectangleDrawable2DComponent.cpp b/sources/Component/Drawable/RectangleDrawable2DComponent.cpp new file mode 100644 index 00000000..eb31cb68 --- /dev/null +++ b/sources/Component/Drawable/RectangleDrawable2DComponent.cpp @@ -0,0 +1,16 @@ +// +// Created by cbihan on 24/05/2021. +// + +#include "RectangleDrawable2DComponent.hpp" +#include "Drawable2DComponent.hpp" + +namespace BBM +{ + + RectangleDrawableComponent::RectangleDrawableComponent(WAL::Entity &entity) + : Drawable2DComponent(entity) + { + + } +} \ No newline at end of file diff --git a/sources/Component/Drawable/RectangleDrawable2DComponent.hpp b/sources/Component/Drawable/RectangleDrawable2DComponent.hpp new file mode 100644 index 00000000..68d35b1f --- /dev/null +++ b/sources/Component/Drawable/RectangleDrawable2DComponent.hpp @@ -0,0 +1,27 @@ +// +// Created by cbihan on 24/05/2021. +// + +#pragma once + +#include "Drawable2DComponent.hpp" +#include "Entity/Entity.hpp" + +namespace BBM +{ + class RectangleDrawableComponent : public Drawable2DComponent + { + public: + //! @brief The length of the rectangle + unsigned int length; + //! @brief The width of the rectangle + unsigned int width; + + explicit RectangleDrawableComponent(WAL::Entity &entity); + RectangleDrawableComponent(const RectangleDrawableComponent &) = default; + ~RectangleDrawableComponent() override = default; + RectangleDrawableComponent &operator=(const RectangleDrawableComponent &) = delete; + }; +} + + diff --git a/lib/wal/sources/Component/Movable/MovableComponent.cpp b/sources/Component/Movable/MovableComponent.cpp similarity index 100% rename from lib/wal/sources/Component/Movable/MovableComponent.cpp rename to sources/Component/Movable/MovableComponent.cpp diff --git a/lib/wal/sources/Component/Movable/MovableComponent.hpp b/sources/Component/Movable/MovableComponent.hpp similarity index 100% rename from lib/wal/sources/Component/Movable/MovableComponent.hpp rename to sources/Component/Movable/MovableComponent.hpp diff --git a/lib/wal/sources/Component/Position/PositionComponent.cpp b/sources/Component/Position/PositionComponent.cpp similarity index 100% rename from lib/wal/sources/Component/Position/PositionComponent.cpp rename to sources/Component/Position/PositionComponent.cpp diff --git a/lib/wal/sources/Component/Position/PositionComponent.hpp b/sources/Component/Position/PositionComponent.hpp similarity index 100% rename from lib/wal/sources/Component/Position/PositionComponent.hpp rename to sources/Component/Position/PositionComponent.hpp diff --git a/lib/wal/sources/System/Movable/MovableSystem.cpp b/sources/System/Movable/MovableSystem.cpp similarity index 100% rename from lib/wal/sources/System/Movable/MovableSystem.cpp rename to sources/System/Movable/MovableSystem.cpp diff --git a/lib/wal/sources/System/Movable/MovableSystem.hpp b/sources/System/Movable/MovableSystem.hpp similarity index 100% rename from lib/wal/sources/System/Movable/MovableSystem.hpp rename to sources/System/Movable/MovableSystem.hpp diff --git a/lib/wal/sources/System/Movable/RendererSystem.cpp b/sources/System/Renderer/RendererSystem.cpp similarity index 100% rename from lib/wal/sources/System/Movable/RendererSystem.cpp rename to sources/System/Renderer/RendererSystem.cpp diff --git a/lib/wal/sources/System/Movable/RendererSystem.hpp b/sources/System/Renderer/RendererSystem.hpp similarity index 100% rename from lib/wal/sources/System/Movable/RendererSystem.hpp rename to sources/System/Renderer/RendererSystem.hpp diff --git a/sources/main.cpp b/sources/main.cpp index 1e40b264..2866b85a 100644 --- a/sources/main.cpp +++ b/sources/main.cpp @@ -19,7 +19,7 @@ int main() { - + SetTraceLogLevel(LOG_WARNING); // Initialization //-------------------------------------------------------------------------------------- const int screenWidth = 800;