Keyboard input
Vsky13
Edit: Problem solved.

I wanted to share the code before asking any further questions. This code might be garbage since I spent 1 day learning allegro 5 and I'm not a programmer either.

Basicly what I want is first take an input from user. It will be number between 4 and 16 that will determine the size of square matrix. Then n^2 more input will be needed for each member of the matrix. And I want to save them at int array that's all I tried to do there. I played around with the code a lot so again sorry for the bad code any help to achieve my goal is appreciated.

Btw that code doesn't work because of 2 loops I guess idk working mechanics of these things.

Edgar Reynaldo

You need to break out of the first loop once you have the size of the matrix. Modify your get_size function to return true when they press enter and the input is valid.

if (get_size(...)) {break;}

Vsky13

I already break the first loop when done is true and then if quit is not true which can only be possible by pressing ESC key I make done false again to enter 2nd loop. I deleted 2nd loop and found a way to type everything in one loop it's working without a problem now.

Thread #615863. Printed from Allegro.cc