Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use SDL_StartTextInput for gold drop dialog #3294

Merged
merged 2 commits into from
Oct 26, 2021
Merged

Conversation

obligaron
Copy link
Contributor

Fixes #444

Notes:

  • Should work like previous input method but based on SDL_TEXTINPUT/SDL_StartTextInput.
  • Tested with SDL2 and Windows only. So please retest with controller and SDL1.
  • Converting from char to digit is based on 0-char. So it incorrectly recognize a unicode sequence as digit. But the same could is true for old input method and this is only relevant if you try to enter invalid input. This could be investigated in a follow up pr later.

@AJenbo AJenbo merged commit 2158faa into diasurgical:master Oct 26, 2021
@AJenbo
Copy link
Member

AJenbo commented Oct 26, 2021

Excellent, works flawlessly 👍 This means that there are no strictly broken features when using touch, only some minor quirks 🎉

retest with controller

Not relevant, a bare controller has no way to input text as things are. But it might happen one day: #2249

Converting from char to digit is based on 0-char.

Out of curiosity, why not atoi()?

@obligaron
Copy link
Contributor Author

Out of curiosity, why not atoi()?

atoi() returns 0 for invalid input. But we want to distinguish between invalid input and 0 char.
An alternative could be strtol.
The old implementation uses this approach and I didn't want to experiment too much before 1.3 is released. 🙂

@obligaron obligaron deleted the gold branch October 27, 2021 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Start text input when opening the gold drop dialog
2 participants