From 87849f079fdb50417ca56b499d56d54cf9662228 Mon Sep 17 00:00:00 2001 From: Yannjoubert Date: Fri, 10 Feb 2023 19:16:43 +0400 Subject: [PATCH] doxygen --- include/Components/Bullets.hpp | 41 +++++++++++++++++++ include/Engine/Audio.hpp | 5 +++ include/Engine/Draw.hpp | 34 ++++++++++++++++ include/Engine/Event.hpp | 54 ++++++++++++++++++++++++- include/Engine/StateManager.hpp | 12 ++++++ include/Engine/Window.hpp | 59 +++++++++++++++++++++++++++- include/Entities/Actors.hpp | 1 - include/Entities/EntitiesManager.hpp | 17 +++++++- 8 files changed, 217 insertions(+), 6 deletions(-) diff --git a/include/Components/Bullets.hpp b/include/Components/Bullets.hpp index 848ed64..5880422 100644 --- a/include/Components/Bullets.hpp +++ b/include/Components/Bullets.hpp @@ -25,9 +25,38 @@ namespace rtype::components { public: Bullets(); ~Bullets(); + /** + * @brief Create a Bullet object + * + * @param pos + * @return sf::CircleShape + */ sf::CircleShape CreateBullet(sf::Vector2f pos); + /** + * @brief Call it to make your entity able to shoot bullet + * + * @param id + * @param sprite + * @return true + * @return false + */ bool ShootBullet(int id, sf::Sprite sprite); + /** + * @brief Function to call CreateBullet for the server + * + * @param id + * @param sprite + * @return true + * @return false + */ bool ServerShootBullet(int id, sf::Sprite sprite); + /** + * @brief Make collision between Bullet and an Entity + * + * @param bounds + * @return true + * @return false + */ bool collided(sf::FloatRect bounds) { for (auto& ammo : this->bullets_list) @@ -40,7 +69,19 @@ namespace rtype::components { return false; }; + /** + * @brief Draw all the bullets + * + * @param win + */ void drawBullets(sf::Window &win); + /** + * @brief Update the frame for the bullet + * + * @param bounds + * @return true + * @return false + */ bool update(sf::FloatRect bounds); // void SetBullets(float radius, sf::Vector2f velocity, float maxSpeed); diff --git a/include/Engine/Audio.hpp b/include/Engine/Audio.hpp index afd116c..43ffe82 100644 --- a/include/Engine/Audio.hpp +++ b/include/Engine/Audio.hpp @@ -16,6 +16,11 @@ namespace rtype::engine { public: Audio(); ~Audio(); + /** + * @brief Create a Sound object + * + * @param audio + */ void CreateSound(sf::Sound audio); protected: diff --git a/include/Engine/Draw.hpp b/include/Engine/Draw.hpp index ac7a6e5..cb88b81 100644 --- a/include/Engine/Draw.hpp +++ b/include/Engine/Draw.hpp @@ -16,10 +16,44 @@ namespace rtype::engine { public: Draw(); ~Draw(); + /** + * @brief Create a rectangle + * + * @param height + * @param width + * @param pos + * @return sf::RectangleShape + */ sf::RectangleShape DrawRectangle(int height, int width, sf::Vector2f pos); + /** + * @brief Create a sphere + * + * @param radius + * @return sf::CircleShape + */ sf::CircleShape DrawSphere(int radius); + /** + * @brief Set the Texture To Object object + * + * @param texture + * @param posRect + */ void SetTextureToObject(sf::Texture texture, sf::IntRect posRect); + /** + * @brief Set the Texture To Circle object + * + * @param circle + * @param texture + * @param posRect + */ void SetTextureToCircle(sf::CircleShape circle, sf::Texture texture, sf::IntRect posRect); + /** + * @brief Set the Texture To Rectangle object + * + * @param rectangle + * @param texture + * @param posRect + */ void SetTextureToRectangle(sf::RectangleShape rectangle, sf::Texture texture, sf::IntRect posRect); protected: diff --git a/include/Engine/Event.hpp b/include/Engine/Event.hpp index de0e6b3..8979e12 100644 --- a/include/Engine/Event.hpp +++ b/include/Engine/Event.hpp @@ -34,24 +34,74 @@ namespace rtype::engine { class Event { public: + /** + * @brief Init a client to server + * + * @param clt + */ Event(sk::Skaldi *clt); ~Event(); void handleEvent(); void handleInput(); void update(); + /** + * @brief Check the input of the player and return the appropriate action + * + * @param obj_pos + * @param action + * @return EventType + */ EventType ServerPlayerAction(sf::Transformable &obj_pos, EventType action); + /** + * @brief Make an object movable with the keyboard + * + * @param obj_pos + */ void MakeObjectMovable(sf::Transformable &obj_pos); + /** + * @brief Make an object clickable + * + * @param button + */ void MakeObjectClickable(sf::RectangleShape button); + /** + * @brief Make a Sprite movable with the keyboard + * + * @param asset + */ void MakeSpriteMovable(sf::Sprite &asset); //player move on input + /** + * @brief Make a Sprite from an another clien movable with the keyboard + * + * @param asset + */ void MakeSpriteMovable_Bis(sf::Sprite &asset); //player move on input test only + /** + * @brief Get the Mouse Pos object + * + * @param event + */ void GetMousePos(sf::Event event); + /** + * @brief Get the Mouse Pressed object + * + * @param event + */ void GetMousePressed(sf::Event event); - + /** + * @brief Get the Client Buffer object + * + * @return std::string + */ std::string getClientBuffer() { return this->clt->client->getBuffer(); } - + /** + * @brief Send a message to the serveur + * + * @param msg + */ void sendMessage(std::string msg) { this->clt->client->send(msg); diff --git a/include/Engine/StateManager.hpp b/include/Engine/StateManager.hpp index 5d7bd46..4052c3c 100644 --- a/include/Engine/StateManager.hpp +++ b/include/Engine/StateManager.hpp @@ -22,8 +22,20 @@ namespace rtype::engine { public: StateManager(); ~StateManager(); + /** + * @brief Create a menu + * + */ void Menu(void); + /** + * @brief Launch the game + * + */ void GameRun(void); + /** + * @brief Init a end game + * + */ void End(void); protected: diff --git a/include/Engine/Window.hpp b/include/Engine/Window.hpp index 2ac51cb..4bcaafd 100644 --- a/include/Engine/Window.hpp +++ b/include/Engine/Window.hpp @@ -16,17 +16,68 @@ namespace rtype::engine { public: Window(); ~Window(); + /** + * @brief Display the window with his event + * + * @return int + */ int DisplayWindow(void); + /** + * @brief Draw the window + * + * @return int + */ int DrawWindow(void) {this->window.display(); return 0;}; + /** + * @brief Use it to update the event + * + * @return true + * @return false + */ bool UpdateEvent(void); + /** + * @brief Check if the window is open + * + * @return true + * @return false + */ bool IsOpen(void); + /** + * @brief Check if the window is close + * + * @return true + * @return false + */ bool IsClosed(void); + /** + * @brief Check the event type + * + * @return true + * @return false + */ bool HandleEvent(const sf::Event::EventType &type); + /** + * @brief Create a Window object + * + * @param mode + * @param name + */ void CreateWindow(sf::VideoMode mode, std::string name); - + /** + * @brief Clear the window + * + */ void clear() { this->window.clear(sf::Color::Black); }; + /** + * @brief Close the window + * + */ void close() {this->window.close();}; + /** + * @brief Init the clock for the game + * + */ void t_clock() { this->winTimer = this->winClock.getElapsedTime(); @@ -34,7 +85,11 @@ namespace rtype::engine { if (this->winTimer.asSeconds() > 1.f) winClock.restart(); }; - + /** + * @brief Draw the entity + * + * @param en + */ void Draw(sf::Drawable &en) { this->window.draw(en); diff --git a/include/Entities/Actors.hpp b/include/Entities/Actors.hpp index 15b55ed..bd1375c 100644 --- a/include/Entities/Actors.hpp +++ b/include/Entities/Actors.hpp @@ -13,7 +13,6 @@ class Actors : public Entity public: Actors(); ~Actors(); - std::string getTag() {return this->tag} std::string getName() int getID(); diff --git a/include/Entities/EntitiesManager.hpp b/include/Entities/EntitiesManager.hpp index 6d2c8d2..e21bfef 100644 --- a/include/Entities/EntitiesManager.hpp +++ b/include/Entities/EntitiesManager.hpp @@ -37,6 +37,11 @@ namespace rtype::entities { */ void NewEntity(std::string fpath, sf::Vector2f pos, sf::Vector2f scale); + /** + * @brief return a ID + * + * @return std::list + */ std::list getIDs() { return IDs; }; @@ -44,10 +49,20 @@ namespace rtype::entities { void setPId(int id) { this->pId = id;} int8_t getPId() {return this->pId;} + /** + * @brief Get the Entities List object + * + * @return std::array + */ std::array getEntitiesList() { return entities; }; - + /** + * @brief Get the Sprite object and his ID + * + * @param id + * @return sf::Sprite& + */ sf::Sprite &getSprite(int8_t id) { //check if valid return this->entities[id];