mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-06 03:12:01 +00:00
compile lib
This commit is contained in:
+56
-56
@@ -5,68 +5,68 @@ set(LIB_NAME "ray")
|
|||||||
|
|
||||||
project("${LIB_NAME}")
|
project("${LIB_NAME}")
|
||||||
include_directories("./include")
|
include_directories("./include")
|
||||||
target_link_libraries(${LIB_NAME} raylib)
|
|
||||||
|
|
||||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||||
set(GCC_COVERAGE_COMPILE_FLAGS "-Wall -Wextra -Werror -Wshadow")
|
set(GCC_COVERAGE_COMPILE_FLAGS "-Wall -Wextra -Werror -Wshadow")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set(HEADERS
|
set(HEADERS
|
||||||
include/Canvas.hpp
|
include/Canvas.hpp
|
||||||
include/Color.hpp
|
include/Color.hpp
|
||||||
include/Font.hpp
|
include/Font.hpp
|
||||||
include/IRessource.hpp
|
include/IRessource.hpp
|
||||||
include/Matrix.hpp
|
include/Matrix.hpp
|
||||||
include/Mesh.hpp
|
include/Mesh.hpp
|
||||||
include/Model.hpp
|
include/Model.hpp
|
||||||
include/Vector.hpp
|
include/Vector.hpp
|
||||||
include/Window.hpp
|
include/Window.hpp
|
||||||
include/Audio/IAudio.hpp
|
include/Audio/IAudio.hpp
|
||||||
include/Audio/Music.hpp
|
include/Audio/Music.hpp
|
||||||
include/Audio/Sound.hpp
|
include/Audio/Sound.hpp
|
||||||
include/Camera/Camera2D.hpp
|
include/Camera/Camera2D.hpp
|
||||||
include/Camera/Camera3D.hpp
|
include/Camera/Camera3D.hpp
|
||||||
include/Camera/CameraMode.hpp
|
include/Camera/CameraMode.hpp
|
||||||
include/Camera/CameraProjection.hpp
|
include/Camera/CameraProjection.hpp
|
||||||
include/Camera/ICamera.hpp
|
include/Camera/ICamera.hpp
|
||||||
include/Controllers/Gamepad.hpp
|
include/Controllers/Gamepad.hpp
|
||||||
include/Controllers/Keyboard.hpp
|
include/Controllers/Keyboard.hpp
|
||||||
include/Controllers/Mouse.hpp
|
include/Controllers/Mouse.hpp
|
||||||
include/Drawables/ADrawable2D.hpp
|
include/Drawables/ADrawable2D.hpp
|
||||||
include/Drawables/ADrawable3D.hpp
|
include/Drawables/ADrawable3D.hpp
|
||||||
include/Drawables/IDrawable.hpp
|
include/Drawables/IDrawable.hpp
|
||||||
include/Drawables/Image.hpp
|
include/Drawables/Image.hpp
|
||||||
include/Drawables/Texture.hpp
|
include/Drawables/Texture.hpp
|
||||||
include/Drawables/2D/Circle.hpp
|
include/Drawables/2D/Circle.hpp
|
||||||
include/Drawables/2D/Line.hpp
|
include/Drawables/2D/Line.hpp
|
||||||
include/Drawables/2D/Point.hpp
|
include/Drawables/2D/Point.hpp
|
||||||
include/Drawables/2D/Rectangle.hpp
|
include/Drawables/2D/Rectangle.hpp
|
||||||
include/Drawables/2D/Text.hpp
|
include/Drawables/2D/Text.hpp
|
||||||
include/Drawables/2D/Triangle.hpp
|
include/Drawables/2D/Triangle.hpp
|
||||||
include/Drawables/3D/Circle.hpp
|
include/Drawables/3D/Circle.hpp
|
||||||
include/Drawables/3D/Cylinder.hpp
|
include/Drawables/3D/Cylinder.hpp
|
||||||
include/Drawables/3D/Grid.hpp
|
include/Drawables/3D/Grid.hpp
|
||||||
include/Drawables/3D/Line.hpp
|
include/Drawables/3D/Line.hpp
|
||||||
include/Drawables/3D/Plane.hpp
|
include/Drawables/3D/Plane.hpp
|
||||||
include/Drawables/3D/Point.hpp
|
include/Drawables/3D/Point.hpp
|
||||||
include/Drawables/3D/Ray.hpp
|
include/Drawables/3D/Ray.hpp
|
||||||
include/Drawables/3D/Sphere.hpp
|
include/Drawables/3D/Sphere.hpp
|
||||||
include/Drawables/3D/Triangle.hpp
|
include/Drawables/3D/Triangle.hpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SRC
|
set(SRC
|
||||||
src/Color.cpp
|
src/Color.cpp
|
||||||
src/Font.cpp
|
src/Font.cpp
|
||||||
src/Model.cpp
|
src/Model.cpp
|
||||||
src/Window.cpp
|
src/Window.cpp
|
||||||
src/Audio/Music.cpp
|
src/Audio/Music.cpp
|
||||||
src/Audio/Sound.cpp
|
src/Audio/Sound.cpp
|
||||||
src/Camera/Camera2D.cpp
|
src/Camera/Camera2D.cpp
|
||||||
src/Camera/Camera3D.cpp
|
src/Camera/Camera3D.cpp
|
||||||
src/Controllers/Gamepad.cpp
|
src/Controllers/Gamepad.cpp
|
||||||
src/Controllers/Keyboard.cpp
|
src/Controllers/Keyboard.cpp
|
||||||
src/Controllers/Mouse.cpp
|
src/Controllers/Mouse.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(${LIB_NAME} STATIC ${SRC} ${HEADERS})
|
add_library(${LIB_NAME} STATIC ${SRC} ${HEADERS})
|
||||||
|
target_link_libraries(${LIB_NAME} raylib)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace RAY::Camera {
|
|||||||
//! @param target Camera target (rotation and zoom origin
|
//! @param target Camera target (rotation and zoom origin
|
||||||
//! @param rotation Camera rotation in degrees
|
//! @param rotation Camera rotation in degrees
|
||||||
//! @param zoom Camera zoom (scaling), should be 1.0f by default
|
//! @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
|
//! @brief A copy constructor
|
||||||
Camera2D(const Camera2D &) = default;
|
Camera2D(const Camera2D &) = default;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace RAY::Camera {
|
|||||||
//! @param up Camera up vector (rotation over its axis)
|
//! @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 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
|
//! @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
|
//! @brief A copy constructor
|
||||||
Camera3D(const Camera3D &) = default;
|
Camera3D(const Camera3D &) = default;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace RAY::Controller {
|
|||||||
bool isUp(Button);
|
bool isUp(Button);
|
||||||
|
|
||||||
//! @brief Returns true if controller is available
|
//! @brief Returns true if controller is available
|
||||||
bool isAvailable(Button);
|
bool isAvailable();
|
||||||
|
|
||||||
//! @brief Sets gamepad's id
|
//! @brief Sets gamepad's id
|
||||||
void setID(int id);
|
void setID(int id);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace RAY::Drawables::Drawables2D {
|
|||||||
//! @brief ADrawable constructor
|
//! @brief ADrawable constructor
|
||||||
//! @param poition position of top-left point
|
//! @param poition position of top-left point
|
||||||
//! @param Color Color of the color
|
//! @param Color Color of the color
|
||||||
ADrawable2D(const Vector2 &position, Color color);
|
ADrawable2D(const Vector2 &position, RAY::Color color);
|
||||||
//! @brief ADrawable constructor
|
//! @brief ADrawable constructor
|
||||||
//! @param x x-position of top-left point
|
//! @param x x-position of top-left point
|
||||||
//! @param y y-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;
|
ADrawable2D &setColor(const Color &color) const;
|
||||||
|
|
||||||
//! @brief Draw drawble on window
|
//! @brief Draw drawble on window
|
||||||
void drawOn(Window &);
|
virtual void drawOn(Window &) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! @brief Top-left position
|
//! @brief Top-left position
|
||||||
|
|||||||
@@ -8,19 +8,20 @@
|
|||||||
#ifndef IDRAWABLE_HPP_
|
#ifndef IDRAWABLE_HPP_
|
||||||
#define IDRAWABLE_HPP_
|
#define IDRAWABLE_HPP_
|
||||||
|
|
||||||
#include "Window.hpp"
|
namespace RAY
|
||||||
|
|
||||||
namespace RAY::Drawables
|
|
||||||
{
|
{
|
||||||
class IDrawable {
|
class Window;
|
||||||
public:
|
namespace Drawables {
|
||||||
virtual ~IDrawable() = 0;
|
class IDrawable {
|
||||||
|
public:
|
||||||
|
virtual ~IDrawable() = 0;
|
||||||
|
|
||||||
virtual void drawOn(Window &) = 0;
|
virtual void drawOn(RAY::Window &) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ bool RAY::Audio::Music::load(const std::string &path)
|
|||||||
bool RAY::Audio::Music::unload(void)
|
bool RAY::Audio::Music::unload(void)
|
||||||
{
|
{
|
||||||
UnloadMusicStream(_music);
|
UnloadMusicStream(_music);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RAY::Audio::Music::isPlayin(void)
|
bool RAY::Audio::Music::isPlayin(void)
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ bool RAY::Audio::Sound::load(const std::string &path)
|
|||||||
bool RAY::Audio::Sound::unload(void)
|
bool RAY::Audio::Sound::unload(void)
|
||||||
{
|
{
|
||||||
UnloadSound(_sound);
|
UnloadSound(_sound);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RAY::Audio::Sound::isPlayin(void)
|
bool RAY::Audio::Sound::isPlayin(void)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "Camera/Camera2D.hpp"
|
#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})
|
_camera({offset, target, rotation, zoom})
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
** Camera3D
|
** 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})
|
_camera({position, target, up, fovy, projection})
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ bool RAY::Controller::GamePad::isUp(RAY::Controller::GamePad::Button button)
|
|||||||
return IsGamepadButtonUp(this->_id, 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);
|
return IsGamepadAvailable(this->_id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -30,4 +30,5 @@ bool RAY::Font::load(const std::string &filename)
|
|||||||
bool RAY::Font::unload()
|
bool RAY::Font::unload()
|
||||||
{
|
{
|
||||||
UnloadFont(this->_font);
|
UnloadFont(this->_font);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,9 +37,11 @@ bool RAY::Model::load(const Mesh &mesh)
|
|||||||
bool RAY::Model::unload()
|
bool RAY::Model::unload()
|
||||||
{
|
{
|
||||||
UnloadModel(_model);
|
UnloadModel(_model);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RAY::Model::unloadKeepMeshes()
|
bool RAY::Model::unloadKeepMeshes()
|
||||||
{
|
{
|
||||||
UnloadModelKeepMeshes(_model);
|
UnloadModelKeepMeshes(_model);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,12 +6,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Window.hpp"
|
#include "Window.hpp"
|
||||||
#include "Mouse.hpp"
|
#include "Controllers/Mouse.hpp"
|
||||||
|
|
||||||
RAY::Window::Window(int width, int height, const std::string title, bool openNow):
|
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();
|
this->open();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ bool RAY::Window::cursorIsVisible(void) const
|
|||||||
|
|
||||||
Vector2 RAY::Window::getCursorPosition(void) const
|
Vector2 RAY::Window::getCursorPosition(void) const
|
||||||
{
|
{
|
||||||
return RAY::Mouse::getCursorPosition();
|
return RAY::Controller::Mouse::getCursorPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RAY::Window::setFPS(unsigned int fps)
|
void RAY::Window::setFPS(unsigned int fps)
|
||||||
@@ -113,7 +113,7 @@ void RAY::Window::setTitle(const std::string &title)
|
|||||||
this->_title = title;
|
this->_title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RAY::Window::draw(Drawables::IDrawable &drawable)
|
void RAY::Window::draw(RAY::Drawables::IDrawable &drawable)
|
||||||
{
|
{
|
||||||
drawable.drawOn(*this);
|
drawable.drawOn(*this);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user