SDL - правильный ввод текста
все мы знаем, что у windows и linux систем присутствует целый ряд настроек ввода текста (скорость ввода при зажатии, задержка после ввода первого символа и так далее) К сожалению SDL_TEXTINPUT игнорирует эти настройки. Каким образом я могу сделать ввод текста с клавиатуры, учитывая все настройки ввода? SDK_event у меня находится в отдельном файле моя реализация поля для ввода:
#pragma once
#include "Button.h"
#include "KeyFromSym.h"
struct input : Button {
private:
bool type = false;
public:
input(int px, int py, int sx, int sy,
std::string text_, bool Dynamic = true,
std::string font_ = "Default",
SDL_Color TextColor_ = { 0,0,0 },
SDL_Color BackgroundColor_ = { 255,255,255 })
: Button(px, py, sx, sy, text_, Dynamic, font_, TextColor_, BackgroundColor_) {
}
bool Init(SDL_Renderer* ren, bool cansel) {
if (Button::Init(ren)) {
type = !type;
return true;
}
if (cansel) {
type = false;
}
if (type && e.type == SDL_TEXTINPUT) { //Ввод
Button::retext(Button::GetText() + e.text.text);
}
}
};