Hello TigSource,
Today I will show you my little (and by little, I mean extremely little) game library that can make things easier for programming games in Java. It is called EasyJava. EasyJava makes it easy to just load up a project in Eclipse, Netbeans, etc, and make a simple game. Right now, all you can really do is make a frame and put shapes and music on said frame, though.
Here's some example code.
import java.awt.Graphics;
import java.awt.Point;
import com.darkcart.lib.easyjava.BasicGame;
import com.darkcart.lib.easyjava.Window;
import com.darkcart.lib.easyjava.util.ColorValue;
import com.darkcart.lib.easyjava.util.Draw;
import com.darkcart.lib.easyjava.util.DrawTriangle;
import com.darkcart.lib.easyjava.util.Sound;
public class Test extends BasicGame {
private static final long serialVersionUID = 1L;
Window win;
public void init() {
win = new Window();
win.createWindow(640, 480, "Test", false);
win.addTool(this);
Sound s = new Sound();
s.playMp3("song.mp3");
}
public void paint(Graphics g) {
Draw d = new Draw();
d.setBackground(g, ColorValue.lightGray);
g.setColor(ColorValue.green);
d.drawRectangle(g, 10, 10, 128, 128);
g.setColor(ColorValue.purple);
d.drawOval(g, 100, 100, 120, 120);
DrawTriangle t = new DrawTriangle(90, 90, ColorValue.red);
t.drawTriangle(g, new Point(250, 200));
}
public static void main(String[] args) {
Test test = new Test();
test.init();
}
}
The above code does this:
- Make a frame
- Start playing song
- Draw shapes (Rectangle, Circle, Triangle)
As long as you include "extends BasicGame", by the class name, you should be good to go.
Download:
https://www.dropbox.com/s/3w6e8ylinl1mglx/EasyJava%200.3.zip?dl=0If you have any suggestions/comments, post below
Well, that's about it. Oooh! Mario!
(escapes)