diff --git a/lua_translate b/lua_translate index dcf177a..b16ab97 100755 --- a/lua_translate +++ b/lua_translate @@ -5,6 +5,7 @@ typesIn = { "char": "luaL_checkinteger", "int": "luaL_checkinteger", "long long": "luaL_checkinteger", + "unsigned char": "luaL_checkinteger", "char *": "(char *)luaL_checkstring" } @@ -13,6 +14,7 @@ typesOut = { "char": "lua_pushinteger", "int": "lua_pushinteger", "long long": "lua_pushinteger", + "unsigned char": "lua_pushinteger", "char *": "lua_pushstring" } diff --git a/src/engine.c b/src/engine.c index 3613279..8cb18f7 100644 --- a/src/engine.c +++ b/src/engine.c @@ -16,7 +16,7 @@ void engine_memory_free(void * pnt) { struct ENGINE_TEXTURE { int width; int height; struct ENGINE_FRONTEND_TEXTURE * fe_texture; }; // COLOR -struct ENGINE_COLOR { char r; char g; char b; char a; }; +struct ENGINE_COLOR { unsigned char r; unsigned char g; unsigned char b; unsigned char a; }; // WINDOWS struct ENGINE_WINDOW { struct ENGINE_TEXTURE * texture; struct ENGINE_FRONTEND_WINDOW * fe_window; }; diff --git a/src/frontend/null/main.c b/src/frontend/null/main.c index 7f1a51e..38f6819 100644 --- a/src/frontend/null/main.c +++ b/src/frontend/null/main.c @@ -34,7 +34,7 @@ struct ENGINE_COLOR engine_texture_color_get(struct ENGINE_TEXTURE * engine_text } // COLOR -void engine_color_set(char r,char g,char b,char a) { +void engine_color_set(unsigned char r,unsigned char g,unsigned char b,unsigned char a) { } // RENDERTARGET diff --git a/src/helpers.c b/src/helpers.c index 855c4e9..ce16e59 100644 --- a/src/helpers.c +++ b/src/helpers.c @@ -38,7 +38,7 @@ void engine_rendertarget_draw_texture(struct ENGINE_TEXTURE * texture,int x,int } void engine_rendertarget_draw_file(char * fpath) { - char buffer[engine_rendertarget->width * engine_rendertarget->height * 4]; + unsigned char buffer[engine_rendertarget->width * engine_rendertarget->height * 4]; FILE * f = fopen(fpath,"r"); fgets(buffer,engine_rendertarget->width * engine_rendertarget->height * 4,f); fclose(f); diff --git a/src/lua.c b/src/lua.c index 7faa167..00317da 100644 --- a/src/lua.c +++ b/src/lua.c @@ -37,10 +37,10 @@ int engine_luaf_texture_destroy(lua_State *L) { } int engine_luaf_color_set(lua_State *L) { - char r = luaL_checkinteger(L,1); - char g = luaL_checkinteger(L,2); - char b = luaL_checkinteger(L,3); - char a = luaL_checkinteger(L,4); + unsigned char r = luaL_checkinteger(L,1); + unsigned char g = luaL_checkinteger(L,2); + unsigned char b = luaL_checkinteger(L,3); + unsigned char a = luaL_checkinteger(L,4); engine_color_set(r,g,b,a); return 0; } diff --git a/src/values/functions.toml b/src/values/functions.toml index 1fe6061..02ecd0a 100644 --- a/src/values/functions.toml +++ b/src/values/functions.toml @@ -48,8 +48,8 @@ description = "Free a texture from memory." # COLOR [engine_color_set] type = "void" -arguments = ["char","char","char","char"] -argNames = ["r", "g", "b", "a"] +arguments = ["unsigned char","unsigned char","unsigned char","unsigned char"] +argNames = ["r", "g", "b", "a"] description = "Set the color that points (pixels) should be drawn in." # RENDERTARGET