Edit tool works with events

This commit is contained in:
Yousef Khadadeh 2026-03-07 13:00:10 +03:00
parent 32b84d0813
commit 783f645699
10 changed files with 187 additions and 98 deletions

View file

@ -160,8 +160,6 @@ bool InputManager::Text::is_accepting_input() {
return !textBoxes.empty();
}
SDL_Rect r;
void InputManager::Text::update_accepting_input(SDL_Window* window) {
if(!textBoxes.empty()) {
auto& textbox = textBoxes.front();
@ -174,8 +172,12 @@ void InputManager::Text::update_accepting_input(SDL_Window* window) {
SDL_SetNumberProperty(propIDVal, SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN, textbox.textInputProperties.autocorrect);
SDL_SetNumberProperty(propIDVal, SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN, textbox.textInputProperties.multiline);
SDL_SetNumberProperty(propIDVal, SDL_PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER, (textbox.textInputProperties.androidInputType & ANDROIDTEXT_TYPE_CLASS_NUMBER) ? ANDROIDTEXT_TYPE_CLASS_TEXT : textbox.textInputProperties.androidInputType);
r = textBoxes.front().rect->get_sdl_rect();
SDL_SetTextInputArea(window, &r, 0);
if(!textBoxes.front().rect)
SDL_SetTextInputArea(window, nullptr, 0);
else {
SDL_Rect r = textBoxes.front().rect->get_sdl_rect();
SDL_SetTextInputArea(window, &r, 0);
}
SDL_StartTextInputWithProperties(window, propIDVal);
}
else {