Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions example/src/main/java/ExampleVulkan.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import imgui.ImGui;
import imgui.app.Application;
import imgui.app.Backend;
import imgui.app.Configuration;

/**
* Smoke-test entry point for the Vulkan backend. Run with:
* <pre>
* ./gradlew :example:run -PmainClass=ExampleVulkan
* </pre>
*/
public class ExampleVulkan extends Application {
@Override
protected void configure(final Configuration config) {
config.setTitle("Example Application — Vulkan");
config.setBackend(Backend.VULKAN);
}

@Override
public void process() {
ImGui.begin("Vulkan");
ImGui.text("Hello from the Vulkan backend!");
ImGui.end();
}

public static void main(final String[] args) {
launch(new ExampleVulkan());
}
}
5 changes: 5 additions & 0 deletions imgui-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dependencies {
api 'org.lwjgl:lwjgl-glfw'
api 'org.lwjgl:lwjgl-opengl'
api 'org.lwjgl:lwjgl-sdl'
api 'org.lwjgl:lwjgl-vulkan'

['natives-linux', 'natives-windows', 'natives-macos', 'natives-macos-arm64'].each {
api "org.lwjgl:lwjgl::$it"
Expand All @@ -31,6 +32,10 @@ dependencies {
api "org.lwjgl:lwjgl-sdl::$it"
}

['natives-macos', 'natives-macos-arm64'].each {
api "org.lwjgl:lwjgl-vulkan::$it"
}

api project(':imgui-binding')
api project(':imgui-lwjgl3')
}
Expand Down
13 changes: 12 additions & 1 deletion imgui-app/src/main/java/imgui/app/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,18 @@ public final Color getColorBg() {
public static void launch(final Application app) {
final Configuration config = new Configuration();
app.configure(config);
app.window = (config.getBackend() == Backend.SDL) ? new WindowSdl() : new WindowGlfw();
switch (config.getBackend()) {
case SDL:
app.window = new WindowSdl();
break;
case VULKAN:
app.window = new WindowVulkan();
break;
case GLFW:
default:
app.window = new WindowGlfw();
break;
}
app.window.setOwner(app);
app.window.init(config);
app.preRun();
Expand Down
6 changes: 5 additions & 1 deletion imgui-app/src/main/java/imgui/app/Backend.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@ public enum Backend {
/**
* SDL3 platform + SDL_GPU renderer.
*/
SDL
SDL,
/**
* GLFW platform + Vulkan renderer.
*/
VULKAN
}
Loading
Loading