Getting input with Dreamcast keyboard.
Posted: Wed Dec 22, 2004 11:36 pm
Finally, after all of these months did I learn how to get input with the keyboard. It is such a great and useful peripheral on the DC. You can use all of those extra keys for debugging and secrets and all sorts of coolness.
I dug up some old KOS example, and I disected it with the help of Tvspelsfreak.
Then we had the problem where we had no clue which key was what. We looked up scancodes online and for some reason the DC's is different. After Tvspelsfreak abondened me (:lol:), I printed out the scancodes of the keys I pushed straight from t3h DC. Then, I manually converted them to hex.
Well, I could've used the integers, but I think it's easier to go with hex when you're getting keyboard input. Makes it look alot easier to understand. That's right. I actually used something from computer science club. Decimal (base 10) to hex (base 16) conversions.
Then I forgot about just doing this:
That'll print out the hex for you! XD
Looks like the conversions are still useless . . .
In the end the Tile Demo thing now supports keyboard -- I want to say perfectly, because it does as perfectly as possible ATM.
Apparently, the keyboard, unlike the controller doesn't register holding the button down. You litterally have to push it again every single time you want to move a pixel. I'm sure there's a way around that somehow. What do you think, Tvspels?
Shooting with keyboard works perfectly, walking does (only you have to push it 20 times to move 20 pixels), jumping works sorta (It makes you jump higher based on the length of time the button is held down and the keyboard won't register more than once).
The best part is that now I can take a screenshot by pushing the "Print Screen" button how god had intended.
Man, I love the keyboard on the DC.
Anyway, this is good progress. Slowly we are pwning more and more peripherals. First it was analog stick, then VMU, and now keyboard.
I'm trying for rumble pack now. That's supposed to be a pain in the ass though...
I dug up some old KOS example, and I disected it with the help of Tvspelsfreak.
Then we had the problem where we had no clue which key was what. We looked up scancodes online and for some reason the DC's is different. After Tvspelsfreak abondened me (:lol:), I printed out the scancodes of the keys I pushed straight from t3h DC. Then, I manually converted them to hex.
Well, I could've used the integers, but I think it's easier to go with hex when you're getting keyboard input. Makes it look alot easier to understand. That's right. I actually used something from computer science club. Decimal (base 10) to hex (base 16) conversions.
Then I forgot about just doing this:
Code: Select all
printf("%x", keyboard_var);
Looks like the conversions are still useless . . .
In the end the Tile Demo thing now supports keyboard -- I want to say perfectly, because it does as perfectly as possible ATM.
Apparently, the keyboard, unlike the controller doesn't register holding the button down. You litterally have to push it again every single time you want to move a pixel. I'm sure there's a way around that somehow. What do you think, Tvspels?
Shooting with keyboard works perfectly, walking does (only you have to push it 20 times to move 20 pixels), jumping works sorta (It makes you jump higher based on the length of time the button is held down and the keyboard won't register more than once).
The best part is that now I can take a screenshot by pushing the "Print Screen" button how god had intended.
Man, I love the keyboard on the DC.
Anyway, this is good progress. Slowly we are pwning more and more peripherals. First it was analog stick, then VMU, and now keyboard.
I'm trying for rumble pack now. That's supposed to be a pain in the ass though...