![]() |
|
cout / cin Allegro equivalents? |
Irrelevant
Member #2,382
May 2002
![]() |
Are there any? If so, what are they? <code>//----------------//</code>Here be l33tsp33x0rz. |
Justin_W
Member #655
September 2000
![]() |
For cout, closest things are listed under Text Output in the documentation. Some are far more similar to C's printf though, than cout. For cin, keyboard routines are what are available for you. These functions rely mostly on key-per-key input as that is more common for games. If you want to parse up some full on sentences, you are going to have to do it yourself. (ie, accept input into a string until the enter key is pressed - not really all that complex unless you want to convert some things into ints and such.. but still can be done in a fairly small amount of code.) Sounds like keypressed() and readkey() are the ones you might be most interested in looking up. |
23yrold3yrold
Member #1,134
March 2001
![]() |
Didn't someone write a lib for Allegro that let's you use "cout <<" for writing text to the screen? I dunno if anyone uses it or if it's even around, but I could've sworn I saw it on the news page ages ago ... -- |
Irrelevant
Member #2,382
May 2002
![]() |
Quote: just reading keypresses into a string works, unless you want things like backspace. That would be very hard to code. Ah well. I was just wondering if there was an easier way. [edit: Just saw 23/3s post. I wannit! <code>//----------------//</code>Here be l33tsp33x0rz. |
23yrold3yrold
Member #1,134
March 2001
![]() |
If you need help dealing with input, you can try my edit box code from my string article in Pixelate 8. Everyone just loves it Hey, spellcaster, are you smarter than me? -- |
spellcaster
Member #1,493
September 2001
![]() |
I'm afroaid not. But coding a simple textinput widget is not that hard. You need a buffer of chars for your string. You need to know the current position of the cursor inside the string (if you want to have a cursor - most games allow you only to append on the end of the string or o delete the last character in a string). If you use the keypressed() / readkey() functions, this is really simple. If you want to use the key array, you need an extra step: Translating from key{] to actual char values. This could be done like this:
As I said: Using keypressed() readkey would be more easy to use -- |
Monolith Tyriss
Member #2,523
July 2002
|
Quickie question for ya.. how do you do those code-boxes like Spellcaster just did in the previous post? They seem really helpful. :> Thanks! |
spellcaster
Member #1,493
September 2001
![]() |
Whenever you write a post, there's this link "Mock-up is on". Click it :-) And to answer your question directly, simply put the code into -- |
Goodbytes
Member #448
June 2000
![]() |
Somebody already made an ostream equivalent for Allegro... I can't remember what it's called, but it's there. It's on the guy who's maintaining DRS's page. |
Monolith Tyriss
Member #2,523
July 2002
|
Thanks a lot spellcaster. Should help keep my post sizes smaller. |
spellcaster
Member #1,493
September 2001
![]() |
It's automatic. One of the many nice features this forum has -- |
Irrelevant
Member #2,382
May 2002
![]() |
I'll try that, spellcaster. I think I was struggling when I tried something along those lines because I was trying to use a C++ string. The box appears when a certain amuont of lines of code are present. I think it's about 10 - 20. <code>//----------------//</code>Here be l33tsp33x0rz. |
SonShadowCat
Member #1,548
September 2001
![]() |
http://sunsite.dk/olau/gstream/ i believe this is what chris mentioned |
|