From 23512a8ae6779ae2ee0102a8daa6de80fe2878a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sun, 28 Feb 2016 14:39:57 +0100 Subject: [PATCH] Fixed windows compilation --- src/c/fb.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/c/fb.c b/src/c/fb.c index d9b5b82..a8e8bbe 100644 --- a/src/c/fb.c +++ b/src/c/fb.c @@ -5,6 +5,7 @@ #include #include #include +#ifndef _WIN32 #include #include #include @@ -391,11 +392,6 @@ static int l_get_height (lua_State *L) { return 1; } -static int l_fb_ready (lua_State *L) { - lua_pushboolean(L, fb_ready); - return 1; -} - static int l_fb_getbg (lua_State *L) { int x = lua_tonumber(L, 1); int y = lua_tonumber(L, 2); @@ -429,7 +425,19 @@ static int l_fb_get (lua_State *L) { return 1; } +#endif + +static int l_fb_ready (lua_State *L) { +#ifndef _WIN32 + lua_pushboolean(L, fb_ready); +#else + lua_pushboolean(L, 0); +#endif + return 1; +} + void fb_start(lua_State *L) { +#ifndef _WIN32 fb_file = open("/dev/fb0", O_RDWR); if (fb_file == -1) { printf("Error: cannot open framebuffer device"); @@ -484,18 +492,22 @@ void fb_start(lua_State *L) { fb_ready = 1; +#endif + struct luaL_Reg fblib[] = { +#ifndef _WIN32 {"setPalette", l_set_palette}, {"getWidth", l_get_width}, {"getHeight", l_get_height}, {"put", l_fbput}, {"copy", l_fbcopy}, {"fill", l_fbfill}, - {"isReady", l_fb_ready}, {"getBackground", l_fb_getbg}, {"getForeground", l_fb_getfg}, {"get", l_fb_get}, {"getNearest", l_get_nearest}, +#endif + {"isReady", l_fb_ready}, {NULL, NULL} };