diff options
author | David Robillard <d@drobilla.net> | 2019-02-17 20:49:15 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-02-17 21:16:57 +0100 |
commit | 197c19b74bd26f5a7526a88621a556f551b2db5a (patch) | |
tree | c9462855439c6f9cbd9f02cd5d754e5b55a73835 /pugl/pugl_internal.h | |
parent | 51dcb00d5a5e6874f1e83d9cafb9ca2c1bd8bbf7 (diff) | |
download | pugl-197c19b74bd26f5a7526a88621a556f551b2db5a.tar.gz pugl-197c19b74bd26f5a7526a88621a556f551b2db5a.tar.bz2 pugl-197c19b74bd26f5a7526a88621a556f551b2db5a.zip |
Add configuration API
Diffstat (limited to 'pugl/pugl_internal.h')
-rw-r--r-- | pugl/pugl_internal.h | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/pugl/pugl_internal.h b/pugl/pugl_internal.h index 2b09761..2b54de4 100644 --- a/pugl/pugl_internal.h +++ b/pugl/pugl_internal.h @@ -36,6 +36,15 @@ PuglInternals* puglInitInternals(void); +static PuglHints +puglDefaultHints() +{ + static const PuglHints hints = { + 2, 0, 4, 4, 4, 4, 24, 8, 0, true, true, false + }; + return hints; +} + PuglView* puglInit(int* pargc, char** argv) { @@ -44,6 +53,8 @@ puglInit(int* pargc, char** argv) return NULL; } + view->hints = puglDefaultHints(); + PuglInternals* impl = puglInitInternals(); if (!impl) { return NULL; @@ -58,6 +69,49 @@ puglInit(int* pargc, char** argv) } void +puglInitWindowHint(PuglView* view, PuglWindowHint hint, int value) +{ + switch (hint) { + case PUGL_USE_COMPAT_PROFILE: + view->hints.use_compat_profile = value; + break; + case PUGL_CONTEXT_VERSION_MAJOR: + view->hints.context_version_major = value; + break; + case PUGL_CONTEXT_VERSION_MINOR: + view->hints.context_version_minor = value; + break; + case PUGL_RED_BITS: + view->hints.red_bits = value; + break; + case PUGL_GREEN_BITS: + view->hints.green_bits = value; + break; + case PUGL_BLUE_BITS: + view->hints.blue_bits = value; + break; + case PUGL_ALPHA_BITS: + view->hints.alpha_bits = value; + break; + case PUGL_DEPTH_BITS: + view->hints.depth_bits = value; + break; + case PUGL_STENCIL_BITS: + view->hints.stencil_bits = value; + break; + case PUGL_SAMPLES: + view->hints.samples = value; + break; + case PUGL_DOUBLE_BUFFER: + view->hints.double_buffer = value; + break; + case PUGL_RESIZABLE: + view->hints.resizable = value; + break; + } +} + +void puglInitWindowSize(PuglView* view, int width, int height) { view->width = width; @@ -103,7 +157,7 @@ puglInitWindowParent(PuglView* view, PuglNativeWindow parent) void puglInitResizable(PuglView* view, bool resizable) { - view->resizable = resizable; + view->hints.resizable = resizable; } void |