Fix canvas key callback signature
This commit is contained in:
parent
7269957ce5
commit
b736e44347
2 changed files with 8 additions and 9 deletions
|
|
@ -36,7 +36,7 @@ void glfw_error_callback(int error, const char* description) {
|
||||||
|
|
||||||
void (*canvas_on_close_cb)();
|
void (*canvas_on_close_cb)();
|
||||||
void (*canvas_on_resize_cb)();
|
void (*canvas_on_resize_cb)();
|
||||||
void (*canvas_on_key_cb)();
|
void (*canvas_on_key_cb)(int, int, int);
|
||||||
|
|
||||||
static int canvas_do_layout = 0;
|
static int canvas_do_layout = 0;
|
||||||
|
|
||||||
|
|
@ -90,12 +90,8 @@ static void canvas_on_key(GLFWwindow* window, int key, int scancode, int action,
|
||||||
|
|
||||||
static void canvas_on_key(GLFWwindow* window, int key, int scancode, int action,
|
static void canvas_on_key(GLFWwindow* window, int key, int scancode, int action,
|
||||||
int mods) {
|
int mods) {
|
||||||
printf("KEY: %u %u %u %u\n", key, scancode, action, mods);
|
if (action == GLFW_PRESS && canvas_on_key_cb)
|
||||||
if (action != GLFW_PRESS) {
|
(*canvas_on_key_cb)(key, scancode, mods);
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (canvas_on_key_cb)
|
|
||||||
(*canvas_on_key_cb)(key, scancode, action, mods);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void canvas_on_resize(GLFWwindow* window, int w, int h) {
|
static void canvas_on_resize(GLFWwindow* window, int w, int h) {
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h> //sprintf
|
#include <stdio.h> //sprintf
|
||||||
|
|
||||||
int px_width = 1024;
|
unsigned int px_width = 1024;
|
||||||
int px_height = 1024;
|
unsigned int px_height = 1024;
|
||||||
|
|
||||||
// Helper functions
|
// Helper functions
|
||||||
|
|
||||||
|
|
@ -103,6 +103,9 @@ void px_on_close(NetClient *client, int error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void px_on_key(int key, int scancode, int mods) {
|
void px_on_key(int key, int scancode, int mods) {
|
||||||
|
|
||||||
|
printf("Key pressed: key:%d scancode:%d mods:%d\n", key, scancode, mods);
|
||||||
|
|
||||||
if (key == 300) { // F11
|
if (key == 300) { // F11
|
||||||
int display = canvas_get_display();
|
int display = canvas_get_display();
|
||||||
if (display < 0)
|
if (display < 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue