Skip to content

Commit

Permalink
update gdx tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xpenatan committed Dec 5, 2023
1 parent aae3a3d commit 184bfac
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ object LibExt {
const val teaVMVersion = "0.10.0-dev-2"

const val gdxImGuiVersion = "1.0.0-SNAPSHOT"
const val gdxFrameViewportVersion = "1.0.0-SNAPSHOT"
const val gdxMultiViewVersion = "1.0.0-SNAPSHOT"

const val reflectionVersion = "0.10.2"
const val jettyVersion = "11.0.13"
Expand Down
2 changes: 1 addition & 1 deletion examples/gdx-tests/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies {
implementation("com.github.xpenatan.gdx-imgui:gdx:${LibExt.gdxImGuiVersion}")

// Optional
implementation("com.github.xpenatan:gdx-frame-viewport:${LibExt.gdxFrameViewportVersion}")
implementation("com.github.xpenatan.gdx-multi-view:core:${LibExt.gdxMultiViewVersion}")

api("com.badlogicgames.gdx:gdx-tests")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,13 @@ public GdxTest instance() {
// }
// }
// );
//// test.add(
//// new TeaVMInstancer() {
//// public GdxTest instance() {
//// return new DownloadTest();
//// }
//// }
//// );
test.add(
new TeaVMInstancer() {
public GdxTest instance() {
return new DownloadTest();
}
}
);
// test.add(
// new TeaVMInstancer() {
// public GdxTest instance() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Rectangle;
import com.github.xpenatan.gdx.frame.viewport.EmuApplicationWindow;
import com.github.xpenatan.gdx.multiview.EmuApplicationWindow;

public class GameFrame {
public int windowX;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
package com.github.xpenatan.imgui.example.tests.imgui;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.tests.InputTest;
import com.badlogic.gdx.tests.utils.GdxTest;
import com.github.xpenatan.gdx.frame.viewport.EmuFrameBuffer;
import com.badlogic.gdx.tests.TeaVMGdxTests;
import com.github.xpenatan.gdx.multiview.EmuFrameBuffer;
import com.github.xpenatan.imgui.example.tests.frame.GameFrame;
import com.github.xpenatan.imgui.gdx.ImGuiGdxImpl;
import com.github.xpenatan.imgui.gdx.ImGuiGdxInputMultiplexer;
import imgui.ImDrawData;
import imgui.ImGui;
import imgui.ImGuiBoolean;
import imgui.ImGuiIO;
import imgui.ImVec2;

Expand All @@ -28,7 +26,6 @@ public class ImGuiTestsApp implements Screen {

boolean gdxTestInit = false;

ImGuiBoolean booleanFlag;
int selected = -1;

private GameFrame gameFrame;
Expand All @@ -46,8 +43,6 @@ public void show() {
camera.setToOrtho(true);
batch = new SpriteBatch();

booleanFlag = new ImGuiBoolean();

ImGuiIO io = ImGui.GetIO();

// io.setIniFilename(null);
Expand All @@ -65,18 +60,18 @@ public void show() {
gameFrame.emuWindow.setApplicationListener(new InputTest());

ImGuiGdxInputMultiplexer multiplexer = new ImGuiGdxInputMultiplexer();
multiplexer.addProcessor(gameFrame.emuWindow.getInput());
multiplexer.addProcessor(gameFrame.emuWindow.getEmuInput());
Gdx.input.setInputProcessor(multiplexer);
}

private void drawTestListWindow() {
if(!gdxTestInit) {
gdxTestInit = true;
ImGui.SetNextWindowSize(ImVec2.TMP.set(200, 500));
ImGui.SetNextWindowPos(ImVec2.TMP.set(900, 20));
ImGui.SetNextWindowSize(ImVec2.TMP_1.set(200, 500));
ImGui.SetNextWindowPos(ImVec2.TMP_1.set(900, 20));
}
ImGui.Begin("GdxTests");
ImGui.BeginChildFrame(313, ImVec2.TMP.set(0f, 0f));
ImGui.BeginChildFrame(313, ImVec2.TMP_1.set(0f, 0f));
for(int i = 0; i < testList.length; i++) {
String testName = testList[i].getSimpleName();
boolean isSelected = selected == i;
Expand Down
2 changes: 1 addition & 1 deletion examples/gdx-tests/desktop/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dependencies {
implementation(project(":examples:gdx-tests:core"))
// need to use lwjgl2 because lwjgl3 call makeCurrent and replace Gdx.input used inside gdx wrapper.
implementation("com.badlogicgames.gdx:gdx-backend-lwjgl3:${LibExt.gdxVersion}")
implementation("com.badlogicgames.gdx:gdx-backend-lwjgl:${LibExt.gdxVersion}")
implementation("com.badlogicgames.gdx:gdx-platform:${LibExt.gdxVersion}:natives-desktop")

implementation("com.github.xpenatan.gdx-imgui:desktop:${LibExt.gdxImGuiVersion}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
package com.github.xpenatan.imgui.example.tests;


import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.badlogic.gdx.tests.DownloadTest;
import com.badlogic.gdx.tests.FloatTextureTest;
import com.badlogic.gdx.tests.g3d.MultipleRenderTargetTest;
import com.badlogic.gdx.tests.g3d.TextureArrayTest;
import com.badlogic.gdx.tests.g3d.TextureRegion3DTest;
import com.badlogic.gdx.tests.gles3.InstancedRenderingTest;
import com.github.xpenatan.imgui.example.tests.imgui.ImGuiGame;
import com.github.xpenatan.imgui.example.tests.wrapper.TeaVMTestWrapper;

public class Main {
public static void main(String[] args) {
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
config.setWindowedMode(1444, 800);
config.setTitle("gdx-tests");
config.setOpenGLEmulation(Lwjgl3ApplicationConfiguration.GLEmulation.GL30, 4, 3);
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.width = 1444;
config.height = 800;
config.title = "gdx-tests";
config.gles30ContextMajorVersion = 4;
config.gles30ContextMinorVersion = 3;
config.useGL30 = true;
// new Lwjgl3Application(new MultipleRenderTargetTest(), config);
// new Lwjgl3Application(new FloatTextureTest(), config);
new Lwjgl3Application(new ImGuiGame(), config);
new LwjglApplication(new TeaVMTestWrapper(), config);
}
}
2 changes: 1 addition & 1 deletion examples/gdx-tests/teavm/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies {
implementation(project(":backends:backend-teavm"))
implementation(project(":extensions:gdx-freetype-teavm"))

implementation("com.github.xpenatan.gdx-imgui:core-teavm:${LibExt.gdxImGuiVersion}")
implementation("com.github.xpenatan.gdx-imgui:teavm:${LibExt.gdxImGuiVersion}")
}

val mainClassName = "com.github.xpenatan.gdx.examples.teavm.BuildGdxTest"
Expand Down
4 changes: 2 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ include(":examples:freetype:desktop")
include(":examples:freetype:teavm")

// ######### Add libgdx tests to project
// ######### Need to have libgdx project source code tag 1.12.0.
// ######### Need to disable in libgdx settings :tests:gdx-tests-android, :tests:gdx-tests-gwt and :backends:gdx-backend-android because of some conflicts
// ######### Need to have libgdx project source code tag 1.12.1.
// ######### Need to disable in libgdx settings :tests:gdx-tests-gwt because of some conflicts
// ######### Need to update assets path in desktop gradle and teavm build class.

//include(":examples:gdx-tests:core")
Expand Down

0 comments on commit 184bfac

Please sign in to comment.