Skip to content

Commit

Permalink
BaseApplication: add the InputManager
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Aug 9, 2023
1 parent 6c925dd commit a990272
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
*/
package com.github.stephengold.vsport;

import com.github.stephengold.vsport.input.InputManager;
import java.io.PrintStream;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
Expand Down Expand Up @@ -151,6 +152,10 @@ public abstract class BaseApplication {
* synchronization objects for frames in flight
*/
private static Frame[] inFlightFrames;
/**
* convenient access to user input
*/
private static InputManager inputManager;
/**
* index of the frame being rendered (among the inFlightFrames)
*/
Expand Down Expand Up @@ -580,6 +585,9 @@ public void start(
// Initialize this class:
initializeGlfw(title);

// Create and initialize the InputManager.
inputManager = new InputManager(windowHandle);

requiredDeviceExtensions
.add(KHRSwapchain.VK_KHR_SWAPCHAIN_EXTENSION_NAME);
if (enableDebugging) {
Expand Down Expand Up @@ -733,6 +741,10 @@ private void cleanUpBase() {
vkInstance = null;
}

if (inputManager != null) {
inputManager = inputManager.destroy();
}

if (debugMessengerCallback != null) {
debugMessengerCallback.free();
debugMessengerCallback = null;
Expand Down

0 comments on commit a990272

Please sign in to comment.