I'm making a map editor and will have two options, one to edit an existing map and another to create a new map.
Assuming that the person choose "new map", he'll have to type the name of the map, as I do so that it can enter text on the screen?
A4 or A5 ?
oh sorry, A5 friend!
Here's some code I wrote for the same purpose :-
You need to pass
1) an ALLEGRO_DISPLAY * - one you've created with al_create_display of course.
2) an ALLEGRO_EVENT_QUEUE * - one you've attached the keyboard and display to .
3) a char * that points to some memory - this where the filename gets stored.
so have something like :
char filename[MAX_LENGTH_FOR_FILENAME_STRING] = ""; .. in the caller
4) as you can see - there's two fonts but you could adapt it to be simpler and use just one font - in my example the fonts are true type fonts.
The WHITE and DARK_RED etc... are
#define WHITE al_map_rgb(255, 255, 255)
Loose the #include <feature_representations.h> line but make sure you replace all the symbolic constants with your own - ie MAX_LENGTH_FOR_FRD_STRING, QUIT_DUE_TO_PROBLEM, etc....
Perhaps you make use of this 
I know it's a bit an effort just to get a filename but it works here...
If you want to use it, let me know if you have any problems..
/* EDIT - sorry it's a lazyish post but I've had a long day and I've started a glass of wine */
/* EDIT 2 */
Hope I haven't put you off programming
edit
I'm trying to put this code inside of a void, I did some change... That do not worked for now but compile without errors, I think is a good signal! Thanks
just let me know if you're stuck
Well, I do not get it to work yet, but I'm packing some things to see. =)
Since it is not working, post your latest code please.
Uma vez que não está funcionando, poste seu código mais recente, por favor.
edit 1: I changed the MAX_LENGTH_FOR_FRD_STRING, worked with bug
http://oi56.tinypic.com/2vljkvb.jpg
int get_ascii_value(int keycode, int shift_key) { if(keycode >= ALLEGRO_KEY_A && keycode <= ALLEGRO_KEY_Z) { printf(" returning %d.\n", (keycode - ALLEGRO_KEY_A + 97) - shift_key ? 32 : 0); return (keycode - ALLEGRO_KEY_A + 97) - (shift_key ? 32 : 0); } if(keycode >= ALLEGRO_KEY_0 && keycode <= ALLEGRO_KEY_9) { return keycode - ALLEGRO_KEY_0 + 48; } if(keycode == ALLEGRO_KEY_MINUS) { if(shift_key) return '_'; else return '-'; } }
Always compile with the -Wall flag with gcc/MinGW. It would have warned you that get_ascii_value is not returning a value when it should have. You should return -1 after the third 'if' statement to indicate it was not a valid character.
Sempre compile com o "-Wall" sinalizador com gcc / MinGW. Teria avisei que get_ascii_value não está retornando um valor, quando deveria ter. Você deve retornar -1, após o terceiro 'if ' para indicar que ele não era um caractere válido.
void test() { int get_filename_screen; bool quit;char *filename;ALLEGRO_EVENT ev; int current_character = 0;int MAX_LENGTH_FOR_FRD_STRING;int key; int shift_key_pressed; int ascii_value;
You didn't allocate memory for filename. You didn't initialize MAX_LENGTH_FOR_FRD_STRING either.
Você não alocar memória para o filename. Você não quer inicializar MAX_LENGTH_FOR_FRD_STRING.
Thanks a lot!