on_screen_keyboard: arreglado bug al reducir el numero de columna o fila
This commit is contained in:
@@ -164,7 +164,7 @@ void OnScreenKeyboard::setLayout()
|
||||
allChars = use_char_symbol ? allChars + char_symbol : allChars;
|
||||
|
||||
layout.clear();
|
||||
for (int i = 0; i < allChars.length(); ++i)
|
||||
for (int i = 0; i < (int)allChars.length(); ++i)
|
||||
{
|
||||
key_t key;
|
||||
key.col = index_col;
|
||||
@@ -208,7 +208,7 @@ void OnScreenKeyboard::checkInput()
|
||||
// Disminuye en una columna la posición del cursor
|
||||
void OnScreenKeyboard::decCursorCol()
|
||||
{
|
||||
cursor.col = cursor.col > 0 ? --cursor.col : columns - 1;
|
||||
cursor.col = cursor.col > 0 ? cursor.col - 1 : columns - 1;
|
||||
}
|
||||
|
||||
// Incrementa en una columna la posición del cursor
|
||||
@@ -220,7 +220,7 @@ void OnScreenKeyboard::incCursorCol()
|
||||
// Disminuye en una fila la posición del cursor
|
||||
void OnScreenKeyboard::decCursorRow()
|
||||
{
|
||||
cursor.row = cursor.row > 0 ? --cursor.row : rows - 1;
|
||||
cursor.row = cursor.row > 0 ? cursor.row - 1 : rows - 1;
|
||||
}
|
||||
|
||||
// Aumenta en una fila la posición del cursor
|
||||
@@ -243,7 +243,7 @@ void OnScreenKeyboard::updateCursor()
|
||||
void OnScreenKeyboard::addChar()
|
||||
{
|
||||
const int pos = cursor.col + cursor.row * columns;
|
||||
if (pos < layout.size())
|
||||
if (pos < (int)layout.size())
|
||||
output = output + layout.at(pos).caption;
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ void OnScreenKeyboard::render()
|
||||
SDL_RenderCopy(renderer, textureCursor, nullptr, &cursor.dest);
|
||||
|
||||
const int pos = cursor.col + cursor.row * columns;
|
||||
const string key = pos < layout.size() ? layout.at(pos).caption : "";
|
||||
const string key = pos < (int)layout.size() ? layout.at(pos).caption : "";
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, cursor.dest.x + cursor.dest.w / 2, cursor.dest.y + cursor.dest.w / 4, key, 1, {0, 255, 0});
|
||||
text->write(dest.x + outputDest.x, dest.y + outputDest.y, output);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user