A little Demo “Game”(not finished), showing off some Cel Shading
Download
After some a long time in the dark, this engine is now back.
I have already implemented TextRenderer and a 2D Graphics lib :o
Example:
import org.ezlwjgl.GL.*;
import org.lwjgl.input.Keyboard;
public class Example {
public static void main(String[] args) {
WindowManager.enableMouse = true;
WindowManager.mouseGrab = true;
WindowManager.enableKeyboard = true;
WindowManager.createWindow("Test", 800, 600, 60);
int texture = TextureLoader.loadTexture("/shop.png");
while (true) {
Renderer.make3D();
Renderer.make2D();
/**
* ALIGN_CENTER align the text to center of screen
* drawString(String text, int align) */
Graphics.drawString("Center Aligned Text", Graphics.ALIGN_CENTER);
/* drawString(String text, int textSize, double x, double y, double z) */
Graphics.drawString("Absolute Coordinate Text", 1, 32, 250, 0);
Graphics.drawString("Small text", .5, 32, 265, 0);
Graphics.drawString("Big text", 2, 32, 275, 0);
/* drawTexture(int textureID, double x, double y, double width, double height) */
Graphics.drawTexture(texture, 0, 0, 32, 32);
Graphics.drawString("<- Full texture draw", 1, 40, 8, 0);
/**
* Renders a tile from texture tile_x = tile x coordinate in pixels, tile_y = tile y coordinate in pixels, tile_w = tile width in pixels,
* tile_h = tile height in pixels, size_x = texture width, size_y = texture height.
*
* drawTexture(int textureID, int tile_x, int tile_y, int tile_w, int tile_h, int size_x, int int size_y, double x, double y, double width, double height) */
Graphics.drawTexture(texture, 0, 0, 16, 16, 32, 32, 0, 40, 32, 32);
Graphics.drawString("<- Tiled texture draw", 1, 40, 48, 0);
if (WindowManager.update() || Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
break;
}
}
WindowManager.destroyWindow();
}
}
Produces:
hi I took a quick look at the source of your textrenderer and you probably should take a look at for loops
I know, just threw that TextRenderer together for an other project. (It’s actually my first working text renderer :D)
plus there are some font alignment issues(if you scroll down you’ll see).
There were alot of copy-paste, but i’ll probably look into adding some for loops at a later date.
Added for loops to TextRenderer.java, it now contains 70% less code
100 - (538 / (1771 / 100)) = 69,621682665160926030491247882552% reduction