Treballant en els game_texts

This commit is contained in:
2024-10-15 14:02:37 +02:00
parent 3b9885ab03
commit 3fdd60c9e2
5 changed files with 136 additions and 163 deletions

View File

@@ -1,22 +1,25 @@
#pragma once
#include <SDL2/SDL_rect.h> // for SDL_Rect
#include <SDL2/SDL_stdinc.h> // for Uint16
#include <memory> // for shared_ptr, unique_ptr
#include <string> // for string
#include <vector> // for vector
#include "animated_sprite.h" // for AnimatedSprite
#include "utils.h" // for Circle
#include <SDL2/SDL_rect.h> // for SDL_Rect
#include <SDL2/SDL_stdinc.h> // for Uint16
#include <memory> // for shared_ptr, unique_ptr
#include <string> // for string
#include <vector> // for vector
#include "animated_sprite.h" // for AnimatedSprite
#include "utils.h" // for Circle
class Texture;
// Tipos de objetos
constexpr int ITEM_POINTS_1_DISK = 1;
constexpr int ITEM_POINTS_2_GAVINA = 2;
constexpr int ITEM_POINTS_3_PACMAR = 3;
constexpr int ITEM_CLOCK = 4;
constexpr int ITEM_COFFEE = 5;
constexpr int ITEM_COFFEE_MACHINE = 6;
constexpr int ITEM_NULL = 7;
enum class ItemType : int
{
DISK = 1,
GAVINA = 2,
PACMAR = 3,
CLOCK = 4,
COFFEE = 5,
COFFEE_MACHINE = 6,
NONE = 7,
};
// Clase Item
class Item
@@ -35,7 +38,7 @@ private:
float accel_x_; // Aceleración en el eje X
float accel_y_; // Aceleración en el eje Y
bool floor_collision_; // Indica si el objeto colisiona con el suelo
int kind_; // Especifica el tipo de objeto que es
ItemType type_; // Especifica el tipo de objeto que es
bool enabled_; // Especifica si el objeto está habilitado
Circle collider_; // Circulo de colisión del objeto
SDL_Rect *play_area_; // Rectangulo con la zona de juego
@@ -55,7 +58,7 @@ private:
public:
// Constructor
Item(int kind, float x, float y, SDL_Rect *play_area, std::shared_ptr<Texture> texture, std::vector<std::string> *animation);
Item(ItemType type, float x, float y, SDL_Rect *play_area, std::shared_ptr<Texture> texture, std::vector<std::string> *animation);
// Destructor
~Item() = default;
@@ -85,7 +88,7 @@ public:
int getHeight();
// Obtiene del valor de la variable
int getClass();
ItemType getType();
// Obtiene el valor de la variable
bool isEnabled();