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 { buildscript {
repositories {
mavenLocal()
repositories { mavenCentral()
mavenLocal() gradlePluginPortal()
mavenCentral() }
gradlePluginPortal() dependencies {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } }
google()
}
dependencies {
}
} }
allprojects { allprojects {
apply plugin: "eclipse" apply plugin: "eclipse"
version = '1.0'
version = '1.0' ext {
ext { appName = "demo4d"
appName = "demo4d" gdxVersion = "1.10.0"
gdxVersion = '1.10.0' spairVersion = "1.86.0"
roboVMVersion = '2.3.12' nativefilechooserVersion = "1.0.0"
box2DLightsVersion = '1.5' }
ashleyVersion = '1.7.3' repositories {
aiVersion = '1.8.2' mavenLocal()
gdxControllersVersion = '2.1.0' mavenCentral {
} metadataSources {
mavenPom()
repositories { artifact()
mavenLocal() ignoreGradleMetadataRedirection()
mavenCentral() }
google() }
gradlePluginPortal() }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
} }
project(":desktop") { project(":desktop") {
apply plugin: "java-library" apply plugin: "java-library"
dependencies {
implementation project(":core")
dependencies { api "com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion"
implementation project(":core") api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" api "games.spooky.gdx:gdx-nativefilechooser-desktop:$nativefilechooserVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" }
}
} }
project(":core") { project(":core") {
apply plugin: "java-library" apply plugin: "java-library"
dependencies {
api "com.badlogicgames.gdx:gdx:$gdxVersion"
dependencies { api "io.github.spair:imgui-java-binding:$spairVersion"
api "com.badlogicgames.gdx:gdx:$gdxVersion" 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; package love.distributedrebirth.demo4d;
import java.util.List;
import com.badlogic.gdx.ApplicationAdapter; import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.ScreenUtils; import com.badlogic.gdx.utils.ScreenUtils;
import net.spookygames.gdx.nativefilechooser.NativeFileChooser;
public class MainScreen extends ApplicationAdapter { public class MainScreen extends ApplicationAdapter {
private List<String> args;
public NativeFileChooser fileChooser;
SpriteBatch batch; SpriteBatch batch;
BitmapFont font; BitmapFont font;
public MainScreen(List<String> args, NativeFileChooser fileChooser) {
this.args = args;
this.fileChooser = fileChooser;
}
@Override @Override
public void create () { public void create () {
batch = new SpriteBatch(); batch = new SpriteBatch();

View file

@ -1,12 +1,42 @@
package love.distributedrebirth.demo4d.desktop; package love.distributedrebirth.demo4d.desktop;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication; import java.util.Arrays;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; 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 love.distributedrebirth.demo4d.MainScreen;
import net.spookygames.gdx.nativefilechooser.desktop.DesktopFileChooser;
public class DesktopLauncher { 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) { public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); printMessage();
new LwjglApplication(new MainScreen(), config); 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...");
} }
} }