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-windows-arm64', '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
8 changes: 5 additions & 3 deletions imgui-app/src/main/java/imgui/app/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
* <h2>Life-cycle</h2>
* <p>The entry point for ImGui applications is the Application class and {@link #launch(Application)} method.
* It builds a {@link Configuration}, lets the user customize it (including selecting a {@link Backend}), then
* instantiates the matching {@link Window} subclass ({@link WindowGlfw}, {@link WindowSdl} or
* {@link WindowSdlRenderer}) and drives the
* application loop:
* instantiates the matching {@link Window} subclass ({@link WindowGlfw}, {@link WindowSdl},
* {@link WindowSdlRenderer} or {@link WindowVulkan}) and drives the application loop:
*
* <ol>
* <li>{@link #configure(Configuration)} It's called before window creation, so only basic application setups are expected.</li>
Expand Down Expand Up @@ -142,6 +141,9 @@ public static void launch(final Application app) {
case SDL_RENDERER:
app.window = new WindowSdlRenderer();
break;
case VULKAN:
app.window = new WindowVulkan();
break;
case GLFW:
default:
app.window = new WindowGlfw();
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 @@ -15,5 +15,9 @@ public enum Backend {
/**
* SDL3 platform + SDL_Renderer renderer.
*/
SDL_RENDERER
SDL_RENDERER,
/**
* GLFW platform + Vulkan renderer.
*/
VULKAN
}
4 changes: 2 additions & 2 deletions imgui-app/src/main/java/imgui/app/Window.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

/**
* Abstract base for an application window. Subclasses bind a specific platform/renderer pair
* (see {@link WindowGlfw}, {@link WindowSdl}, {@link WindowSdlRenderer}) and forward lifecycle hooks back to the owning
* {@link Application} via {@link #owner}.
* (see {@link WindowGlfw}, {@link WindowSdl}, {@link WindowSdlRenderer} or {@link WindowVulkan}) and
* forward lifecycle hooks back to the owning {@link Application} via {@link #owner}.
*
* <p>Direct subclassing is supported but the supported integration path is to extend
* {@link Application} and select a backend through {@link Configuration#setBackend(Backend)}.
Expand Down
Loading
Loading