|Llama - Created by JL235 (No Votes)|
Simple 2D Java Game Library
|Version 1 of my new simple 2D Game Library for Java is finally complete. Inspired by Blitz, it offers Java's great 2D capabilities wrapped into a couple of very easy to use, simple classes.|
Full Documentation available here!
- Different types of the 'GraphicsDisplay' class to offer full screen, windowed and border-less windows for your games.
- A simplified control interface giving the coder the ability to simply check if a key is down or not, thus removing the need to set up complex event listeners.
- Unified graphics commands for both windows and images.
- Hardware accelerated double buffering.
To use, simply download the jar and import it as a library. If you are using NetBeans this is done in your projects properties settings. Finally in your class it's a simple: 'import llama.*;'
Soon to come:
- Hardware accelerated images,
Version 1.1 is now complete! Version 1 adds Sound support, a few fixes, default program close for windows.
For my long term model, I now plan to port my whole library over to Java3D for version 2. This will allows faster images, buffers and better sound support.
|Posted : Saturday, 04 August 2007, 00:31|
|My library uses the Java library, so no. However Jython (Python on the Java VM) and JRuby (Ruby on the Java VM) are fully compatible with Java classes, as well as lots of other languages ported to the Java VM.|
|Posted : Saturday, 04 August 2007, 08:39|
|Neat. I'll definitely be giving this a try soon, now that I use Java a lot. Any chance you'll ever wrap some openGL-Java bindings into this library? It would give you a lot more power and customization.|
|Posted : Saturday, 04 August 2007, 09:04|
I've always been confused by Java (I have books on it, but they're very old!) but do you think you could post a small piece of example code that imports the library and draws a few shapes so that I can use that to get an idea of how things work?
|Posted : Saturday, 04 August 2007, 11:16|
Draws a circle in random places on the screen!
|edit| Edited to comply with new standards! |edit|
|Posted : Saturday, 04 August 2007, 14:08|
|Oh cool - thanks Instinct. |
Time to dig up the old development environment...
|Posted : Saturday, 04 August 2007, 16:01|
|I have a few changes for Instincts code. The application doesn't close when the window does, as otherwise it wouldn't be able to handle multiple windows.|
I don't like the look of that for loop so instead I'd suggest a while loop with 'g.isRunning()' as it's condition. When the window is closed it no longer running and so the loop will break.
Instinct is also using an early alpha version of the library, as it's GraphicsDisplay and not Graphics.
Nolan, if available, it will perform the buffer operations on your graphics card. I have plans to add another image class which uses Java's 'VolatileImage' class where the image data is stored on the graphics card. Behind the scenes, Java will use DirectX if you are running Windows and OpenGL on other operating systems. If these are not available to Java, then it will use software rendering.
|Posted : Saturday, 04 August 2007, 17:48|
|Sounds promising. At first, I thought the library was rather slow. Wondering why, I opened up task manager and saw about 30 instances of java.exe... probably because, using the for(; loop, the program didn't correctly shut off. I could be wrong, however.|
I had a pretty sweet particle program running, but accidentally ended the process of the wrong 'java.exe', which closed down netbeans before I saved the code. Oh well... still a pretty cool library!
|Posted : Saturday, 04 August 2007, 18:19|
|Yes, the for loop will never end. That is why it will never shut.|
Because I wanted it to allow multiple windows to be used it means I don't set to have the program end when a window is closed (although I could add that as an option). Instead you either need to run out of code (which your not with that for loop) or do 'System.exit(0)'. That is why I'd also suggest 'while (g.isRunning())'.
Also, for an infinite loop I think 'while (true)' is also better then 'for (;'. The condition is a lot more obvious.
|edit| Please also note that Instincts code is pausing so the oval doesn't move around too quickly. You don't need to use pause code normally. I will also be making some example code. |edit|
|Posted : Saturday, 04 August 2007, 18:57|
although I could add that as an option
That would be a very good option, and a simple one to add, I would think.
The condition is a lot more obvious.
Perhaps, but does that really matter? The coder is the one who sees the source, so as long as he/she understands it, I see no problem with using a more confusing loop such as for(;.
Still though, I see what you mean.
|Posted : Saturday, 04 August 2007, 19:52|
|Many coders may not have seen a for loop like before. I haven't. So it means you then have to think about and estimate what it will do, with testing being the only real guarantee that your right.|
Nolan The coder is the one who sees the source
What if your coding for a company or in a team? Then other people will have to read, add and maintain your code. It's important that they then understand the source as quickly as possible to help them learn how your code works and what it does.
I'll add that option to the list. Maybe I could add it to the constructor, something like 'GraphicsWindow(int width, int height, String title, boolean endOnClose)'. For your main window you could pass true into there, but for any others you could miss that parameter out and it would default to false.
This means you could have three windows, say a main window and two others, and the program will only end when the main window is closed.
I'm also thinking of adding a 'plot' and 'getPixel' methods to the Drawable class, but sound support is top of my list.
|Posted : Saturday, 04 August 2007, 20:20|
|Haha, my bad with the for loop . And also with the Graphics instead of GraphicsDisplay... Ironically I was thinking about it but I got distracted and didn't fix it before I posted. I think if you have an endOnClose by default it should be set to true, since most things will require it to end when closed.|
I'm really not sure why I use the for(; instead of while(true), probably just because it's fewer characters .
|Posted : Saturday, 04 August 2007, 23:27|
|Actually, I was a little wrong. Java does not exit when you run out of code, so I will be adding the exit on close as default.|
For now putting 'System.exit(0);' at the end of your code will get Java to quit.
|Posted : Friday, 10 August 2007, 01:44|
|Posted : Monday, 13 August 2007, 00:46|
|I've now downloaded Java and gotten your engine running, and I like it It reminds me a lot of Blitz. Good job! I might actually make something useful with it.|
|Posted : Monday, 13 August 2007, 04:18|
|Blitz command reference is one of my biggest influences. For my own projects I wanted to use a library which was just as simple, and didn't use events lists for controls.|