summaryrefslogtreecommitdiff
path: root/src/gl/window.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-06-18 18:34:35 -0500
committersanine <sanine.not@pm.me>2022-06-18 18:34:35 -0500
commitf977596e6b8f37b471042607b795c662abd61cdb (patch)
tree9bdf211a0c69b3e55eb4f7bb9b3650e3d3e47c52 /src/gl/window.c
parenta73494d8858d67fd6b69ad4440b2b6657c0c9a5d (diff)
add tointeger
Diffstat (limited to 'src/gl/window.c')
-rw-r--r--src/gl/window.c51
1 files changed, 50 insertions, 1 deletions
diff --git a/src/gl/window.c b/src/gl/window.c
index 03afd24..e16b330 100644
--- a/src/gl/window.c
+++ b/src/gl/window.c
@@ -3,9 +3,10 @@
#include <lua.h>
#include <honeysuckle.h>
-
+/* build a table of all possible window hints */
void create_glfw_window_hints_table(lua_State *L)
{
+ /* hint keys */
hs_create_table(L,
/* window hints */
hs_str_int("resizable", GLFW_RESIZABLE),
@@ -44,8 +45,39 @@ void create_glfw_window_hints_table(lua_State *L)
hs_str_int("contextReleaseBehavior", GLFW_CONTEXT_RELEASE_BEHAVIOR),
hs_str_int("noError", GLFW_CONTEXT_NO_ERROR)
);
+
+ /* special hint values */
+ hs_create_table(L,
+ hs_str_int("dontCare", GLFW_DONT_CARE),
+
+ /* client api */
+ hs_str_int("glApi", GLFW_OPENGL_API),
+ hs_str_int("glesApi", GLFW_OPENGL_ES_API),
+ hs_str_int("noApi", GLFW_NO_API),
+
+ /* context api */
+ hs_str_int("nativeApi", GLFW_NATIVE_CONTEXT_API),
+ hs_str_int("eglApi", GLFW_EGL_CONTEXT_API),
+ hs_str_int("osMesaApi", GLFW_OSMESA_CONTEXT_API),
+
+ /* robustness */
+ hs_str_int("noRobustness", GLFW_NO_ROBUSTNESS),
+ hs_str_int("noResetNotification", GLFW_NO_RESET_NOTIFICATION),
+ hs_str_int("loseContextOnReset", GLFW_LOSE_CONTEXT_ON_RESET),
+
+ /* context release */
+ hs_str_int("anyBehavior", GLFW_ANY_RELEASE_BEHAVIOR),
+ hs_str_int("flush", GLFW_RELEASE_BEHAVIOR_FLUSH),
+ hs_str_int("none", GLFW_RELEASE_BEHAVIOR_NONE),
+
+ /* profile */
+ hs_str_int("anyProfile", GLFW_OPENGL_ANY_PROFILE),
+ hs_str_int("compatabilityProfile", GLFW_OPENGL_COMPAT_PROFILE),
+ hs_str_int("coreProfile", GLFW_OPENGL_CORE_PROFILE)
+ );
}
+
int gl_init(lua_State *L)
{
if (glfwInit() != GLFW_TRUE) {
@@ -53,3 +85,20 @@ int gl_init(lua_State *L)
}
return 0;
}
+
+
+lua_Integer tointeger(lua_State *L, int index)
+{
+ if (lua_isboolean(L, index)) {
+ return lua_toboolean(L, index);
+ }
+ else if (lua_isnumber(L, index)) {
+ return lua_tointeger(L, index);
+ }
+ else {
+ hs_throw_error(L,
+ "expected boolean or number; got %s instead",
+ lua_typename(L, lua_type(L, index))
+ );
+ }
+}