Giter Club home page Giter Club logo

pixel-community's Introduction

Pixel - Java Game Framework

Pixel Framework

What is this repository for?

This repository contains the Pixel Framework and associated modules/dependencies.

Description

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).

Examples

Check the ๐Ÿ“ demos folder for examples.

Basic example (Drawing a Sprite)
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!

Project structure

The framework functionality is divided into multiple modules which can be imported individually as required.

Root directory structure
.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
Inner module structure
.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)

Runtime requirements

  • Java/JVM 17.x+

Development requirements

  • (All Runtime requirements)
  • Gradle 8.x+ (gradle wrapper available)

Runtime OS compatibility

Pretty much the same as the LWJGL dependency, which includes:

  • Windows (x86, x64, arm64)
  • MacOS (x64, arm64)
  • Linux (x86, x64, arm64, arm32)

Requires OpenGL 3.3+ support.

FAQ

  1. I'm unable to run Pixel on MacOS due to system error.
    • Add -XstartOnFirstThread as a java VM Option before running your project.
  2. Is Pixel compatible with Kotlin?
    • Yes, Pixel is fully compatible with Kotlin. Check this demo for an example.
  3. Is Pixel available as a Maven dependency?
    • Yes, Pixel is available as a public Maven dependency. Click here for more details on how to import using Maven or Gradle.
  4. Is Pixel free?
    • Yes, Pixel is completely free to use and distribute as an application dependency.

Who do I talk to?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.