on_screen_keyboard: Mejorada la calidad del cursor
on_screen_keyboard: Compatibilidad con fuentes de texto de tamaño variable
This commit is contained in:
@@ -105,7 +105,8 @@ void OnScreenKeyboard::fillTexture()
|
||||
// SDL_SetRenderDrawColor(renderer, color.r, color.g, color.b, 255);
|
||||
// SDL_Rect rect = {offset_x + (layout.at(pos).col * dist), offset_y + (layout.at(pos).row * dist), dist, dist};
|
||||
// SDL_RenderFillRect(renderer, &rect);
|
||||
text->write(offset_x + (layout.at(pos).col * dist) + 4, offset_y + (layout.at(pos).row * dist) + 4, layout.at(pos).caption);
|
||||
// text->write(offset_x + (layout.at(pos).col * dist) + (dist / 2), offset_y + (layout.at(pos).row * dist) + (dist / 2), layout.at(pos).caption);
|
||||
text->writeCentered(offset_x + (layout.at(pos).col * dist) + (dist / 2), offset_y + (layout.at(pos).row * dist) + (dist / 4), layout.at(pos).caption);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,6 +262,10 @@ void OnScreenKeyboard::render()
|
||||
{
|
||||
SDL_RenderCopy(renderer, texture, nullptr, &dest);
|
||||
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 : "";
|
||||
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