-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from G-Epitech/rc-add-sfml-graphic-library
feat(graphics): add sfml graphic library
- Loading branch information
Showing
59 changed files
with
1,995 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,6 @@ | |
|
||
class Loader { | ||
public: | ||
|
||
/** | ||
* @brief Construct a new Loader object | ||
*/ | ||
|
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
add_subdirectory(ncurses) | ||
#add_subdirectory(ncurses) | ||
add_subdirectory(sfml) |
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,3 @@ | ||
add_subdirectory(events) | ||
add_subdirectory(exceptions) | ||
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/../..) |
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,3 @@ | ||
add_subdirectory(mouse) | ||
add_subdirectory(key) | ||
add_subdirectory(window) |
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,46 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** arcade | ||
** File description: | ||
** AKeyEvent.hpp | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "shared/graphics/events/IKeyEvent.hpp" | ||
|
||
using namespace shared::graphics::events; | ||
|
||
namespace arcade::graphics::common::events { | ||
template<EventType T> | ||
concept KeyEventType = T == EventType::KEY_PRESS || T == EventType::KEY_RELEASE; | ||
|
||
template<EventType T> requires KeyEventType<T> | ||
class AKeyEvent; | ||
} | ||
|
||
using namespace arcade::graphics::common::events; | ||
|
||
template<EventType T> requires KeyEventType<T> | ||
class arcade::graphics::common::events::AKeyEvent: public IKeyEvent { | ||
public: | ||
~AKeyEvent() override = default; | ||
|
||
EventType getType() const noexcept override { | ||
return T; | ||
} | ||
|
||
const KeyCode getKeyCode() const noexcept override { | ||
return _code; | ||
} | ||
|
||
const KeyType getKeyType() const noexcept override { | ||
return _keyType; | ||
} | ||
|
||
protected: | ||
AKeyEvent(const KeyType keyType, const KeyCode code) : _keyType(keyType), _code(code) {}; | ||
|
||
const KeyType _keyType; | ||
const KeyCode _code; | ||
}; |
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,6 @@ | ||
target_sources(${PROJECT_NAME} PUBLIC | ||
AKeyEvent.hpp | ||
KeyPressEvent.hpp | ||
KeyReleaseEvent.hpp | ||
key.hpp | ||
) |
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,21 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** arcade | ||
** File description: | ||
** KeyPressEvent.hpp | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "AKeyEvent.hpp" | ||
|
||
namespace arcade::graphics::common::events { | ||
class KeyPressEvent; | ||
} | ||
|
||
class arcade::graphics::common::events::KeyPressEvent: public AKeyEvent<EventType::KEY_PRESS> { | ||
public: | ||
explicit KeyPressEvent(const KeyType type, const KeyCode code = { .character = 0 }) | ||
: AKeyEvent(type, code) {}; | ||
~KeyPressEvent() override = default; | ||
}; |
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,20 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** arcade | ||
** File description: | ||
** KeyPressEvent.hpp | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "AKeyEvent.hpp" | ||
|
||
namespace arcade::graphics::common::events { | ||
class KeyReleaseEvent; | ||
} | ||
|
||
class arcade::graphics::common::events::KeyReleaseEvent: public AKeyEvent<EventType::KEY_RELEASE> { | ||
public: | ||
KeyReleaseEvent(const KeyType type, const KeyCode code) : AKeyEvent(type, code) {}; | ||
~KeyReleaseEvent() override = default; | ||
}; |
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,11 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** arcade | ||
** File description: | ||
** mouse.hpp | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "KeyPressEvent.hpp" | ||
#include "KeyReleaseEvent.hpp" |
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,52 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** arcade | ||
** File description: | ||
** AMouseEvent.hpp | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "AMouseEvent.hpp" | ||
#include "shared/graphics/events/IMouseButtonEvent.hpp" | ||
|
||
using namespace shared::graphics::events; | ||
using namespace shared::types; | ||
using namespace arcade::graphics::common::events; | ||
|
||
namespace arcade::graphics::common::events { | ||
template<EventType T> | ||
concept MouseButtonEventType = T == EventType::MOUSE_BTN_PRESS || T == EventType::MOUSE_BTN_RELEASE; | ||
|
||
template<EventType T> requires MouseButtonEventType<T> | ||
class AMouseButtonEvent; | ||
} | ||
|
||
template<EventType T> requires MouseButtonEventType<T> | ||
class arcade::graphics::common::events::AMouseButtonEvent: public AMouseEvent<T>, public virtual IMouseButtonEvent { | ||
public: | ||
/** | ||
* @brief Construct a new AMouseButtonEvent object | ||
* | ||
* @param pos Position of the mouse | ||
* @param button Targeted button | ||
*/ | ||
explicit AMouseButtonEvent( | ||
Vector2i pos, | ||
MouseButton button | ||
): AMouseEvent<T>(pos), _button(button) {}; | ||
|
||
~AMouseButtonEvent() override = default; | ||
|
||
/** | ||
* @brief Get the button object | ||
* | ||
* @return Target button type | ||
*/ | ||
const MouseButton getButton() const noexcept override { | ||
return _button; | ||
} | ||
|
||
protected: | ||
const MouseButton _button; | ||
}; |
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,42 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** arcade | ||
** File description: | ||
** AMouseEvent.hpp | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "shared/graphics/events/IMouseEvent.hpp" | ||
|
||
using namespace shared::graphics::events; | ||
using namespace shared::types; | ||
|
||
namespace arcade::graphics::common::events { | ||
template <EventType T> | ||
class AMouseEvent; | ||
} | ||
|
||
template <EventType T> | ||
class arcade::graphics::common::events::AMouseEvent: public virtual IMouseEvent { | ||
public: | ||
~AMouseEvent() override = default; | ||
|
||
EventType getType() const noexcept override { | ||
return T; | ||
} | ||
|
||
const Vector2i getPosition() const noexcept override { | ||
return _pos; | ||
} | ||
|
||
protected: | ||
/** | ||
* @brief Construct a new AMouseEvent object | ||
* | ||
* @param pos Position of the mouse | ||
*/ | ||
explicit AMouseEvent(Vector2i pos): _pos(pos){}; | ||
|
||
Vector2i _pos; | ||
}; |
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,8 @@ | ||
target_sources(${PROJECT_NAME} PUBLIC | ||
AMouseEvent.hpp | ||
MouseButtonPressEvent.hpp | ||
MouseButtonReleaseEvent.hpp | ||
AMouseButtonEvent.hpp | ||
MouseMoveEvent.hpp | ||
mouse.hpp | ||
) |
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,24 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** arcade | ||
** File description: | ||
** MouseButtonPressEvent.hpp | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "AMouseButtonEvent.hpp" | ||
|
||
using namespace shared::graphics::events; | ||
using namespace arcade::graphics::common::events; | ||
|
||
namespace arcade::graphics::common::events { | ||
class MouseButtonPressEvent; | ||
}; | ||
|
||
class arcade::graphics::common::events::MouseButtonPressEvent : | ||
public AMouseButtonEvent<EventType::MOUSE_BTN_PRESS> { | ||
public: | ||
MouseButtonPressEvent(Vector2i pos, MouseButton button) : AMouseButtonEvent(pos, button){}; | ||
~MouseButtonPressEvent() override = default; | ||
}; |
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,23 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** arcade | ||
** File description: | ||
** MouseButtonPressEvent.hpp | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "AMouseButtonEvent.hpp" | ||
|
||
using namespace shared::graphics::events; | ||
using namespace arcade::graphics::common::events; | ||
|
||
namespace arcade::graphics::common::events { | ||
class MouseButtonReleaseEvent; | ||
}; | ||
|
||
class arcade::graphics::common::events::MouseButtonReleaseEvent : | ||
public AMouseButtonEvent<EventType::MOUSE_BTN_RELEASE> { | ||
public: | ||
using AMouseButtonEvent::AMouseButtonEvent; | ||
}; |
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,24 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** arcade | ||
** File description: | ||
** AMouseEvent.hpp | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "AMouseEvent.hpp" | ||
|
||
using namespace shared::graphics::events; | ||
using namespace shared::types; | ||
|
||
namespace arcade::graphics::common::events { | ||
class MouseMoveEvent; | ||
} | ||
|
||
class arcade::graphics::common::events::MouseMoveEvent: public AMouseEvent<EventType::MOUSE_MOVE> { | ||
public: | ||
explicit MouseMoveEvent(const Vector2i pos): AMouseEvent<EventType::MOUSE_MOVE>(pos) {} | ||
|
||
~MouseMoveEvent() override = default; | ||
}; |
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,12 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** arcade | ||
** File description: | ||
** mouse.hpp | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "MouseButtonPressEvent.hpp" | ||
#include "MouseButtonReleaseEvent.hpp" | ||
#include "MouseMoveEvent.hpp" |
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,5 @@ | ||
target_sources(${PROJECT_NAME} PUBLIC | ||
WindowCloseEvent.hpp | ||
WindowResizeEvent.hpp | ||
window.hpp | ||
) |
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,27 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** arcade | ||
** File description: | ||
** WindowCloseEvent.hpp | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "shared/graphics/events/IEvent.hpp" | ||
|
||
using namespace shared::graphics::events; | ||
|
||
namespace arcade::graphics::common::events { | ||
class WindowCloseEvent; | ||
} | ||
|
||
|
||
class arcade::graphics::common::events::WindowCloseEvent: public IEvent { | ||
public: | ||
WindowCloseEvent() = default; | ||
~WindowCloseEvent() override = default; | ||
|
||
EventType getType() const noexcept override { | ||
return WINDOW_CLOSE; | ||
} | ||
}; |
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,27 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** arcade | ||
** File description: | ||
** WindowCloseEvent.hpp | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "shared/graphics/events/IEvent.hpp" | ||
|
||
using namespace shared::graphics::events; | ||
|
||
namespace arcade::graphics::common::events { | ||
class WindowResizeEvent; | ||
} | ||
|
||
|
||
class arcade::graphics::common::events::WindowResizeEvent: public IEvent { | ||
public: | ||
WindowResizeEvent() = default; | ||
~WindowResizeEvent() override = default; | ||
|
||
EventType getType() const noexcept override { | ||
return WINDOW_RESIZE; | ||
} | ||
}; |
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,11 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** arcade | ||
** File description: | ||
** window.hpp | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "WindowCloseEvent.hpp" | ||
#include "WindowResizeEvent.hpp" |
Oops, something went wrong.