Classe Screen melitonada

This commit is contained in:
2024-09-28 11:11:11 +02:00
parent f2cc0dc352
commit 92f7f540c0
19 changed files with 90 additions and 54 deletions

View File

@@ -1,11 +1,11 @@
#pragma once
#include <SDL2/SDL.h>
#include "asset.h"
#include "utils.h"
#include "notify.h"
#include "input.h"
#include <vector>
#include "asset.h"
#include "input.h"
#include "notify.h"
#include "utils.h"
#define SCREEN_FILTER_NEAREST 0
#define SCREEN_FILTER_LINEAL 1
@@ -16,6 +16,9 @@
class Screen
{
private:
// [SINGLETON] Objeto screen privado para Don Melitón
static Screen *screen;
// Objetos y punteros
SDL_Window *window; // Ventana de la aplicación
SDL_Renderer *renderer; // El renderizador de la ventana
@@ -74,13 +77,25 @@ private:
// Muestra información por pantalla
void displayInfo();
public:
// [SINGLETON] Ahora el constructor y el destructor son privados, para no poder crear objetos screen desde fuera
// Constructor
Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, Input *input);
// Destructor
~Screen();
public:
// [SINGLETON] Crearemos el objeto screen con esta función estática
static void Init(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, Input *input);
// [SINGLETON] Destruiremos el objeto screen con esta función estática
static void Destroy();
// [SINGLETON] Con este método obtenemos el objeto screen y podemos trabajar con él
static Screen *get();
// Actualiza la lógica de la clase
void update();