Some Java2D utilities and demo

Java2D is the starting point of some people who want to get started with their first game. There is some discussion if this is the right way (because eventually everyone ends up with a more performant framework). But this thread is not to discuss this point.

Java2D was also the starting point for some of my projects (nothing final however ;)). During developing with Java2D you are bound to encounter some challenges which I resolved in some utility classes.

For people who want to get started with Java2D I want to share these utilities. It isn’t by far a framework but I think it will get you started with Java2D. If you dare :slight_smile:
Included is a demo that shows most of the features in the utility classes. Switching display modes and full screen and manipulation of images.

The demo also has an API overhead feature so you can check the performance you can roughly expect from Java2D. And yes… other frameworks blow Java2D away in this area. I suspect this is mainly caused because Java2D doesn’t have a sprite batch feature.

The API overhead feature has some limitations. If you have a fast CPU but a relative slow GPU the bottleneck will generally be the GPU. You can ‘fix’ this by using smaller sprites for the API overhead feature, but I think that you have to accept that API overhead is apparently not an issue in these cases. By the way, I only encountered this situation on a fast Broadwell NUC with integrated Intel HD graphics.

Last but not least. I tested the code only on Windows.

The executable jar-file with the demo can be found here.
And here are the sources.

Enjoy!