Use unsigned char for colors
This commit is contained in:
parent
061a694bdb
commit
3f9f1276d7
@ -5,6 +5,7 @@ typesIn = {
|
|||||||
"char": "luaL_checkinteger",
|
"char": "luaL_checkinteger",
|
||||||
"int": "luaL_checkinteger",
|
"int": "luaL_checkinteger",
|
||||||
"long long": "luaL_checkinteger",
|
"long long": "luaL_checkinteger",
|
||||||
|
"unsigned char": "luaL_checkinteger",
|
||||||
"char *": "(char *)luaL_checkstring"
|
"char *": "(char *)luaL_checkstring"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -13,6 +14,7 @@ typesOut = {
|
|||||||
"char": "lua_pushinteger",
|
"char": "lua_pushinteger",
|
||||||
"int": "lua_pushinteger",
|
"int": "lua_pushinteger",
|
||||||
"long long": "lua_pushinteger",
|
"long long": "lua_pushinteger",
|
||||||
|
"unsigned char": "lua_pushinteger",
|
||||||
"char *": "lua_pushstring"
|
"char *": "lua_pushstring"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ void engine_memory_free(void * pnt) {
|
|||||||
struct ENGINE_TEXTURE { int width; int height; struct ENGINE_FRONTEND_TEXTURE * fe_texture; };
|
struct ENGINE_TEXTURE { int width; int height; struct ENGINE_FRONTEND_TEXTURE * fe_texture; };
|
||||||
|
|
||||||
// COLOR
|
// 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
|
// WINDOWS
|
||||||
struct ENGINE_WINDOW { struct ENGINE_TEXTURE * texture; struct ENGINE_FRONTEND_WINDOW * fe_window; };
|
struct ENGINE_WINDOW { struct ENGINE_TEXTURE * texture; struct ENGINE_FRONTEND_WINDOW * fe_window; };
|
||||||
|
@ -34,7 +34,7 @@ struct ENGINE_COLOR engine_texture_color_get(struct ENGINE_TEXTURE * engine_text
|
|||||||
}
|
}
|
||||||
|
|
||||||
// COLOR
|
// 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
|
// RENDERTARGET
|
||||||
|
@ -38,7 +38,7 @@ void engine_rendertarget_draw_texture(struct ENGINE_TEXTURE * texture,int x,int
|
|||||||
}
|
}
|
||||||
|
|
||||||
void engine_rendertarget_draw_file(char * fpath) {
|
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");
|
FILE * f = fopen(fpath,"r");
|
||||||
fgets(buffer,engine_rendertarget->width * engine_rendertarget->height * 4,f);
|
fgets(buffer,engine_rendertarget->width * engine_rendertarget->height * 4,f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
@ -37,10 +37,10 @@ int engine_luaf_texture_destroy(lua_State *L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int engine_luaf_color_set(lua_State *L) {
|
int engine_luaf_color_set(lua_State *L) {
|
||||||
char r = luaL_checkinteger(L,1);
|
unsigned char r = luaL_checkinteger(L,1);
|
||||||
char g = luaL_checkinteger(L,2);
|
unsigned char g = luaL_checkinteger(L,2);
|
||||||
char b = luaL_checkinteger(L,3);
|
unsigned char b = luaL_checkinteger(L,3);
|
||||||
char a = luaL_checkinteger(L,4);
|
unsigned char a = luaL_checkinteger(L,4);
|
||||||
engine_color_set(r,g,b,a);
|
engine_color_set(r,g,b,a);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ description = "Free a texture from memory."
|
|||||||
# COLOR
|
# COLOR
|
||||||
[engine_color_set]
|
[engine_color_set]
|
||||||
type = "void"
|
type = "void"
|
||||||
arguments = ["char","char","char","char"]
|
arguments = ["unsigned char","unsigned char","unsigned char","unsigned char"]
|
||||||
argNames = ["r", "g", "b", "a"]
|
argNames = ["r", "g", "b", "a"]
|
||||||
description = "Set the color that points (pixels) should be drawn in."
|
description = "Set the color that points (pixels) should be drawn in."
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user