Hey, I recently put together a small library that allows you to switch between AWT and LWJGL rendering.
Why? I was bored.
What does it do?Basically it is 4 interfaces that has two implementations, one for AWT and one for LWJGL.
So you can change between AWT and LWJGL without modifying your code.
How do I use it?Well, there is two different methods of using it.
1. Use my render loop, it is based on dewitters game loop, or atleast that article. (
http://www.koonsolo.com/news/dewitters-gameloop/)
You create a RenderLoop object by either using the FlatEngine.create function (It's just a container for the render loop)
1
| public static FlatEngine.create(RenderLoopCallback rlc, RendererType _renderer, String windowTitle, int width, int height, boolean decorated) |
Example:
1
| FlatEngine fe = FlatEngine.create(this, FlatEngine.RendererType.AWT, "Test", 800, 640, true); |
Or you can create it manually
1
| public RenderLoop(RenderLoopCallback rlc, IFlatRenderer renderer) |
The RenderLoopCallback is an interface that allows the game loop to contact your game.
It looks like this
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| public void preload();
public void update(IFlatInput input);
public void draw(IFlatGraphics graphics); |
2. You can use your own rendering loop
And you just have to create a IFlatRenderer either the AWTRenderer or the LWJGLRenderer
If you want to have a look at the code or even use it, you can find it it at (
https://github.com/Meanz/flat2d)
I don't know if anyone would find this useful, so my question to you, is this something interesting, maybe something you want to see expanded?