Keyboard Input With SDL
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)
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
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
_________________________________________________________________
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement