OnScreenKeyboard: Creado el esqueleto base
This commit is contained in:
43
units/on_screen_keyboard.cpp
Normal file
43
units/on_screen_keyboard.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#include "on_screen_keyboard.h"
|
||||
|
||||
// Constructor
|
||||
OnScreenKeyboard::OnScreenKeyboard(SDL_Renderer *renderer, Input *input, string iconFile, string bitmapFile, string textFile, options_t *options)
|
||||
{
|
||||
// Inicializa variables
|
||||
this->renderer = renderer;
|
||||
this->options = options;
|
||||
this->input = input;
|
||||
|
||||
// Crea objetos
|
||||
iconTexture = new Texture(renderer, iconFile);
|
||||
text = new Text(textFile, bitmapFile, renderer);
|
||||
|
||||
// Inicializa variables
|
||||
letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
}
|
||||
|
||||
// Destructor
|
||||
OnScreenKeyboard::~OnScreenKeyboard()
|
||||
{
|
||||
// Libera la memoria de los objetos
|
||||
if (iconTexture != nullptr)
|
||||
{
|
||||
delete iconTexture;
|
||||
}
|
||||
|
||||
if (text != nullptr)
|
||||
{
|
||||
delete text;
|
||||
}
|
||||
}
|
||||
|
||||
// Actualiza la lógica del objeto
|
||||
void OnScreenKeyboard::update()
|
||||
{
|
||||
}
|
||||
|
||||
// Dibuja el objeto en pantalla
|
||||
void OnScreenKeyboard::render()
|
||||
{
|
||||
text->write(0,0,"ON_SCREEN_KEYBOARD");
|
||||
}
|
||||
43
units/on_screen_keyboard.h
Normal file
43
units/on_screen_keyboard.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "utils.h"
|
||||
#include "text.h"
|
||||
#include "input.h"
|
||||
|
||||
#ifndef ON_SCREEN_KEYBOARD_H
|
||||
#define ON_SCREEN_KEYBOARD_H
|
||||
|
||||
using namespace std;
|
||||
|
||||
class OnScreenKeyboard
|
||||
{
|
||||
private:
|
||||
|
||||
// Objetos y punteros
|
||||
SDL_Renderer *renderer; // El renderizador de la ventana
|
||||
Texture *iconTexture; // Textura para los gráficos
|
||||
Text *text; // Objeto para dibujar texto
|
||||
Input *input; // Gestor de eventos de entrada de teclado o gamepad
|
||||
options_t *options; // Variable con todas las opciones del programa
|
||||
|
||||
// Variables
|
||||
string letters;
|
||||
|
||||
public:
|
||||
|
||||
// Constructor
|
||||
OnScreenKeyboard(SDL_Renderer *renderer, Input *input, string iconFile, string bitmapFile, string textFile, options_t *options);
|
||||
|
||||
// Destructor
|
||||
~OnScreenKeyboard();
|
||||
|
||||
// Actualiza la lógica del objeto
|
||||
void update();
|
||||
|
||||
// Dibuja el objeto en pantalla
|
||||
void render();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user