Archived

This topic is now archived and is closed to further replies.

Keyboard Input With SDL

This topic is 5510 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im a newbie on C++ and the SDL library How do I make a Text input ?? Im ''converting'' an Console application I made for a long time ago into a Win32 application ... and I want to know how to make a text input. I guess it''s very simple.. but I have no clue. (you can''t use "cin >> [char *];" in win32 application, am I not right?) Pls help me out. btw - i have one more question .. how do I change the Title bar on the application ? default SDL_application (or something like that)

Share this post


Link to post
Share on other sites
quote:
Original post by ptha
you can''t use "cin >> [char *];" in win32 application, am I not right?

No. You can use cin >> whatever, so long as you wish to read from the console and have redirected cin to the console input buffer for your application. Kinda silly now that I''ve written it.

Under vanilla Win32, you can simply check for keydown/keyup/char messages in your message loop. Under SDL, use SDL events (here''s an example from the SDL website).

quote:
btw - i have one more question .. how do I change the Title bar on the application ?

SDL_WM_SetCaption.

SDL Documentaion Project

Share this post


Link to post
Share on other sites
You may wanna look into SFont for text input - they have closed-loop input routine (the rest of the app freezes while in the input function) but it''s something to start from at least. If you need OOP there''s a C++ version called SoFont. If you use that email me and I''ll send you the input routine (still closed-loop currently) I ported from SFont into SoFont.

_________________________________________________________________

Drew Sikora
A.K.A. Gaiiden

ICQ #: 70449988
AOLIM: DarkPylat

Blade Edge Software
Staff Member, GDNet
Public Relations, Game Institute

3-time Contributing author, Game Design Methods , Charles River Media
Online column - Design Corner at Pixelate

Unnoficial IGDA chat! [polaris.starchat.net -> #igda]
NJ IGDA Chapter - NJ developers unite!! [Chapter Home | Chapter Forum]

"Real programmers don''t work from 9 to 5. If any real programmers are around at 9am it''s because they were up all night."
-Anon.

"It''s not the size of the source that matters, it''s how you use it"
- Self

Share this post


Link to post
Share on other sites