Original Post
🔒 Locked
Input a string?
Advertisement
quote:
Original post by BeanDog
Is there someone out there who has written a string-input deal for DirectDraw? Like cin, but with a IDIRECTDRAWSURFACE7 object. You know what I mean? You call it, they type something in, the function returns it.
Anybody?
Well, cin is just a standard wrapper object for the part of the console input system that the operating system provides. Therefore it isn''t handling moving the cursor when you type, moving onto the next line, etc etc. This means that, to do a windows version, you have to handle all this yourself. Hence the popularity of MFC, etc
Otherwise, you''re gonna need to implement letter drawing functions, a list/stack/array of characters to hold your input, some way to grab that input (DirectInput, for example) and a way of matching up the input to a letter to add to your string. If you are going to do it yourself, I recommend you start with fixed width characters and only upper or lower case until you get the hang of it
Your problem seems to be that cin uses stdout, which one can hardly see in graphics mode under DirectDraw 
I''ve created a small DirectInput library which supports quake-like key binding - and - cursored text input. The library can be initialized with just 2 function calls, so this shouldn''t be the problem.
The text the user is typing is placed in an char * array, you just have to call an update() function (meaning your program keeps running, allowing you to draw the text onto the ddraw surface). Since the lib uses buffered mode, you won''t lose keystrokes even if the app runs very choppy
If you''d like to give it a try,
www.lunaticsystems.de/truefx
(a simple example app demonstrating string input is included, the lib is free and full-source, full english documentation)
-Markus-
P.S. Wow. Finally became a ''dedicated'' with this message :D
I''ve created a small DirectInput library which supports quake-like key binding - and - cursored text input. The library can be initialized with just 2 function calls, so this shouldn''t be the problem.
The text the user is typing is placed in an char * array, you just have to call an update() function (meaning your program keeps running, allowing you to draw the text onto the ddraw surface). Since the lib uses buffered mode, you won''t lose keystrokes even if the app runs very choppy
If you''d like to give it a try,
www.lunaticsystems.de/truefx
(a simple example app demonstrating string input is included, the lib is free and full-source, full english documentation)
-Markus-
P.S. Wow. Finally became a ''dedicated'' with this message :D
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement