summaryrefslogtreecommitdiff
path: root/src/glfw/init.c
blob: 6d91d28bf189d0446276316939e746a86162964d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <lua.h>
#include <lauxlib.h>
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include "setup.h"


int glfwInit_bind(lua_State *L)
{
	int bind_result = glfwInit();
	lua_pushinteger(L, bind_result);
	return 1;
}


int glfwTerminate_bind(lua_State *L)
{
	glfwTerminate();
	return 0;
}


int glfwInitHint_bind(lua_State *L)
{
	int hint = luaL_checkinteger(L, 1);
	int value = luaL_checkinteger(L, 2);
	glfwInitHint(hint, value);
	return 0;
}


int glfwGetVersion_bind(lua_State *L)
{
	int major, minor, rev;
	glfwGetVersion(&major, &minor, &rev);
	lua_pushinteger(L, major);
	lua_pushinteger(L, minor);
	lua_pushinteger(L, rev);
	return 3;
}


int glfwGetVersionString_bind(lua_State *L)
{
	const char * bind_result = glfwGetVersionString();
	lua_pushstring(L, bind_result);
	return 1;
}


int glfwGetError_bind(lua_State *L)
{
	const char * description;
	int bind_result = glfwGetError(&description);
	lua_pushinteger(L, bind_result);
	lua_pushstring(L, description);
	return 2;
}