Hello guys. Now I’m converting my java 2d based game engine to use lwjgl and I’ve ran into some doubts.
- How can I embed the natives into the JAR file of my library jar?
- How to convert [icode]KeyEvent[/icode] constants to LWJGL?
Thanks.
Hello guys. Now I’m converting my java 2d based game engine to use lwjgl and I’ve ran into some doubts.
Thanks.
There are a few tools that will allow you to do this like JarSplice, OneJar, etc.
You can’t convert them since they are for a different toolkit, you can however use the LWJGL’s own key codes as listed here (technically if you really must use AWT key codes then you could create a wrapper class that maps them to the equivalent LWJGL key codes).
I would also recommend that you have a read of the input tutorial found on the wiki here.
Or you can go yet another step further and get slick, and use it’s keyboard function, which names all the keys right out.
it looks sorta like:
Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)
and its mouse code looks like:
Mouse.isButtonDown(0)
and you can use
Mouse.getX()
and
Mouse.getY()
for mouse coordinates.
That’s also how LWJGL does it.
That code was inherited from LWJGL, not built into Slick.
Also, Slick is being phased out, as it seems to not be dev’d for anymore. It seems to be that people who are using it in their existing projects are staying with it, but starting a new project with it at this point in time doesn’t sound to be the best of ideas.
Just use “Gdx.input.” for keys, mouse positions, etc… It’s worked for everything I’ve done but I haven’t been able to figure out how to use the mouse wheel with it.
That’s LibGDX :point:
Oh derp… I always mix those two up. >.<