76
Window / Re: how to create a "input text fields" and save it in variables
« on: January 09, 2017, 09:33:32 pm »
creating a system for handling ui is actually more complicated than one could think it is.
The easiest (although not very flexible) solution here is storing a pointer or any kind of reference (not strictly in C++ meaning) to the active text field. Handling keyboard input differently if there is a valid pointer to a text field than when there is just a nullptr.
But that feels very hacky and not right for me. If it's same with you, try looking for an established GUI library like SFGUI or Imgui that handles these things for you. Or have a look at how they handle this kind of scenarios and get inspired.
The easiest (although not very flexible) solution here is storing a pointer or any kind of reference (not strictly in C++ meaning) to the active text field. Handling keyboard input differently if there is a valid pointer to a text field than when there is just a nullptr.
But that feels very hacky and not right for me. If it's same with you, try looking for an established GUI library like SFGUI or Imgui that handles these things for you. Or have a look at how they handle this kind of scenarios and get inspired.