![]() |
|
Input output |
Fire Wolf
Member #7,640
August 2006
|
I know how to output char How can I output an int? I have looked around for documentation on it can't find anything... Also how do I input... |
gnolam
Member #2,030
March 2002
![]() |
Quote: How can I output an int? I have looked around for documentation on it can't find anything...
You can't have looked very hard... Quote: Also how do I input... Parse error. Statement too vague. -- |
Fire Wolf
Member #7,640
August 2006
|
you know, input... In my normal c++ I would normally type Where example is the value stored. as an example... I just tried textprintf_ex I get |
gnolam
Member #2,030
March 2002
![]() |
My mention of the manual was a hint. -- |
Fire Wolf
Member #7,640
August 2006
|
Ugg took me ages to get my head around it, mental block I suppose... int money; |
Johan Halmén
Member #1,550
September 2001
|
Input is a more complex task. I guess the best solution is to use a GUI element. If you use Allegro GUI, make a simple dialog, like: char *my_input = " "; DIALOG dlg[] = { /* (proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ { d_edit_proc, 20, 28, 84, 16, 0, 16777215, 0, 0, 4, 0, (void*)my_input, NULL, NULL }, { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } }; popup_dialog(dlg, -1); After that you have your input in my_input. But RTFM, to get the size of the field correct. And to get the dialog closed properly with <enter>. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest. |
Fire Wolf
Member #7,640
August 2006
|
What can I use to sort of stick the GUI to the background, and when it is clicked on you can edit the field, then when I click on a button confirm it stores what is in the box. E.g. Entering a characters name and clicking confirm. |
James Stanley
Member #7,275
May 2006
![]() |
Can you not read? Also, see here |
Fire Wolf
Member #7,640
August 2006
|
But it disapears... I mean, the dialog disapears, I want it to stay there till I click confirm |
James Stanley
Member #7,275
May 2006
![]() |
Did you read the Allegro GUI Clinic that I linked to? That's a great resource and also where I learnt how to use dialogs. You will need a d_screen_proc (or something like that, I don't remember the name), so that the dialog can keep control of the screen. When people post pieces of code here, they aren't necessarily tested or complete, and you are likely to have to interpret it or add bits. EDIT: EDIT2:
You might want to add: |
Derezo
Member #1,666
April 2001
![]() |
Quote: I THINK that is backspace Capture it as an int and use if(character>>8 == KEY_BACKSPACE) Or if you're using C++, just use this, which I retrieved using the "search" function:
Written by 23yrold3yrold. "He who controls the stuffing controls the Universe" |
|