FXGL Game Development Framework

repository·dev·Indexed 26 days ago

https://github.com/almasb/fxgl

A JavaFX-based game development framework for 2D games and complex UI applications. It supports Java 8-25 across Windows, Mac, Linux, Android, iOS, and Web. FXGL provides high-level APIs for entity-component systems, animations, particles, network communication via Client and Server classes, dialogue trees using DialogueGraph, and specialized rechargeable components for health and mana.

Tokens
3.9K
Snippets
10
Records
29
Agent score
88%

What's inside FXGL

  1. Install FXGL using Gradle

    dev

    Add the following to your build.gradle file. Note that you may need to include jcenter() in your repositories block.

    repositories {
        jcenter()
    }
    
    dependencies {
        compile 'com.github.almasb:fxgl:25'
    }
  2. Install FXGL via Gradle

    dev

    Add the FXGL dependency to your build.gradle file. Ensure you have the appropriate repository configured.

    repositories {
        jcenter()
    }
    
    dependencies {
        compile 'com.github.almasb:fxgl:25'
    }
  3. Configure FXGL for modular applications

    dev

    If you are developing a modular Java application (using JPMS), include the following module-info.java configuration to require the FXGL module.

    open module app.name {
        requires com.almasb.fxgl.all;
    }
  4. Install FXGL using Maven

    dev

    Add the following dependency to your pom.xml file to include FXGL in your Java or Kotlin project.

    <dependency>
        <groupId>com.github.almasb</groupId>
        <artifactId>fxgl</artifactId>
        <version>25</version>
    </dependency>
  5. Install FXGL via Maven

    dev

    Add the following dependency to your pom.xml to use FXGL in your Maven project. The current version is 25.

    <dependency>
        <groupId>com.github.almasb</groupId>
        <artifactId>fxgl</artifactId>
        <version>25</version>
    </dependency>
  6. Configure Java Modules for FXGL

    dev

    If you are developing a modular application using the Java Module System, include the following requirement in your module-info.java file to access the FXGL API.

    open module app.name {
        requires com.almasb.fxgl.all;
    }
  7. Configure Java Modularity for FXGL

    dev

    If you are developing a modular application using the Java Module System, add the following requirement to your module-info.java file to access the FXGL API:

    open module app.name {
        requires com.almasb.fxgl.all;
    }
  8. Create a basic FXGL application

    dev

    To create a minimal FXGL game, extend the GameApplication class and override the initSettings(GameSettings settings) method to configure window properties like width, height, and title. Use GameApplication.launch(args) in the main method to start the application.

    public class BasicGameApp extends GameApplication {
    
        @Override
        protected void initSettings(GameSettings settings) {
            settings.setWidth(800);
            settings.setHeight(600);
            settings.setTitle("Basic Game App");
        }
    
        public static void main(String[] args) {
            launch(args);
        }
    }
  9. Create a minimal FXGL application

    dev

    To create a basic FXGL application, extend the GameApplication class and override the initSettings(GameSettings settings) method to configure your game's window properties such as width, height, and title. Use GameApplication.launch(args) in your main method to start the application.

    Supported platforms include Windows, Mac, Linux, Android 8+, iOS 11.0+, and Web. It supports Java 8 through 25.

    public class BasicGameApp extends GameApplication {
    
        @Override
        protected void initSettings(GameSettings settings) {
            settings.setWidth(800);
            settings.setHeight(600);
            settings.setTitle("Basic Game App");
        }
    
        public static void main(String[] args) {
            launch(args);
        }
    }