-
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: Merge pull request #48 from G-Epitech/47-add-ncurse
feat: add ncurse
- Loading branch information
Showing
23 changed files
with
961 additions
and
13 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 |
---|---|---|
|
@@ -20,3 +20,4 @@ lib | |
*.gcda | ||
*.o | ||
scores.txt | ||
*.zip |
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,3 +1,3 @@ | ||
║═ | ||
|- | ||
~~~~ | ||
╝╚╗╔ | ||
~~~~ |
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,3 +1,3 @@ | ||
║═ | ||
|- | ||
~~~~ | ||
╝╚╗╔ | ||
~~~~ |
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 |
---|---|---|
@@ -1,2 +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 |
---|---|---|
@@ -1,5 +1,26 @@ | ||
project(ncurses) | ||
add_library(ncurses SHARED | ||
export.cpp | ||
src/GraphicsProvider.cpp | ||
src/GraphicsProvider.hpp | ||
src/window/Window.cpp | ||
src/window/Window.hpp | ||
src/window/EventsHandler.cpp | ||
src/window/EventsHandler.hpp | ||
src/sound/Sound.cpp | ||
src/sound/Sound.hpp | ||
src/texture/Texture.cpp | ||
src/texture/Texture.hpp | ||
src/font/Font.cpp | ||
src/font/Font.hpp | ||
src/window/Renderer.cpp | ||
src/window/Renderer.hpp | ||
) | ||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../common PRIVATE) | ||
|
||
target_include_directories(ncurses PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src) | ||
target_include_directories(ncurses PUBLIC ${CMAKE_CURRENT_LIST_DIR}/../..) | ||
target_include_directories(ncurses PUBLIC ${CMAKE_CURRENT_LIST_DIR}/..) | ||
|
||
find_package(Curses REQUIRED) | ||
target_link_libraries(ncurses ${CURSES_LIBRARIES}) |
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,52 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** GraphicsProvider.cpp | ||
** File description: | ||
** GraphicsProvider class | ||
*/ | ||
|
||
#include <iostream> | ||
#include "GraphicsProvider.hpp" | ||
#include "utils/compiler.hpp" | ||
#include "window/Window.hpp" | ||
#include "font/Font.hpp" | ||
#include "sound/Sound.hpp" | ||
#include "texture/Texture.hpp" | ||
|
||
using namespace shared::graphics; | ||
using namespace arcade::graphics::ncurses; | ||
|
||
const shared::graphics::GraphicsManifest GraphicsProvider::_manifest = { | ||
.name = "ncurses", | ||
.description = "NCURSES Library", | ||
.version = "1.0", | ||
.authors = { | ||
{ | ||
.name = "Yann Masson", | ||
.email = "yann.masson@epitech.eu", | ||
.website = "yannmasson.fr" | ||
} | ||
} | ||
}; | ||
|
||
GraphicsProvider::GraphicsProvider() = default; | ||
|
||
const GraphicsManifest &GraphicsProvider::getManifest() const noexcept { | ||
return GraphicsProvider::_manifest; | ||
} | ||
|
||
std::unique_ptr<IWindow> GraphicsProvider::createWindow(const IWindow::WindowInitProps &props) { | ||
return std::make_unique<window::Window>(props); | ||
} | ||
|
||
std::shared_ptr<ISound> GraphicsProvider::createSound(const std::string &path) { | ||
return std::make_shared<sound::Sound>(path); | ||
} | ||
|
||
std::shared_ptr<ITexture> GraphicsProvider::createTexture(unused const std::string &bin, const std::string &ascii) { | ||
return std::make_shared<texture::Texture>(ascii); | ||
} | ||
|
||
std::shared_ptr<IFont> GraphicsProvider::createFont(const std::string &path) { | ||
return std::make_shared<font::Font>(path); | ||
} |
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,68 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** GraphicsProvider.hpp | ||
** File description: | ||
** GraphicsProvider class | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "shared/graphics/ITexture.hpp" | ||
#include "shared/graphics/IGraphicsProvider.hpp" | ||
|
||
using namespace shared::graphics; | ||
|
||
namespace arcade::graphics::ncurses | ||
{ | ||
class GraphicsProvider; | ||
} | ||
|
||
class arcade::graphics::ncurses::GraphicsProvider : public shared::graphics::IGraphicsProvider | ||
{ | ||
public: | ||
GraphicsProvider(); | ||
~GraphicsProvider() override = default; | ||
|
||
/** | ||
* @brief Get the manifest of the graphics library | ||
* | ||
* @return Manifest of the graphics library | ||
*/ | ||
const shared::graphics::GraphicsManifest &getManifest() const noexcept override; | ||
|
||
/** | ||
* @brief Create a renderer object | ||
* | ||
* @param windowProps Properties to use to init the window | ||
* @return Created renderer object | ||
*/ | ||
std::unique_ptr<IWindow> createWindow(const IWindow::WindowInitProps &windowProps) override; | ||
|
||
/** | ||
* @brief Create a sound object | ||
* | ||
* @param path Path of the sound file | ||
* @return Created sound object | ||
*/ | ||
std::shared_ptr<ISound> createSound(const std::string &path) override; | ||
|
||
/** | ||
* @brief Create a texture object | ||
* | ||
* @param bin Path of the binary texture file | ||
* @param ascii Path of the ascii texture file | ||
* @return Created texture object | ||
*/ | ||
std::shared_ptr<ITexture> createTexture(const std::string &bin, const std::string &ascii) override; | ||
|
||
/** | ||
* @brief Create a font object | ||
* | ||
* @param path Path of the font file | ||
* @return Created font object | ||
*/ | ||
std::shared_ptr<IFont> createFont(const std::string &path) override; | ||
|
||
protected: | ||
static const shared::graphics::GraphicsManifest _manifest; | ||
}; |
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,13 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** arcade | ||
** File description: | ||
** Font.cpp | ||
*/ | ||
|
||
#include "Font.hpp" | ||
#include "common/exceptions/FontException.hpp" | ||
|
||
using namespace arcade::graphics::ncurses::font; | ||
|
||
Font::Font(const std::string &path) {} |
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,22 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** arcade | ||
** File description: | ||
** Font.hpp | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <string> | ||
#include "shared/graphics/IFont.hpp" | ||
#include "utils/compiler.hpp" | ||
|
||
namespace arcade::graphics::ncurses::font { | ||
class Font; | ||
} | ||
|
||
class arcade::graphics::ncurses::font::Font : public shared::graphics::IFont { | ||
public: | ||
explicit Font(const std::string &path); | ||
~Font() 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,32 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** arcade | ||
** File description: | ||
** Sound.cpp | ||
*/ | ||
|
||
#include "Sound.hpp" | ||
#include "common/exceptions/SoundException.hpp" | ||
|
||
using namespace arcade::graphics::ncurses::sound; | ||
using namespace arcade::graphics::common::exceptions; | ||
|
||
Sound::Sound(const std::string &path, SoundState state) {} | ||
|
||
Sound::SoundVolume Sound::getVolume() const { | ||
return 100; | ||
} | ||
|
||
void Sound::setVolume(SoundVolume volume) {} | ||
|
||
void Sound::setState(SoundState state) {} | ||
|
||
Sound::SoundState Sound::getState() const { | ||
return SoundState::STOP; | ||
} | ||
|
||
void Sound::setLoopState(bool loop) {} | ||
|
||
bool Sound::getLoopState() const { | ||
return false; | ||
} |
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,31 @@ | ||
/* | ||
** EPITECH PROJECT, 2024 | ||
** arcade | ||
** File description: | ||
** Sound.hpp | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <string> | ||
|
||
#include "shared/graphics/ISound.hpp" | ||
|
||
namespace arcade::graphics::ncurses::sound { | ||
class Sound; | ||
} | ||
|
||
class arcade::graphics::ncurses::sound::Sound : public shared::graphics::ISound { | ||
public: | ||
explicit Sound(const std::string &path, SoundState state = STOP); | ||
~Sound() override = default; | ||
|
||
SoundVolume getVolume() const override; | ||
SoundState getState() const override; | ||
void setVolume(SoundVolume volume) override; | ||
void setState(SoundState state) override; | ||
void setLoopState(bool loop) override; | ||
bool getLoopState() const override; | ||
|
||
private: | ||
}; |
Oops, something went wrong.