summaryrefslogtreecommitdiff
path: root/pugl/pugl.h
diff options
context:
space:
mode:
Diffstat (limited to 'pugl/pugl.h')
-rw-r--r--pugl/pugl.h98
1 files changed, 17 insertions, 81 deletions
diff --git a/pugl/pugl.h b/pugl/pugl.h
index 8cd8afb..d13ce12 100644
--- a/pugl/pugl.h
+++ b/pugl/pugl.h
@@ -23,6 +23,9 @@
#include <stdint.h>
+#include "pugl/common.h"
+#include "pugl/event.h"
+
#ifdef PUGL_SHARED
# ifdef _WIN32
# define PUGL_LIB_IMPORT __declspec(dllimport)
@@ -53,88 +56,9 @@ extern "C" {
*/
/**
- An OpenGL view.
-*/
-typedef struct PuglViewImpl PuglView;
-
-/**
- A native window handle.
-
- On X11, this is a Window.
- On OSX, this is an NSView*.
- On Windows, this is a HWND.
-*/
-typedef intptr_t PuglNativeWindow;
-
-/**
- Return status code.
+ A function called when an event occurs.
*/
-typedef enum {
- PUGL_SUCCESS = 0
-} PuglStatus;
-
-/**
- Drawing context type.
-*/
-typedef enum {
- PUGL_GL,
- PUGL_CAIRO
-} PuglContextType;
-
-/**
- Convenience symbols for ASCII control characters.
-*/
-typedef enum {
- PUGL_CHAR_BACKSPACE = 0x08,
- PUGL_CHAR_ESCAPE = 0x1B,
- PUGL_CHAR_DELETE = 0x7F
-} PuglChar;
-
-/**
- Special (non-Unicode) keyboard keys.
-*/
-typedef enum {
- PUGL_KEY_F1 = 1,
- PUGL_KEY_F2,
- PUGL_KEY_F3,
- PUGL_KEY_F4,
- PUGL_KEY_F5,
- PUGL_KEY_F6,
- PUGL_KEY_F7,
- PUGL_KEY_F8,
- PUGL_KEY_F9,
- PUGL_KEY_F10,
- PUGL_KEY_F11,
- PUGL_KEY_F12,
- PUGL_KEY_LEFT,
- PUGL_KEY_UP,
- PUGL_KEY_RIGHT,
- PUGL_KEY_DOWN,
- PUGL_KEY_PAGE_UP,
- PUGL_KEY_PAGE_DOWN,
- PUGL_KEY_HOME,
- PUGL_KEY_END,
- PUGL_KEY_INSERT,
- PUGL_KEY_SHIFT,
- PUGL_KEY_CTRL,
- PUGL_KEY_ALT,
- PUGL_KEY_SUPER
-} PuglKey;
-
-/**
- Keyboard modifier flags.
-*/
-typedef enum {
- PUGL_MOD_SHIFT = 1, /**< Shift key */
- PUGL_MOD_CTRL = 1 << 1, /**< Control key */
- PUGL_MOD_ALT = 1 << 2, /**< Alt/Option key */
- PUGL_MOD_SUPER = 1 << 3 /**< Mod4/Command/Windows key */
-} PuglMod;
-
-/**
- Handle for opaque user data.
-*/
-typedef void* PuglHandle;
+typedef void (*PuglEventFunc)(PuglView* view, const PuglEvent* event);
/**
A function called when the window is closed.
@@ -314,6 +238,12 @@ PUGL_API void
puglIgnoreKeyRepeat(PuglView* view, bool ignore);
/**
+ Set the function to call when an event occurs.
+*/
+PUGL_API void
+puglSetEventFunc(PuglView* view, PuglEventFunc eventFunc);
+
+/**
Set the function to call when the window is closed.
*/
PUGL_API void
@@ -368,6 +298,12 @@ PUGL_API PuglNativeWindow
puglGetNativeWindow(PuglView* view);
/**
+ Grab the input focus.
+*/
+PUGL_API void
+puglGrabFocus(PuglView* view);
+
+/**
Process all pending window events.
This handles input events as well as rendering, so it should be called