Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.stefanbanu:FXGL:0.2.9'
}
dependencies {
implementation("com.github.stefanbanu:FXGL:0.2.9")
}
<dependency>
<groupId>com.github.stefanbanu</groupId>
<artifactId>FXGL</artifactId>
<version>0.2.9</version>
</dependency>
libraryDependencies += "com.github.stefanbanu" % "FXGL" % "0.2.9"
:dependencies [[com.github.stefanbanu/FXGL "0.2.9"]]
JavaFX Game Development Framework
Graphics & UI | Application Framework :---: | :---: JavaFX 8 | FXEventBus Multi-Layer Rendering | Time Management System (in-game time + real time) Canvas Particle System | Multithreading Dynamic Texture Manipulation | Log4j2 Sprite Sheet Animations | Performance Monitor + Profiling Target Screen Resolution (+Fullscreen) | Global Services Framework Customizable Intro Video / Animation | Developer Panel Customizable Main Menu / Game Menu (3 built-in menu styles) | GC-free Object Pooling Customizable UI elements (Dialogs, Bars, Buttons, etc)<br/><img src="https://raw.githubusercontent.com/AlmasB/git-server/master/storage/images/progress_bar.jpg" width="512" /><br/><img src="https://raw.githubusercontent.com/AlmasB/git-server/master/storage/images/profile.jpg" width="512" /> | Customizable Global CSS for menus / UI elements | Post-processing Effects (alpha) |
User Input | I/O :---: | :---: Key & Mouse Bindings | EasyIO & Networking (TCP and UDP) Full Input Mocking | Asset Management (".png", ".jpg", ".wav", ".mp3", ".txt", ".ttf/.otf", custom)
Physics | Utilities :---: | :---: JBox2D | GameUtils FXGL Physics (BBox + SAT) | Unified Collision Handling (JBox2D + FXGL physics) |
Gameplay | AI :---: | :---: Ents (ECS) | gdxAI Full Game Loop | AStar Quick Time Events (QTE)<br/><img src="https://raw.githubusercontent.com/AlmasB/git-server/master/storage/images/QTE.jpg" width="256" /> | JavaScript Behavior Injections (for entities) + JavaScript FXGL Environment Variables<br/><br/><img src="https://raw.githubusercontent.com/AlmasB/git-server/master/storage/images/JS.jpg" width="768" /> Achievement System| Notification System<br/><img src="https://raw.githubusercontent.com/AlmasB/git-server/master/storage/images/achievement.jpg" width="512" /> | Saving / Loading System | User Profiles (Save/Load/Restore Game Settings) | Level Parsers (.txt, .json (alpha) using jackson)| Quest Tracker<br/><img src="https://raw.githubusercontent.com/AlmasB/git-server/master/storage/images/quests.jpg" width="512" />|
If you have a use case (feature) that FXGL doesn't cover, raise an issue, carefully describing the use case.
You can browse sample games (with screenshots) on the FXGLGames website. The source code is included.
public class BasicGameApp extends GameApplication {
@Override
protected void initSettings(GameSettings settings) {
settings.setWidth(800);
settings.setHeight(600);
settings.setTitle("Basic Game App");
settings.setVersion("0.1");
// other settings
}
@Override
protected void initInput() {}
@Override
protected void initAssets() {}
@Override
protected void initGame() {}
@Override
protected void initPhysics() {}
@Override
protected void initUI() {}
@Override
protected void onUpdate(double tpf) {}
public static void main(String[] args) {
launch(args);
}
}
class BasicGameApp : GameApplication() {
override fun initSettings(settings: GameSettings) {
with(settings) {
width = 800
height = 600
title = "Basic Game App"
version = "0.1"
// other settings
}
}
override fun initInput() { }
override fun initAssets() { }
override fun initGame() { }
override fun initPhysics() { }
override fun initUI() { }
override fun onUpdate(tpf: Double) { }
}
fun main(args: Array<String>) {
Application.launch(BasicGameApp::class.java, *args)
}
<dependency>
<groupId>com.github.almasb</groupId>
<artifactId>fxgl</artifactId>
<version>0.2.9</version>
</dependency>
dependencies {
compile 'com.github.almasb:fxgl:0.2.9'
}
Latest pre-compiled uber jar can be found in Releases