aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-11-07 06:30:59 +0100
committerdec05eba <dec05eba@protonmail.com>2021-11-07 06:30:59 +0100
commit214336492da0d184d5ad4ac64c31920954c5f7e7 (patch)
treeebcb9e7ace6022f7afe383f1aea986260fffd09f /include
parentcb679636f77fe2a03e8dab3a511e28e1ab898316 (diff)
Implement text input
Diffstat (limited to 'include')
-rw-r--r--include/mgl/window/event.h7
-rw-r--r--include/mgl/window/window.h5
2 files changed, 9 insertions, 3 deletions
diff --git a/include/mgl/window/event.h b/include/mgl/window/event.h
index c928d0e..0836098 100644
--- a/include/mgl/window/event.h
+++ b/include/mgl/window/event.h
@@ -3,6 +3,7 @@
#include "key.h"
#include <stdbool.h>
+#include <stdint.h>
typedef struct mgl_event mgl_event;
@@ -12,6 +13,10 @@ typedef struct {
} mgl_size_event;
typedef struct {
+ uint32_t codepoint;
+} mgl_text_event;
+
+typedef struct {
int code; /* mgl_key */
bool alt;
bool control;
@@ -43,6 +48,7 @@ typedef enum {
MGL_EVENT_UNKNOWN,
MGL_EVENT_CLOSED, /* Window closed */
MGL_EVENT_RESIZED, /* Window resized */
+ MGL_EVENT_TEXT_ENTERED,
MGL_EVENT_KEY_PRESSED,
MGL_EVENT_KEY_RELEASED,
MGL_EVENT_MOUSE_BUTTON_PRESSED,
@@ -54,6 +60,7 @@ struct mgl_event {
int type; /* mgl_event_type */
union {
mgl_size_event size;
+ mgl_text_event text;
mgl_key_event key;
mgl_mouse_button_event mouse_button;
mgl_mouse_move_event mouse_move;
diff --git a/include/mgl/window/window.h b/include/mgl/window/window.h
index cb8baf6..9d7086c 100644
--- a/include/mgl/window/window.h
+++ b/include/mgl/window/window.h
@@ -5,9 +5,8 @@
#include "../system/vec.h"
#include <stdbool.h>
-/* Vsync is automatically set for windows created, if supported by the system */
+/* Vsync is automatically set for created windows, if supported by the system */
-typedef struct __GLXcontextRec *GLXContext;
typedef struct mgl_event mgl_event;
/* x11 window handle. TODO: Add others when wayland, etc is added */
typedef unsigned long mgl_window_handle;
@@ -21,7 +20,7 @@ typedef struct {
struct mgl_window {
mgl_window_handle window;
- GLXContext glx_context;
+ void *context;
mgl_vec2i size;
/* relative to the top left of the window. only updates when the cursor is inside the window */
mgl_vec2i cursor_position;