canvi de pc
This commit is contained in:
@@ -9,22 +9,22 @@
|
||||
#include <unordered_map> // Para unordered_map, operator==, _Node_cons...
|
||||
#include <utility> // Para pair
|
||||
|
||||
// [SINGLETON] Hay que definir las variables estáticas, desde el .h sólo la hemos declarado
|
||||
// [SINGLETON]
|
||||
Input *Input::input_ = nullptr;
|
||||
|
||||
// [SINGLETON] Crearemos el objeto input con esta función estática
|
||||
// [SINGLETON] Crearemos el objeto con esta función estática
|
||||
void Input::init(const std::string &game_controller_db_path)
|
||||
{
|
||||
Input::input_ = new Input(game_controller_db_path);
|
||||
}
|
||||
|
||||
// [SINGLETON] Destruiremos el objeto input con esta función estática
|
||||
// [SINGLETON] Destruiremos el objeto con esta función estática
|
||||
void Input::destroy()
|
||||
{
|
||||
delete Input::input_;
|
||||
}
|
||||
|
||||
// [SINGLETON] Con este método obtenemos el objeto input y podemos trabajar con él
|
||||
// [SINGLETON] Con este método obtenemos el objeto y podemos trabajar con él
|
||||
Input *Input::get()
|
||||
{
|
||||
return Input::input_;
|
||||
|
||||
@@ -64,7 +64,7 @@ enum class InputDeviceToUse : int
|
||||
class Input
|
||||
{
|
||||
private:
|
||||
// [SINGLETON] Objeto screen privado para Don Melitón
|
||||
// [SINGLETON] Objeto privado
|
||||
static Input *input_;
|
||||
|
||||
struct KeyBindings
|
||||
@@ -109,13 +109,13 @@ private:
|
||||
~Input() = default;
|
||||
|
||||
public:
|
||||
// [SINGLETON] Crearemos el objeto screen con esta función estática
|
||||
// [SINGLETON] Crearemos el objeto con esta función estática
|
||||
static void init(const std::string &game_controller_db_path);
|
||||
|
||||
// [SINGLETON] Destruiremos el objeto screen con esta función estática
|
||||
// [SINGLETON] Destruiremos el objeto con esta función estática
|
||||
static void destroy();
|
||||
|
||||
// [SINGLETON] Con este método obtenemos el objeto screen y podemos trabajar con él
|
||||
// [SINGLETON] Con este método obtenemos el objeto y podemos trabajar con él
|
||||
static Input *get();
|
||||
|
||||
// Asigna inputs a teclas
|
||||
|
||||
@@ -20,22 +20,22 @@
|
||||
#include "jail_shader.h" // para init, render
|
||||
#endif
|
||||
|
||||
// [SINGLETON] Hay que definir las variables estáticas, desde el .h sólo la hemos declarado
|
||||
// [SINGLETON]
|
||||
Screen *Screen::screen_ = nullptr;
|
||||
|
||||
// [SINGLETON] Crearemos el objeto screen con esta función estática
|
||||
// [SINGLETON] Crearemos el objeto con esta función estática
|
||||
void Screen::init(SDL_Window *window, SDL_Renderer *renderer)
|
||||
{
|
||||
Screen::screen_ = new Screen(window, renderer);
|
||||
}
|
||||
|
||||
// [SINGLETON] Destruiremos el objeto screen con esta función estática
|
||||
// [SINGLETON] Destruiremos el objeto con esta función estática
|
||||
void Screen::destroy()
|
||||
{
|
||||
delete Screen::screen_;
|
||||
}
|
||||
|
||||
// [SINGLETON] Con este método obtenemos el objeto screen y podemos trabajar con él
|
||||
// [SINGLETON] Con este método obtenemos el objeto y podemos trabajar con él
|
||||
Screen *Screen::get()
|
||||
{
|
||||
return Screen::screen_;
|
||||
@@ -363,12 +363,6 @@ void Screen::attenuate(bool value)
|
||||
attenuate_effect_ = value;
|
||||
}
|
||||
|
||||
// Obtiene el puntero al renderizador
|
||||
SDL_Renderer *Screen::getRenderer()
|
||||
{
|
||||
return renderer_;
|
||||
}
|
||||
|
||||
// Calcula los frames por segundo
|
||||
void Screen::updateFPS()
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ enum class ScreenVideoMode : int
|
||||
class Screen
|
||||
{
|
||||
private:
|
||||
// [SINGLETON] Objeto screen privado para Don Melitón
|
||||
// [SINGLETON] Objeto privado
|
||||
static Screen *screen_;
|
||||
|
||||
// Objetos y punteros
|
||||
@@ -116,8 +116,6 @@ private:
|
||||
// Selecciona y ejecuta el método de renderizado adecuado basado en la configuración de shaders
|
||||
void renderScreen();
|
||||
|
||||
// [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);
|
||||
|
||||
@@ -125,13 +123,13 @@ private:
|
||||
~Screen();
|
||||
|
||||
public:
|
||||
// [SINGLETON] Crearemos el objeto screen con esta función estática
|
||||
// [SINGLETON] Crearemos el objeto con esta función estática
|
||||
static void init(SDL_Window *window, SDL_Renderer *renderer);
|
||||
|
||||
// [SINGLETON] Destruiremos el objeto screen con esta función estática
|
||||
// [SINGLETON] Destruiremos el objeto con esta función estática
|
||||
static void destroy();
|
||||
|
||||
// [SINGLETON] Con este método obtenemos el objeto screen y podemos trabajar con él
|
||||
// [SINGLETON] Con este método obtenemos el objeto y podemos trabajar con él
|
||||
static Screen *get();
|
||||
|
||||
// Actualiza la lógica de la clase
|
||||
@@ -182,6 +180,6 @@ public:
|
||||
// Atenua la pantalla
|
||||
void attenuate(bool value);
|
||||
|
||||
// Obtiene el puntero al renderizador
|
||||
SDL_Renderer *getRenderer();
|
||||
// Getters
|
||||
SDL_Renderer *getRenderer() { return renderer_; }
|
||||
};
|
||||
Reference in New Issue
Block a user