SJGL (Now on GitHub!)

Hello JGO,

Today I will show you my small WIP-library, SJGL, which is an acronym for “Simple Java Game Library”. To make games, you can either use the more basic, user-friendly “Draw” class, or you can use SimpleGL, with, as the name suggests, a OpenGL-like syntax. A piece of source code demonstrating the new Image feature can be found here. A placeholder logo (as well as a thumbnail for the thread) is below:


(Hmm… tiny.)

GitHub: https://github.com/DarkCart/SJGL

If you want to try it out, the latest download is here.

Hm, that just about sums it up, if you have any questions or comments, you know where to find me (hint: browsing the forums), so have a nice day.

If you’re planning on continuing with it, I’d recommend hosting it on github: makes it more accessible, can have wiki docs and issue tracker right in with your code, code can be browsed right in the browser (ha!), doubles as online backup, git as version control so you can track every single change made and revert things if necessary, tag release versions, etc.

Thanks, once I’m sure people like it and I’m sure people will actually pay attention to it (strange but true :persecutioncomplex:), I’ll do that.

Hi

It seems to be bound to AWT :frowning:

Sorry, is there a problem with that?

Been working on the library for most of last night and this morning, so here’s SJGL 0.5.

Added:

General:
+“App” is now called “Window”, sorry for any code changes nessicary.

+Images can now be displayed using the GLImage class

+You can now get more infromation about the Window you made by using getWidth(), or
getHeight().

+Your Window can now go fullscreen using the setFullscreen(boolean fullscreen) command.

+ImportExport is a new class that can be used to import and export files, as the name
suggests.

SimpleGL:

+New commands, such as glDispose(), glDraw(), and glImage().

+Added general-purpose glDraw(int glMode, int x, int y, int width, int height, boolean fill)
with 3 “glMode” commands, GL_RECT, GL_LINE, and GL_CIRCLE.

+New class: GLImage.

Audio:

+Added stopMp3() command

Removed:

-Package com.darkcart.lib.sjgl.entity has been removed

  • Class Entity.java has been removed

Download is in the OP

Maybe you should make a demo to show what this library is capable of. ;D

Works for me. Give me 5 mins.

EDIT: Here you go

Disclaimer: I did create the assets in the game, however, they are derivative works of assets originally created by Markus Persson and/or Junkboy.

Show example code, don’t make people download files. Most people will not download your demo, they just want to see how easy it is to code with it and what you can do with it.

Alright, here: http://pastebin.java-gaming.org/2e18d4f2e1f10

A couple of criticisms

  1. Is your library based off Java2D or OpenGL? It seems to me you are using Java2D, but for some reason you are using the “gl-” prefix for a lot of your functions, which is confusing.

  2. You are initializing WAY too many objects in your paint method. You should not be loading that image over and over before you draw it.

  3. Drawing shouldn’t be handled by the individual graphics classes (Image for example). This is what I’m talking about:

img.glDrawImage(gl, 250, 140, 64, 64);

You are passing in the graphics object. Why is that silly? Because you will only ever have one graphics object, so what is the point in passing it in every time? You should put all these draw methods into the graphics class so you have something like this:

gl.glDrawImage(250, 140, 64, 64);
  1. How do you specify what image to draw? It seems like your idea is to load an image and then immediately draw it. That’s a terrible design, quite honestly. Loading an image from file is expensive, you need a way to store the image and then be able to draw it whenever you want, not immediately after you load it.

ColorValue

is a bad name for a color class, no offense. Rename it to

Color

, that’s what most people would expect it to be named.

  1. Is this all your library can do? Draw images and text? What about input? Or drawing primitives? Or asset handling?

GL gl = new GL();
      gl.glInit(g);

These two lines make me cringe. They are in your paint method, which means you are doing it EVERY frame.

I would suggest researching how other libraries are built, and their design patterns.

  1. GL means Graphics Library, which is a very broad term, so I called my small, OpenGL-like class SimpleGL, or Simple Graphics Library. Technically however, it uses Java2D.

  2. Please elaborate.

  3. Okay, I’ll do so.

3 (Part 2?). Just asking, but how would YOU do that?

  1. It’ll break too much existing code.

  2. Yep, at the moment.

  3. Not sure what you want me to do here.

  1. You bind a texture, then every subsequent draw call will use that texture, until another texture is bound. You should load your textures once at initialization, then just reference them throughout your program.

  2. That’s why you right click > refactor > rename.

How much have you used OpenGL? It appears like you don’t understand any of it’s design patterns at all, which is making your library very confusing and hard to use (not to mention inefficient).

You should get the library on github :slight_smile:
You’re missing out on alot of constructive critisism from people who dont have time to download stuff

Yes, there is. It means that your library has no chance to work under Android. Moreover, I agree with Longarmx’s last sentence. If he’s right, just use LibGDX and don’t make another library.

I’m tired of all this negative feedback. It’s really frustrating to make game/game engines when no one will take you seriously and all they do is point out the flaws. For the record, this is supposed to be a small, basic, desktop library, that I did for fun.

You’ll never learn anything if all you get is positive feedback…what happens if no one points out the flaws? Uh, they stay there. So if you want to ignore the help people are trying to give you, then you will stay with your flawed library, instead of improving it.

I know that, except that all negative feedback demotivates most people.

You were the one who asked for feedback. Taking criticism can make or break people. When people need a library, they want one that does a lot and does it in the fastest, most compatible way possible. For example: people use LibGDX often because it is fast and compatible. Java AWT is also the least used (from what I have seen) for games. If you want to make a game library that people will use, use OpenGL and make it do a lot.

Just my thoughts.

CopyableCougar4

The world is a rough place, and the internet is even rougher.

All we’re trying to do is help you improve your project, and that criticism may not always come smothered in nice words.

What you need to do is to continue improving your project, and you will see positive feedback come back more and more often.