Is anybody using jalleg?
amarillion

I'm trying to set up a project using Gillius' jalleg bindings.

I'm translating one of my C++ games to java, but I'm stuck. In the function:

al_wait_for_event(equeue, event);

In the C++ variant, here the event variable is filled in with the actual event that occurred. But in the java version, it remains null, and the game crashes with a NullPointerException.

Does anybody have any working sample code of an event loop with jalleg? That would be extremely helpful.

edit: Gillius already solved the code problem by email. I should have initialized ALLEGRO_EVENT like so:

Nevertheless, the question still stands: does anybody use jalleg?

gillius

I used it once :)... As far as I know the example program that comes with jalleg (and the networked version in jagnet) is the only thing using jalleg yet.

I did answer Amarillion by e-mail. jalleg should look like the C/C++ code, but in Java there is no stack, so you do have to "new" the objects for which there is no al_create_* or al_destroy_* for. But even in C/C++ you have to declare the ALLEGRO_EVENT even if on the stack, as al_wait_for_event says it fills in event only if it is not null. In this sense, since everything is a reference in Java you skip the * and & in most cases.

Thread #617060. Printed from Allegro.cc