Grabbing a string from keyboard

Hi again…

Sorry for the newby question, but is there a simple way to get a string from
the keyboard while in a graphical app? Seems like neither cin >> xxx in C++
nor gets(xxx) in C work the way I’d like. Seems like these two only take
inputs from the console if any. I could get my string by catching each
SDL_KEYDOWN event but that’d be kinda ugly… Is there a simpler way?

Sorry again for the “newbyness” of the question,
Cya,
Gaetan.

“Gaetan de Menten” wrote:

I could get my string by catching each
SDL_KEYDOWN event but that’d be kinda ugly…

no, that’s what you are supposed to do. call SDL_EnableUNICODE() to get
character codes in keydown events

Hi again…

Sorry for the newby question, but is there a simple way to get a string
from the keyboard while in a graphical app? Seems like neither cin >>
xxx in C++ nor gets(xxx) in C work the way I’d like. Seems like these
two only take inputs from the console if any.

Correct - and it’s rather logical, as those are based on stdin/stdout,
which have to be implemented on top of a text console to make much sense.
And SDL doesn’t support or emulate text consoles…

I could get my string by
catching each SDL_KEYDOWN event but that’d be kinda ugly…

Yeah… What’s wrong with actually getting input editing to work the way
you want for a change? :wink:

Is there a simpler way?

Yeah, have a look at SoFont/SFont. IIRC, there are some input functions
there.

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Thursday 22 November 2001 14:52, Gaetan de Menten wrote: