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)
public static FlatEngine.create(RenderLoopCallback rlc, RendererType _renderer, String windowTitle, int width, int height, boolean decorated)
Example:
FlatEngine fe = FlatEngine.create(this, FlatEngine.RendererType.AWT, "Test", 800, 640, true);
Or you can create it manually
public RenderLoop(RenderLoopCallback rlc, IFlatRenderer renderer)
The RenderLoopCallback is an interface that allows the game loop to contact your game.
It looks like this
/**
* Called before the rendering loop is started
*/
public void preload();
/**
* Called when a update is requested
*/
public void update(IFlatInput input);
/**
* Called when a frame draw is requested
*
* @param graphics
*/
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?