aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/pugl_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'pugl/pugl_internal.h')
-rw-r--r--pugl/pugl_internal.h56
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