(final Configuration config)
| 57 | private boolean shouldClose; |
| 58 | |
| 59 | @Override |
| 60 | protected void init(final Configuration config) { |
| 61 | if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMEPAD)) { |
| 62 | throw new IllegalStateException("Unable to initialize SDL3: " + SDL_GetError()); |
| 63 | } |
| 64 | |
| 65 | final long flags = SDL_WINDOW_HIGH_PIXEL_DENSITY | SDL_WINDOW_RESIZABLE; |
| 66 | handle = SDL_CreateWindow(config.getTitle(), config.getWidth(), config.getHeight(), flags); |
| 67 | if (handle == 0L) { |
| 68 | throw new RuntimeException("Failed to create the SDL window: " + SDL_GetError()); |
| 69 | } |
| 70 | if (config.isFullScreen()) { |
| 71 | SDL_MaximizeWindow(handle); |
| 72 | } |
| 73 | |
| 74 | // Create SDL_GPU device matching whatever shader format we ship. |
| 75 | final int shaderFormats = SDL_GPU_SHADERFORMAT_SPIRV | SDL_GPU_SHADERFORMAT_DXBC | SDL_GPU_SHADERFORMAT_METALLIB; |
| 76 | gpuDevice = SDL_CreateGPUDevice(shaderFormats, false, (java.nio.ByteBuffer) null); |
| 77 | if (gpuDevice == 0L) { |
| 78 | throw new RuntimeException("Failed to create the SDL_GPU device: " + SDL_GetError()); |
| 79 | } |
| 80 | if (!SDL_ClaimWindowForGPUDevice(gpuDevice, handle)) { |
| 81 | throw new RuntimeException("Failed to claim window for SDL_GPU device: " + SDL_GetError()); |
| 82 | } |
| 83 | |
| 84 | owner.initImGui(config); |
| 85 | |
| 86 | imGuiSdl3.initForSDLGPU(handle); |
| 87 | |
| 88 | final ImGuiImplSdlGpu3.InitInfo initInfo = new ImGuiImplSdlGpu3.InitInfo() |
| 89 | .setDevice(gpuDevice) |
| 90 | .setColorTargetFormat(SDL_GetGPUSwapchainTextureFormat(gpuDevice, handle)); |
| 91 | imGuiSdlGpu3.init(initInfo); |
| 92 | } |
| 93 | |
| 94 | @Override |
| 95 | protected void dispose() { |
nothing calls this directly
no test coverage detected