Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411595 Posts in 69386 Topics- by 58445 Members - Latest Member: YomiKu_0

May 07, 2024, 07:50:23 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)EasyJava Library (0.3)
Pages: [1]
Print
Author Topic: EasyJava Library (0.3)  (Read 748 times)
DarkCart
Level 0
**



View Profile WWW
« on: October 25, 2014, 01:52:19 PM »

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. Tongue Here's some example code.

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=0

If you have any suggestions/comments, post below

Well, that's about it. Oooh! Mario! Hand Point Right SMB Mario (escapes)
Logged

Try out EasyJava
AirTime
Level 0
**

Not a glitch, just a misplaced curly brace.


View Profile
« Reply #1 on: October 26, 2014, 11:58:49 AM »

Interesting.
Logged

\"Nothin\'s gonna change my world..\", well at least until the next syntax error appears.
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic