[nostalgia/core/glfw] Fix keyboard support for ImGui
This commit is contained in:
@@ -15,24 +15,6 @@ namespace nostalgia::core {
|
||||
|
||||
void draw(Context *ctx) noexcept;
|
||||
|
||||
static void handleKeyPress(Context *ctx, int key) {
|
||||
switch (key) {
|
||||
case GLFW_KEY_ESCAPE:
|
||||
case GLFW_KEY_Q:
|
||||
shutdown(ctx);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void handleGlfwKeyEvent(GLFWwindow *window, int key, int, int action, int) {
|
||||
const auto ctx = static_cast<Context*>(glfwGetWindowUserPointer(window));
|
||||
if (action == GLFW_PRESS) {
|
||||
handleKeyPress(ctx, key);
|
||||
}
|
||||
}
|
||||
|
||||
ox::Result<ox::UniquePtr<Context>> init(ox::UniquePtr<ox::FileSystem> fs, const char *appName) noexcept {
|
||||
auto ctx = ox::make_unique<Context>();
|
||||
ctx->rom = std::move(fs);
|
||||
@@ -43,7 +25,6 @@ ox::Result<ox::UniquePtr<Context>> init(ox::UniquePtr<ox::FileSystem> fs, const
|
||||
id->startTime = duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
|
||||
glfwInit();
|
||||
oxReturnError(initGfx(ctx.get()));
|
||||
glfwSetKeyCallback(id->window, handleGlfwKeyEvent);
|
||||
return ctx;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user