diff --git a/includes/components/Sprite.hpp b/includes/components/Sprite.hpp index 8ee7a416..55423888 100644 --- a/includes/components/Sprite.hpp +++ b/includes/components/Sprite.hpp @@ -46,9 +46,9 @@ namespace sw { /// \return A reference to the sprite Sprite &setTexture(std::string name); - /// \brief Define a rect displayed applied on the texture + /// \brief Define a sub-rectangle of the texture displayed on the Sprite /// - /// \param rect Dimension of the rect + /// \param rect Dimension (width, height) of the rect /// \return A reference to the sprite Sprite &setTextureRect(sw::FloatRect rect); diff --git a/includes/components/SpriteAnimator.hpp b/includes/components/SpriteAnimator.hpp index 219d5b1d..de3f458a 100644 --- a/includes/components/SpriteAnimator.hpp +++ b/includes/components/SpriteAnimator.hpp @@ -18,14 +18,12 @@ namespace sw { class SW_MODULE_EXPORT SpriteAnimator : public sw::Component { public: - /// \brief Define the type of the animation enum AnimType { - ANIM_SPRITE, - ANIM_LINE + ANIM_SPRITE, // One animation on the whole texture + ANIM_LINE // One animation per line }; - public: /// \brief Default constructor /// /// \param gameObject Reference to the gameObject @@ -40,14 +38,14 @@ namespace sw { /// \brief Reset your animation (set on first frame) void reset(); - /// \brief Return a bool if the animation is playing + /// \brief Return a bool if the animation is currently playing /// /// \return bool [[nodiscard]] bool isPlaying() const; - /// \brief Set your animation in loop or not + /// \brief Define if your animation loop /// - /// \param loop + /// \param loop boolean /// \param delay delay between two animation /// \return reference to your sprite SpriteAnimator SpriteAnimator &setLoop(bool loop, float delay = 0); @@ -63,13 +61,13 @@ namespace sw { /// \brief Define the displayed rect on your texture /// - /// \param rect + /// \param rect Rect's size (width, height) /// \return reference to your sprite SpriteAnimator SpriteAnimator &setRect(sw::Vector2u rect); /// \brief Define the speed (number of frame per second) of your animation /// - /// \param fps + /// \param fps float /// \return reference to your sprite SpriteAnimator &setFPS(float fps); @@ -85,8 +83,7 @@ namespace sw { /// \return reference to your sprite SpriteAnimator &setPlayOnStart(bool value); - - /// \brief Get id the animation is set to loop + /// \brief Get if the animation loop /// /// \return bool [[nodiscard]]const bool &isLoop() const; @@ -103,7 +100,7 @@ namespace sw { /// \brief Get the speed of your animation /// - /// \return float In Frame per second + /// \return float Frame per second [[nodiscard]]const float &getFPS() const; /// \brief Get the type of your animation diff --git a/includes/core/Core.hpp b/includes/core/Core.hpp index abe36f28..93f2eb3d 100644 --- a/includes/core/Core.hpp +++ b/includes/core/Core.hpp @@ -10,7 +10,7 @@ #include "core/window/Window.hpp" #include "scene/sceneManager/SceneManager.hpp" #include "resources/ResourcesManager.hpp" -#include "utils/Chronos.hpp" +#include "utils/Chrono.hpp" namespace sw { diff --git a/includes/managers/SpriteAnimatorManager.hpp b/includes/managers/SpriteAnimatorManager.hpp index 71832b7d..81191242 100644 --- a/includes/managers/SpriteAnimatorManager.hpp +++ b/includes/managers/SpriteAnimatorManager.hpp @@ -26,12 +26,17 @@ namespace sw { private: /// \brief Update Animation following rules defined for the Type - /// sw::Animator::ANIM_LINE + /// sw::SpriteAnimator::ANIM_LINE /// /// \param animator Reference to the animator /// \param current_time get total time static void animLine(SpriteAnimator &animator, double ¤t_time); + /// \brief Update Animation following rules defined for the Type + /// sw::SpriteAnimator::ANIM_SPRITE + /// + /// \param animator Reference to the animator + /// \param current_time get total time static void animSprite(SpriteAnimator &animator, double ¤t_time); diff --git a/includes/utils/Chronos.hpp b/includes/utils/Chrono.hpp similarity index 57% rename from includes/utils/Chronos.hpp rename to includes/utils/Chrono.hpp index 9574333d..b7be0622 100644 --- a/includes/utils/Chronos.hpp +++ b/includes/utils/Chrono.hpp @@ -1,38 +1,37 @@ /* ** ShipWreck Engine v0.1, graphical library made to create games -** Current file: Chrono.hpp +** Current file: chrono.hpp */ -#ifndef SHIPWRECK_ENGINE_CHRONOS_HPP -#define SHIPWRECK_ENGINE_CHRONOS_HPP +#ifndef SHIPWRECK_ENGINE_CHRONO_HPP +#define SHIPWRECK_ENGINE_CHRONO_HPP #include namespace sw { - class Chronos { + class Chrono { public: enum State { - Wait, Lauch + WAIT, LAUNCH }; - /// @brief Default @c Constructor of a @b Chrono. + /// @brief Default Constructor /// You can define the constructor status, whether or not it should /// be run when created. /// - /// @param state 'Lauch' if you want to start the chrono directly after - /// have been created, 'Wait' otherwise. - explicit Chronos(State state = Wait); + /// @param state 'LAUNCH' if you want to start the chrono directly after + /// have been created, 'WAIT' otherwise. + explicit Chrono(State state = WAIT); - /// @brief Default @c Destructor of a @b Chrono. - ~Chronos() = default; + /// @brief Default Destructor of a chrono. + ~Chrono() = default; - /// @brief Start the @b Chrono. + /// @brief Start the chrono. void start(); - /// @brief Stop the @b Chrono. Then, if you try get the time, it will - /// not change. + /// @brief Stop the chrono. void stop(); /// @brief Make a checkpoint. Then, you can either get the time since @@ -44,40 +43,39 @@ namespace sw { /// @return The time in second. double getElapsedTime() const; - /// @brief Get the time since the start of the @b Chrono - /// (call to the start function). + /// @brief Get the time since the start of the chrono (call to the start function). /// /// @return The time in second. double getTotalTime() const; - /// @brief Get the status of the @b Chrono. + /// @brief Get the status of the chrono. /// /// @return True if it is running, false otherwise. [[nodiscard]] bool isRunning() const; private: - /// @brief The start time point of a @b Chrono. + /// @brief The start time point of a chrono. /// It is set at all call to the start method. std::chrono::time_point m_start; - /// @brief The tour time point of a @b Chrono. + /// @brief The tour time point of a chrono. /// It is set at all call to the tour method. std::chrono::time_point m_tour; - /// @brief The last time point of a @b Chrono. It is corresponding to - /// either the current time or the time you stoped or paused the @b Chrono. + /// @brief The last time point of a chrono. It is corresponding to + /// either the current time or the time you stoped or paused the chrono. /// It is set when the time is get. mutable std::chrono::time_point m_end; /// @brief The status of the chrono. /// If it is true, the chrono is running. If it is false, the chrono - /// is either paused or stoped. + /// is either paused or stopped. bool m_isRunning; - }; // class Chronos + }; // class Chrono -#include "Chronos.inl" +#include "Chrono.inl" } // SW -#endif //SHIPWRECK_ENGINE_CHRONOS_HPP +#endif //SHIPWRECK_ENGINE_CHRONO_HPP diff --git a/includes/utils/Chronos.inl b/includes/utils/Chrono.inl similarity index 71% rename from includes/utils/Chronos.inl rename to includes/utils/Chrono.inl index a494ab9e..5aa48bb4 100644 --- a/includes/utils/Chronos.inl +++ b/includes/utils/Chrono.inl @@ -1,18 +1,18 @@ /* ** ShipWreck Engine v0.1, graphical library made to create games -** Current file: Chronos.inl +** Current file: Chrono.inl */ -inline sw::Chronos::Chronos(State state) : +inline sw::Chrono::Chrono(State state) : m_isRunning(false) { - if (state == Lauch) { + if (state == LAUNCH) { m_isRunning = true; start(); } } -inline void sw::Chronos::start() +inline void sw::Chrono::start() { m_start = std::chrono::steady_clock::now(); m_end = m_start; @@ -20,18 +20,18 @@ inline void sw::Chronos::start() m_isRunning = true; } -inline void sw::Chronos::stop() +inline void sw::Chrono::stop() { m_end = std::chrono::steady_clock::now(); m_isRunning = false; } -inline void sw::Chronos::tour() +inline void sw::Chrono::tour() { m_tour = std::chrono::steady_clock::now(); } -inline double sw::Chronos::getElapsedTime() const +inline double sw::Chrono::getElapsedTime() const { if (m_isRunning) m_end = std::chrono::steady_clock::now(); @@ -39,7 +39,7 @@ inline double sw::Chronos::getElapsedTime() const return (step / 1000); } -inline double sw::Chronos::getTotalTime() const +inline double sw::Chrono::getTotalTime() const { if (m_isRunning) m_end = std::chrono::steady_clock::now(); @@ -47,7 +47,7 @@ inline double sw::Chronos::getTotalTime() const return (step / 1000); } -inline bool sw::Chronos::isRunning() const +inline bool sw::Chrono::isRunning() const { return (m_isRunning); } \ No newline at end of file diff --git a/includes/utils/Shader.hpp b/includes/utils/Shader.hpp index e5da39dd..09b33c0c 100644 --- a/includes/utils/Shader.hpp +++ b/includes/utils/Shader.hpp @@ -15,22 +15,6 @@ namespace sw { class SW_MODULE_EXPORT Shader { - private: - unsigned int m_id; - ShaderFile m_fragment; - ShaderFile m_vertex; - std::string m_fragmentPath; - std::string m_vertexPath; - int m_success; - char m_info[512]; - bool m_loaded; - - /// @brief Get location of a variable from a shader - /// - /// \param name name of the uniform variable - /// \return location as int - int getUniLocation(std::string &name) const; - public: Shader(Shader const &) = delete; Shader(Shader &&) = delete; @@ -110,6 +94,22 @@ namespace sw { /// @brief update Opengl shader information void update(); + + private: + unsigned int m_id; + ShaderFile m_fragment; + ShaderFile m_vertex; + std::string m_fragmentPath; + std::string m_vertexPath; + int m_success; + char m_info[512]; + bool m_loaded; + + /// @brief Get location of a variable from a shader + /// + /// \param name name of the uniform variable + /// \return location as int + int getUniLocation(std::string &name) const; }; // class Shader } // SW diff --git a/sources/core/Core.cpp b/sources/core/Core.cpp index 706db150..34aa08b6 100644 --- a/sources/core/Core.cpp +++ b/sources/core/Core.cpp @@ -13,8 +13,8 @@ SW_MODULE_EXPORT sw::SceneManager sw::Core::m_sceneManager{}; SW_MODULE_EXPORT sw::ResourcesManager sw::Core::m_resourceManager{}; -SW_MODULE_EXPORT sw::Chronos sw::Core::m_chronos(sw::Chronos::Wait); -SW_MODULE_EXPORT sw::Chronos sw::Core::m_chronosWindow(sw::Chronos::Wait); +SW_MODULE_EXPORT sw::Chronos sw::Core::m_chronos(sw::Chronos::WAIT); +SW_MODULE_EXPORT sw::Chronos sw::Core::m_chronosWindow(sw::Chronos::WAIT); SW_MODULE_EXPORT double sw::Core::m_frameRate{1.0/60.0}; void sw::Core::Start()