2DGE (EDGE) Java graphics engine

2DGE

So I decided to wright a simple little graphics engine for people who either dont want to write their own or arnet to sure.
Features:
custom height,width.
supports offsets.
contains an image reader.
game timer.
multiple draw methods.
custom default image size.

future features:
Font renderer.
layering support.
lighting controller

so here it is enjoy!

2DGE download: https://docs.google.com/file/d/0B48ywWBymi3OLVZtZ1c3LTV3UEk/edit?usp=sharing

Basic usage.

Updated tutorial!

—tutorial—

package GEDEMO;

import GECORE.Ge;//import ant!
import GEGRAPHICS.drawableobj;
import GEGRAPHICS.renderhandler;
import GEINPUT.spritesheet;
import GEINTERFACE.Animation;

public class Tutorial {
	private Ge ge;//setup objects
	private spritesheet s;
	private drawableobj dro;
	private drawableobj dro1;
	private drawableobj dro2;
	private renderhandler rh;
	private Animation a;
	private Animation a1;
	private int[][] data = new int[64][64];//image array, this may change in the future to a sprite object
	public static void main(String[] args){
		new Tutorial();//basically start.
	}
	public Tutorial(){
		rh = new renderhandler();//generate the render handler
		ge = new Ge(600,600,1,"Tutorial",rh,2,2);//set up the frame,  width   height    scale    name   renderhander(this will be updated so you can add multiple ones)  multx multy (for the graphical map size)
		rh.setuphandler(ge, 3);//setup the rh with a GEcore and how many objects it will be rendering at most
		//s = new spritesheet("spritelocation.png/jpg"); dont have an image so its commented out but put the image location plus the extension in as a string
		setup();//called to setup everything before you start the tick loop otherwise it will not load.
		ge.start(true);//start the tickloop this will run the graphics and animation timers.
	}
	public void setup(){
		for(int x = 0; x < 64;x++){//dont need to use this is just because i dont have an image. gives a nice effect though :)
			for(int y = 0; y < 64;y++){
				data[x][y] = x * y * 9999;
			}
		}
		//s.getsprite(0, 0, data, 64, 64);//what would be used to get a 64 by 64 sprite from the x and ypos 0.
		dro = new drawableobj(0,0, 64, 64, data, "Tut1");  //turn the data into a drawable object for use in the renderhandler
		dro1 = new drawableobj(128,0, 64, 64, data, "Tut2");//just for extras
		dro2 = new drawableobj(0,128, 64, 64, data, "Tut3");
		rh.addobj(dro1);//add each one to it.  We set the max it would render to three so it will only render 3.
		rh.addobj(dro2);
		rh.addobj(dro);
		a = new Animation(16, 16, 4, data, ge,"animation 1");//setup the animations   width    height    frame num    datafile(has all frames on it consecutively from left to right)   GEcore   id
		a1 = new Animation(16,16,4,data,ge,"animation 2");
		ge.addanimationtimer(a);//used to tick the animation 
		ge.addanimationtimer(a1);
		a.animate(128, 128, 40);//animates the data and then removes it when complete
		a1.stop();//used to setup variables and stop all running processes in animation. you must use this before running a repetitive animation.
		a1.repetitiveanim(128, 192, 40);//runs until stop is called/
		ge.screen.draw(256, 256, data);//a function that draws a 32 by 32 image at the set x and y
		ge.screen.draw(512, 256, data,64,64);// the same but with custom bounds
		ge.screen.clear(520, 280, 10, 10);//removes an area from the graphical map
	}
}

Enjoy lots more features to come.

—updates—

UPDATE 1:
New features:
An auto drawing system called renderhandler();
Now functions as an import type system not a base system.
Setup for GUI’s.
New way of using images.

UPDATE 2:
New features:
animation handling! horrah!
fixed a bug messing with the rendering.
new commands and a new import file!
new commands.
stop();
animate(x,y,ticks);
repetitiveanim(x,y,ticks);
addanimationtimer(animation);
clear(x,y,width,height);

UPDATE 3:
Tutorial is now up to date.

—Quick thoughts—
So I was having an idea about pushing everything into the ge class so you only require to type Ge. not go Ge.screen Ge.spritesheet.
Along with this maybe implementing input handing and mousehandling maybe rename it to game engine possibly even in the future add in support for tilling and entitys we will see…

So just had an idea. An animation creator that exports a .png file storing your animation that can be read by the 2DGE software. what do you guys think?

I prefer LibGDX :persecutioncomplex:

Ok code update is now out for supporting people who do not want to have to run their own loop.

Your package naming is unconventional. :point:

Also, you’re competing for the same userbase as LibGDX. You’re not really going to win.
And the people that don’t use LibGDX have already made this stuff themselves.

The source code might be a good learning resource for beginners to OpenGL, but other than that I see no real value in this project as of it’s current state. (even LibGDX had to start somewhere)

True, it is only in the early versions. Its mainly designed for people who just want a renderer and dont want the hastle of making their own. As for the package names ill play around with them.

You misunderstand LibGDX’s popularity. It’s popular because there isn’t any competition for it. If you remember, Slick2D was anyone’s first choice until it stopped being maintained.

I’m not saying that this project in particular will do anything to changed that, but honestly, LibGDX was just started by a regular programmer like any of us. Again, it picked up because there wasn’t much an alternative besides Slick. To try and tell someone they couldn’t do the same thing…well, that’s just not very nice.

I agree partly with Troncoso.

Although its a small start now. It takes time to polish it. Especially if he is learning some of it as he goes along.

Also Java/Eclipse is great at refactoring, changing things like package naming and other things are very easy. I am sure if he were to continue working on it, that it will improve with time.

Additionally if he even developed it partly, maybe he will make a couple things in it, that are awesome, that could be absorbed into LibGDX or someone else’s homegrown engine.

So I say keep up the work! 8)

Thanks for all the support. Brilliant community here. Also if you have any suggestions please tell me. Currently this is whats going to happen in the near future: Rotation algorithms for integer arrays(this will be useful for all sorts of stuff) Gui stuff like popups. Possibly a built in lighting engine I may start talking to the person who made straight edge(brilliant lighting engine).

Note it will be just 2d for the foreseeable future.

When I see APIs with naming conventions that unconventional, I need to be convinced that it’s for a reason and not due to a lack of understanding of basic conventions. How this reflects on the library’s quality in general should go without saying. Looks matter.

looks matter but its use its the most important.