Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

chromatic (983)

  (email not shown publicly)

Blog Information [] Profile for chr0matic []

Journal of chromatic (983)

Friday February 06, 2004
02:00 AM

Ahh, Inexorable Progress

[ #17240 ]

(Yes, I am aware of the synonym inflexible.)

After two more bits of hacking, events work with SDL Parrot. That is to say, I can move the little parrot logo around on screen by pressing and releasing the cursor keys. I can even shut down the program cleanly by pressing Escape.

Okay, so it's a little grotty and not documented. (You'd be impressed by the rest of the documentation, however.) True, I can only detect five keys (up, down, left, right, and Escape) and I make no distinction between key up and key down events. Of course, two hours ago, I could barely report a key detection. This is progress.

There are two ways to detecting keyboard events. One is to pass a list of events and callbacks to a loop. The other is to process incoming events and run through the state machine yourself. Since I like first-class functions so much, I went with the callback approach.

Since I'm writing examples at the same time, the necessary abstractions are beginning to appear. It may be time to delve into PIR object syntax. I'll have something really cool to show off by the time OSCON rolls around.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.