compile lib

This commit is contained in:
arthur.jamet
2021-05-19 10:08:54 +02:00
parent 84bd33548b
commit 98e11b10fd
15 changed files with 131 additions and 80 deletions
+56 -56
View File
@@ -5,68 +5,68 @@ set(LIB_NAME "ray")
project("${LIB_NAME}")
include_directories("./include")
target_link_libraries(${LIB_NAME} raylib)
if (CMAKE_COMPILER_IS_GNUCXX)
set(GCC_COVERAGE_COMPILE_FLAGS "-Wall -Wextra -Werror -Wshadow")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
set(GCC_COVERAGE_COMPILE_FLAGS "-Wall -Wextra -Werror -Wshadow")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
endif ()
set(HEADERS
include/Canvas.hpp
include/Color.hpp
include/Font.hpp
include/IRessource.hpp
include/Matrix.hpp
include/Mesh.hpp
include/Model.hpp
include/Vector.hpp
include/Window.hpp
include/Audio/IAudio.hpp
include/Audio/Music.hpp
include/Audio/Sound.hpp
include/Camera/Camera2D.hpp
include/Camera/Camera3D.hpp
include/Camera/CameraMode.hpp
include/Camera/CameraProjection.hpp
include/Camera/ICamera.hpp
include/Controllers/Gamepad.hpp
include/Controllers/Keyboard.hpp
include/Controllers/Mouse.hpp
include/Drawables/ADrawable2D.hpp
include/Drawables/ADrawable3D.hpp
include/Drawables/IDrawable.hpp
include/Drawables/Image.hpp
include/Drawables/Texture.hpp
include/Drawables/2D/Circle.hpp
include/Drawables/2D/Line.hpp
include/Drawables/2D/Point.hpp
include/Drawables/2D/Rectangle.hpp
include/Drawables/2D/Text.hpp
include/Drawables/2D/Triangle.hpp
include/Drawables/3D/Circle.hpp
include/Drawables/3D/Cylinder.hpp
include/Drawables/3D/Grid.hpp
include/Drawables/3D/Line.hpp
include/Drawables/3D/Plane.hpp
include/Drawables/3D/Point.hpp
include/Drawables/3D/Ray.hpp
include/Drawables/3D/Sphere.hpp
include/Drawables/3D/Triangle.hpp
)
include/Canvas.hpp
include/Color.hpp
include/Font.hpp
include/IRessource.hpp
include/Matrix.hpp
include/Mesh.hpp
include/Model.hpp
include/Vector.hpp
include/Window.hpp
include/Audio/IAudio.hpp
include/Audio/Music.hpp
include/Audio/Sound.hpp
include/Camera/Camera2D.hpp
include/Camera/Camera3D.hpp
include/Camera/CameraMode.hpp
include/Camera/CameraProjection.hpp
include/Camera/ICamera.hpp
include/Controllers/Gamepad.hpp
include/Controllers/Keyboard.hpp
include/Controllers/Mouse.hpp
include/Drawables/ADrawable2D.hpp
include/Drawables/ADrawable3D.hpp
include/Drawables/IDrawable.hpp
include/Drawables/Image.hpp
include/Drawables/Texture.hpp
include/Drawables/2D/Circle.hpp
include/Drawables/2D/Line.hpp
include/Drawables/2D/Point.hpp
include/Drawables/2D/Rectangle.hpp
include/Drawables/2D/Text.hpp
include/Drawables/2D/Triangle.hpp
include/Drawables/3D/Circle.hpp
include/Drawables/3D/Cylinder.hpp
include/Drawables/3D/Grid.hpp
include/Drawables/3D/Line.hpp
include/Drawables/3D/Plane.hpp
include/Drawables/3D/Point.hpp
include/Drawables/3D/Ray.hpp
include/Drawables/3D/Sphere.hpp
include/Drawables/3D/Triangle.hpp
)
set(SRC
src/Color.cpp
src/Font.cpp
src/Model.cpp
src/Window.cpp
src/Audio/Music.cpp
src/Audio/Sound.cpp
src/Camera/Camera2D.cpp
src/Camera/Camera3D.cpp
src/Controllers/Gamepad.cpp
src/Controllers/Keyboard.cpp
src/Controllers/Mouse.cpp
)
src/Color.cpp
src/Font.cpp
src/Model.cpp
src/Window.cpp
src/Audio/Music.cpp
src/Audio/Sound.cpp
src/Camera/Camera2D.cpp
src/Camera/Camera3D.cpp
src/Controllers/Gamepad.cpp
src/Controllers/Keyboard.cpp
src/Controllers/Mouse.cpp
)
add_library(${LIB_NAME} STATIC ${SRC} ${HEADERS})
target_link_libraries(${LIB_NAME} raylib)
+1 -1
View File
@@ -21,7 +21,7 @@ namespace RAY::Camera {
//! @param target Camera target (rotation and zoom origin
//! @param rotation Camera rotation in degrees
//! @param zoom Camera zoom (scaling), should be 1.0f by default
Camera2D(const Vector2 &offset, Vector2 target, float rotation, float zoom = 1);
Camera2D(const Vector2 &offset, const Vector2 &target, float rotation, float zoom = 1);
//! @brief A copy constructor
Camera2D(const Camera2D &) = default;
+1 -1
View File
@@ -24,7 +24,7 @@ namespace RAY::Camera {
//! @param up Camera up vector (rotation over its axis)
//! @param fovy Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic
//! @param projection Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
Camera3D(const Vector3 &position, Vector3 target, Vector3 up, float fovy, float projection);
Camera3D(const Vector3 &position, const Vector3 &target, const Vector3 &up, float fovy, Projection projection);
//! @brief A copy constructor
Camera3D(const Camera3D &) = default;
+1 -1
View File
@@ -49,7 +49,7 @@ namespace RAY::Controller {
bool isUp(Button);
//! @brief Returns true if controller is available
bool isAvailable(Button);
bool isAvailable();
//! @brief Sets gamepad's id
void setID(int id);
+2 -2
View File
@@ -19,7 +19,7 @@ namespace RAY::Drawables::Drawables2D {
//! @brief ADrawable constructor
//! @param poition position of top-left point
//! @param Color Color of the color
ADrawable2D(const Vector2 &position, Color color);
ADrawable2D(const Vector2 &position, RAY::Color color);
//! @brief ADrawable constructor
//! @param x x-position of top-left point
//! @param y y-position of top-left point
@@ -48,7 +48,7 @@ namespace RAY::Drawables::Drawables2D {
ADrawable2D &setColor(const Color &color) const;
//! @brief Draw drawble on window
void drawOn(Window &);
virtual void drawOn(Window &) = 0;
private:
//! @brief Top-left position
+11 -10
View File
@@ -8,19 +8,20 @@
#ifndef IDRAWABLE_HPP_
#define IDRAWABLE_HPP_
#include "Window.hpp"
namespace RAY::Drawables
namespace RAY
{
class IDrawable {
public:
virtual ~IDrawable() = 0;
class Window;
namespace Drawables {
class IDrawable {
public:
virtual ~IDrawable() = 0;
virtual void drawOn(Window &) = 0;
virtual void drawOn(RAY::Window &) = 0;
protected:
private:
};
protected:
private:
};
}
}
+1
View File
@@ -30,6 +30,7 @@ bool RAY::Audio::Music::load(const std::string &path)
bool RAY::Audio::Music::unload(void)
{
UnloadMusicStream(_music);
return true;
}
bool RAY::Audio::Music::isPlayin(void)
+1
View File
@@ -30,6 +30,7 @@ bool RAY::Audio::Sound::load(const std::string &path)
bool RAY::Audio::Sound::unload(void)
{
UnloadSound(_sound);
return true;
}
bool RAY::Audio::Sound::isPlayin(void)
+1 -1
View File
@@ -7,7 +7,7 @@
#include "Camera/Camera2D.hpp"
RAY::Camera::Camera2D::Camera2D(const Vector2 &offset, Vector2 target, float rotation, float zoom = 1):
RAY::Camera::Camera2D::Camera2D(const Vector2 &offset, const Vector2 &target, float rotation, float zoom):
_camera({offset, target, rotation, zoom})
{
}
+2 -2
View File
@@ -5,9 +5,9 @@
** Camera3D
*/
#include "Camera3D.hpp"
#include "Camera/Camera3D.hpp"
RAY::Camera::Camera3D::Camera3D(const Vector3 &position, Vector3 target, Vector3 up, float fovy, float projection):
RAY::Camera::Camera3D::Camera3D(const Vector3 &position, const Vector3 &target, const Vector3 &up, float fovy, Projection projection):
_camera({position, target, up, fovy, projection})
{
}
+1 -1
View File
@@ -33,7 +33,7 @@ bool RAY::Controller::GamePad::isUp(RAY::Controller::GamePad::Button button)
return IsGamepadButtonUp(this->_id, button);
}
bool RAY::Controller::GamePad::isAvailable(RAY::Controller::GamePad::Button button)
bool RAY::Controller::GamePad::isAvailable()
{
return IsGamepadAvailable(this->_id);
}
+45
View File
@@ -0,0 +1,45 @@
/*
** EPITECH PROJECT, 2021
** Bomberman
** File description:
** ADrawable2D
*/
#include "Drawables/ADrawable2D.hpp"
RAY::Drawables::Drawables2D::ADrawable2D::ADrawable2D(const Vector2 &position, RAY::Color color):
_color(color), _position(position)
{
}
RAY::Drawables::Drawables2D::ADrawable2D(int x, int y, RAY::Color color)
{
}
const Vector2 &RAY::Drawables::Drawables2D::getPosition(void) const
{
}
const Color &RAY::Drawables::Drawables2D::getColor(void) const
{
}
ADrawable2D &RAY::Drawables::Drawables2D::setPosition(const Vector2 &position)
{
}
ADrawable2D &RAY::Drawables::Drawables2D::setPosition(int x, int y)
{
}
ADrawable2D &RAY::Drawables::Drawables2D::setColor(const Color &color) const
{
}
+1
View File
@@ -30,4 +30,5 @@ bool RAY::Font::load(const std::string &filename)
bool RAY::Font::unload()
{
UnloadFont(this->_font);
return true;
}
+2
View File
@@ -37,9 +37,11 @@ bool RAY::Model::load(const Mesh &mesh)
bool RAY::Model::unload()
{
UnloadModel(_model);
return true;
}
bool RAY::Model::unloadKeepMeshes()
{
UnloadModelKeepMeshes(_model);
return true;
}
+5 -5
View File
@@ -6,12 +6,12 @@
*/
#include "Window.hpp"
#include "Mouse.hpp"
#include "Controllers/Mouse.hpp"
RAY::Window::Window(int width, int height, const std::string title, bool openNow):
_isOpen(openNow), _dimensions({width, height}), _title(title)
_dimensions({(float)width, (float)height}), _title(title), _isOpen(openNow)
{
if (this->_isOpen)
if (openNow)
this->open();
}
@@ -65,7 +65,7 @@ bool RAY::Window::cursorIsVisible(void) const
Vector2 RAY::Window::getCursorPosition(void) const
{
return RAY::Mouse::getCursorPosition();
return RAY::Controller::Mouse::getCursorPosition();
}
void RAY::Window::setFPS(unsigned int fps)
@@ -113,7 +113,7 @@ void RAY::Window::setTitle(const std::string &title)
this->_title = title;
}
void RAY::Window::draw(Drawables::IDrawable &drawable)
void RAY::Window::draw(RAY::Drawables::IDrawable &drawable)
{
drawable.drawOn(*this);
}