docs: documentation of all game object classes

This commit is contained in:
theoleuthardt 2025-03-13 14:29:56 +01:00
parent d8e55e1370
commit 06d5c33258
3 changed files with 184 additions and 0 deletions

View file

@ -2,17 +2,55 @@
#define CACTUS_H
#include "raylib.h"
/**
* @brief The Cactus class represents an obstacle in the game.
*/
class Cactus {
public:
/**
* @brief Construct a new Cactus object
* @param texture The texture for the cactus
* @param x The x-coordinate of the cactus
* @param y The y-coordinate of the cactus
*/
Cactus(Texture2D texture, float x, float y);
/**
* @brief Update the cactus position with a constant speed
*/
void Update();
/**
* @brief Draw the cactus to the screen
*/
void Draw();
/**
* @brief Check if the cactus is off the screen
* @return True if the cactus is off the screen, false otherwise
*/
bool IsOffScreen();
/**
* @brief Get the rectangle that represents the cactus position and size (hitbox) for collision checking
* @return The rectangle that represents the cactus hitbox
*/
Rectangle GetRect();
private:
/**
* @brief The texture for the cactus
*/
Texture2D texture;
/**
* @brief The rectangle that represents the cactus hitbox
*/
Rectangle rect;
/**
* @brief The speed constant to move the cacti to the left
*/
static constexpr float SPEED = 5;
};