More Ramblings from a Los Angeles Programmer

April 20, 2007

Lightweight Java Game Library

Filed under: coding — Josh DeWald @ 3:22 am

Quick update because I can’t sleep (4:15am my time)

Once I got the LWJGL (specifically using the JInput stuff built into it), it only took me about 30 minutes to get the emulator to work with a gamepad controller! I just set up a thread that continously hits Controller.poll() to find out what’s currently being pressed. I will probably slow it down and only poll after the controller has been “strobed” by the game (by writing a 1 to $4016).

I bought a dual PS2->USB adapter from Amazon and my only complaint is that both controllers show up with the same name. I just hardcoded the code to use the second one, but I’ll add a configuration screen for that. They show up as joysticks, and the digital pad ends up mapping to the “Point of View” hat. Thankfully it maps fairly well, with discreet values of 0,-1.0 and 1.0.

It’s so much more fun playing Mario with a controller and not going ghetto-style with the keyboard. Of course since the emulator is still glitchy, when my wife was playing on World 4-1, she was getting killed by invisible tube plants. I don’t really have any idea why it’s happening, as far as I know the sprite rendering is working quite well… so the only thing I can think of is that there are some off-screen sprites that the code things are visible and so get added into the 8-sprite-per-line limit when they are in fact invisible. And that could be happening because there’s a setting to not draw the left/right 8 pixels on the screen and I’m completely ignoring that currently.


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at

%d bloggers like this: