High performance and modular Java/Kotlin 2D Game Framework.
APACHE-2.0 License
This repository contains the Pixel Framework and associated modules/dependencies.
The Pixel Framework aims to provide a high performance and lightweight OpenGL 2D game development workflow. It is influenced by the popular XNA framework and is built on top of the LWJGL and GLFW projects.
๐ For practical details on how to use this framework, please check the wiki page.
Pixel is designed to be modular and easy to extend. Check here for more details on how to use the available extensions (or how to create your own).
Check the ๐ demos folder for examples.
public class SingleSpriteDemo extends GameWindow {
private Camera2D gameCamera;
private ContentManager content;
private SpriteBatch spriteBatch;
private Texture spriteTex;
public SingleSpriteDemo(GameWindowSettings settings) {
super(settings);
}
@Override
public void load() {
// load up of resources and game utilities:
content = ServiceProvider.create(ContentManager.class);
spriteBatch = ServiceProvider.create(SpriteBatch.class);
gameCamera = new Camera2D(this);
// example of loading a texture into memory:
spriteTex = content.load("<texture_path>", Texture.class);
// ... or with the built-in 'texture' method: content.loadTexture(...)
}
@Override
public void update(DeltaTime delta) {
// game update logic goes here
}
@Override
public void draw(DeltaTime delta) {
// begin the spritebatch phase:
spriteBatch.begin(gameCamera.getViewMatrix(), BlendMode.NORMAL_BLEND);
// sprite draw/put for this drawing phase:
spriteBatch.draw(spriteTex, Vector2.ZERO, Color.WHITE);
// end and draw all sprites stored:
spriteBatch.end();
}
@Override
public void dispose() {
content.dispose();
spriteBatch.dispose();
super.dispose();
}
}
Looking for ECS support? Check this built-in extension!
The framework functionality is divided into multiple modules which can be imported individually as required.
.build/ # Bundle .jar files (run 'bundle' gradle task)
.demos/ # Feature showroom and learning examples
.extensions/ # Extensions for the framework (optional)
โโโ ext-ecs # Entity component system extension
โโโ ext-ecs-extra # ECS utility components
โโโ ext-ldtk # LDTK extension
โโโ ext-log4j2 # Log4j2 extension
โโโ ext-tween # Tween extension
.modules/ # The principal modules of the framework
โโโ commons # Common utility classes
โโโ content # Common Content classes (Texture, Font, Audio, ...)
โโโ desktop # Desktop implementation of graphics, content, windowing and others
โโโ graphics # Graphics API module
โโโ math # Math module (Vector, Matrix, ...)
โโโ pipeline # Generic Pipeline processing module
.resources/
โโโ images # Project resource images
.build.gradle # Gradle build file
.settings.gradle # Gradle settings file
.modules/
โโโ *module* # Presented file structure similar in all modules
โโโ build # Module build directory
โ โโโ docs # Generated documentation files (run 'javadoc' gradle task)
โ โโโ libs # Generated .jar files (run 'jar' gradle task)
โโโ src # Module Source folder
โ โโโ main # Module Main Source classes
โ โโโ test # Module Test Source classes
โโโ build.gradle # Module Gradle build file (contains inner dependency definitions)
Pretty much the same as the LWJGL dependency, which includes:
Requires OpenGL 3.3+ support.
-XstartOnFirstThread
as a java VM Option before running your project.