Commit de "guardar partida"

This commit is contained in:
2024-10-08 18:07:54 +02:00
parent 9ce0f16d33
commit c00f4326ae
2 changed files with 63 additions and 42 deletions

View File

@@ -1,11 +1,11 @@
#pragma once
#include <SDL2/SDL_rect.h> // for SDL_Rect
#include <SDL2/SDL_render.h> // for SDL_Renderer
#include <string> // for basic_string, string
#include <vector> // for vector
#include <SDL2/SDL_rect.h> // for SDL_Rect
#include <SDL2/SDL_render.h> // for SDL_Renderer
#include <string> // for basic_string, string
#include <vector> // for vector
#include <memory>
#include "utils.h" // for color_t
#include "utils.h" // for color_t
#include "text.h"
#include "texture.h"
#include "sprite.h"
@@ -42,25 +42,51 @@ private:
struct notification_t
{
std::unique_ptr<Texture> texture;
std::unique_ptr<Sprite> sprite;
std::string text1;
std::string text2;
int counter;
notification_state_e state;
notification_position_e position;
std::unique_ptr<Texture> texture;
std::unique_ptr<Sprite> sprite;
SDL_Rect rect;
int y;
int travelDist;
notification_shape_t shape;
// Constructor
notification_t(std::unique_ptr<Texture> texture, std::unique_ptr<Sprite> sprite)
: texture(std::move(texture)), sprite(std::move(sprite)) {}
// Constructor de movimiento
notification_t(notification_t &&other) noexcept
: texture(std::move(other.texture)), sprite(std::move(other.sprite))
{
// Mover otros miembros si es necesario
}
// Operador de asignación por movimiento
notification_t &operator=(notification_t &&other) noexcept
{
if (this != &other)
{
texture = std::move(other.texture);
sprite = std::move(other.sprite);
// Mover otros miembros si es necesario
}
return *this;
}
// Deshabilitar el constructor de copia y operador de asignación por copia
notification_t(const notification_t &) = delete;
notification_t &operator=(const notification_t &) = delete;
};
// Objetos y punteros
SDL_Renderer *renderer; // El renderizador de la ventana
std::unique_ptr<Texture> textTexture; // Textura para la fuente de las notificaciones
std::unique_ptr<Texture> iconTexture; // Textura para los iconos de las notificaciones
std::unique_ptr<Text> text; // Objeto para dibujar texto
std::unique_ptr<Texture> iconTexture; // Textura para los iconos de las notificaciones
std::unique_ptr<Text> text; // Objeto para dibujar texto
// Variables
color_t bgColor; // Color de fondo de las notificaciones