GFL is a library that aims to help speed up the process of creating a game/interactive graphical application. It provides keyboard and mouse input, a main loop that keeps track of frames per second and makes up for any skips in time. It also creates a Frame that can be directly drawn on using the GFLVideo class. This provides, like the name of the library suggests,
most, if not all, of the fundamentals for a game or interactive graphical application.
This is a library consisting of 4 classes, 3 of which are able to be used by you.
The JavaDoc is included in the zip file and it explains the functions of every
method, constructor, class that you need to know about.
http://www.mediafire.com/download/e99ap7fwayb1a9y/envel_libgfl.zip
Here is a test class to help you start out with GFL.
import java.awt.Graphics;
public class GFLTest extends GFLApplication {
public static void main(String[] args) {
new GFLTest(640, 480).gflStart();
}
public GFLTest(int width, int height) {
super(width, height);
}
private int rectX, rectY;
@Override
public void gflInit(int width, int height) {
// Initialize anything you need to initialize.
}
@Override
public void gflLoadResources() {
// Load any resources, like images, models, etc.
}
@Override
public void gflUpdate() {
// Update anything you need to update like the player, the
// physics, or input.
GFLInput input = gflInput();
// create a check to see if the user wants to exit the program.
if (input.keyPressed(GFLInput.KEY_ESCAPE)) {
gflStop();
}
// handle rectangle input.
if (input.keyHeld(GFLInput.KEY_W)) {
rectY--;
}
if (input.keyHeld(GFLInput.KEY_S)) {
rectY++;
}
if (input.keyHeld(GFLInput.KEY_D)) {
rectX++;
}
if (input.keyHeld(GFLInput.KEY_A)) {
rectX--;
}
}
@Override
public void gflRender() {
// Draw anything you need to draw.
// Reset the screen to black.
GFLVideo.reset();
// Fill a yellow square at the defined coordinates with a side
// length of 100.
GFLVideo.fill_rect(rectX, rectY, 100, 100, 0xFFFF00);
}
@Override
public void gflResize(int width, int height) {
// If anything special needs to be done with your graphics when the
// frame is resized, use this method to do that.
}
@Override
public void gflDrawAWT(Graphics g) {
// If you wish to use AWT to draw, use this method.
}
@Override
public void gflExit() {
// Clean up.
}
}