Read input and display onto screen

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by cfriedel.

Hi all. Before I begin I would like to wish everyone a safe and happy Christmas. Enjoy the holidays! Now, on to my problem. I want to be able to read input from the keyboard and display it onto a graphics screen as I type it. I have thought about using the ExamineKeyboard command, scanning for the result, and then printing it using the Locate Command and the DrawText command, but this would mean setting up a case for every letter and character on the keyboard and then printing it as it came in. That would be one big select statement. My question: Is there a better way to do this or a way to simply read the ascii number of the key that is pressed on the keyboard when an ExamineKeyboard is done? Any help you oculd give would be appreciated. This is very important for a game I am developing. Thanks as always.

Cliff Friedel
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by El_Choni.

Hi,

I haven't tested the PB_Key values, but I guess letter constants must be consecutive, so you only have to test for other values -as space- in your Case statements, then make an addition or substraction to the PB_Key value in the Default section to obtain the Ascii value of the letter typed.

Sorry to be so lazy not to test this, I'm playing with the toys Papa Noël -Santa Klaus in Spain- brought me yesterday XD. Bye,

El_Choni
Post Reply