on_screen_keyboard: Ya se pueden añadir y quitar caracteres al texto de salida

This commit is contained in:
2023-05-28 18:33:52 +02:00
parent 921f9d2606
commit 120c3791cf
3 changed files with 41 additions and 17 deletions

View File

@@ -20,7 +20,6 @@ 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
@@ -61,6 +60,8 @@ private:
SDL_Rect dest; // Coordenadas donde se dibuja el objeto en pantalla
vector<key_t> layout; // Contiene la disposición del teclado
cursor_t cursor; // Variable para gestionar el cursor
string output; // Texto de salida
SDL_Rect outputDest; // Rectangulo con el texto de salida
// Rellena la textura de fondo con el color y el texto
void fillTexture();
@@ -95,9 +96,15 @@ private:
// Actualiza la posición de la textura del cursor
void updateCursor();
// Añade un caracter a la salida
void addChar();
// Borra el último caracter de la salida
void removeChar();
public:
// Constructor
OnScreenKeyboard(SDL_Renderer *renderer, Input *input, string iconFile, string bitmapFile, string textFile, options_t *options, int width, int height, color_t color = {0, 0, 0});
OnScreenKeyboard(SDL_Renderer *renderer, Input *input, string bitmapFile, string textFile, options_t *options, int width, int height, string output = "", color_t color = {0, 0, 0});
// Destructor
~OnScreenKeyboard();