Upgraded to Lwjgl3 and add imgui and filechooser

This commit is contained in:
Willem Cazander 2022-01-28 10:32:01 +01:00
parent 190a08932c
commit 06ec684091
3 changed files with 87 additions and 54 deletions

View file

@ -1,61 +1,53 @@
buildscript {
repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
google()
}
dependencies {
}
}
allprojects {
apply plugin: "eclipse"
version = '1.0'
ext {
appName = "demo4d"
gdxVersion = '1.10.0'
roboVMVersion = '2.3.12'
box2DLightsVersion = '1.5'
ashleyVersion = '1.7.3'
aiVersion = '1.8.2'
gdxControllersVersion = '2.1.0'
gdxVersion = "1.10.0"
spairVersion = "1.86.0"
nativefilechooserVersion = "1.0.0"
}
repositories {
mavenLocal()
mavenCentral()
google()
gradlePluginPortal()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
mavenCentral {
metadataSources {
mavenPom()
artifact()
ignoreGradleMetadataRedirection()
}
}
}
}
project(":desktop") {
apply plugin: "java-library"
dependencies {
implementation project(":core")
api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
api "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
api "games.spooky.gdx:gdx-nativefilechooser-desktop:$nativefilechooserVersion"
}
}
project(":core") {
apply plugin: "java-library"
dependencies {
api "com.badlogicgames.gdx:gdx:$gdxVersion"
api "io.github.spair:imgui-java-binding:$spairVersion"
api "io.github.spair:imgui-java-lwjgl3:$spairVersion"
api "io.github.spair:imgui-java-natives-linux:$spairVersion"
api "io.github.spair:imgui-java-natives-macos:$spairVersion"
api "io.github.spair:imgui-java-natives-windows:$spairVersion"
api "games.spooky.gdx:gdx-nativefilechooser:$nativefilechooserVersion"
}
}

View file

@ -1,14 +1,25 @@
package love.distributedrebirth.demo4d;
import java.util.List;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.ScreenUtils;
import net.spookygames.gdx.nativefilechooser.NativeFileChooser;
public class MainScreen extends ApplicationAdapter {
private List<String> args;
public NativeFileChooser fileChooser;
SpriteBatch batch;
BitmapFont font;
public MainScreen(List<String> args, NativeFileChooser fileChooser) {
this.args = args;
this.fileChooser = fileChooser;
}
@Override
public void create () {
batch = new SpriteBatch();

View file

@ -1,12 +1,42 @@
package love.distributedrebirth.demo4d.desktop;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import java.util.Arrays;
import java.util.List;
import com.badlogic.gdx.Files.FileType;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
import love.distributedrebirth.demo4d.MainScreen;
import net.spookygames.gdx.nativefilechooser.desktop.DesktopFileChooser;
public class DesktopLauncher {
private static String WINDOW_TITLE = "demo⁴ᴰ";
private static String[] WINDOW_ICONS = {
"icon/window-128.png",
"icon/window-32.png",
"icon/window-16.png"
};
public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
new LwjglApplication(new MainScreen(), config);
printMessage();
List<String> args = Arrays.asList(arg);
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
config.setMaxNetThreads(Runtime.getRuntime().availableProcessors());
config.setTitle(WINDOW_TITLE);
config.setWindowedMode(800, 600);
config.setWindowIcon(FileType.Internal, WINDOW_ICONS);
new Lwjgl3Application(new MainScreen(args, new DesktopFileChooser()), config);
}
private static void printMessage() {
System.out.println("==========================");
System.out.println("\u4ed9⁴ ˧꜏⋇꜊꜔ ⁴ﷲΩ@ ");
System.out.println(" ©Δ∞ \u4ed9\u4e0a\u4e3b\u5929 ");
System.out.println("בְּרֵאשִׁית :o: יְסוֺד :o: יִשְׂרָאֵל");
System.out.println("==========================");
System.out.println("Welcome to the matrix;");
System.out.println("Starting demo⁴ᴰ now...");
}
}