mirror of
https://github.com/keharriso/love-nuklear.git
synced 2025-09-10 16:17:47 -04:00
Merge pull request #26 from jamestn529/master
Change color scale to 0 - 1.0
This commit is contained in:
commit
36b788c05a
1 changed files with 23 additions and 23 deletions
|
@ -60,10 +60,10 @@ static void nk_love_configureGraphics(int line_thickness, struct nk_color col)
|
|||
lua_call(L, 1, 0);
|
||||
}
|
||||
lua_getfield(L, -1, "setColor");
|
||||
lua_pushnumber(L, col.r);
|
||||
lua_pushnumber(L, col.g);
|
||||
lua_pushnumber(L, col.b);
|
||||
lua_pushnumber(L, col.a);
|
||||
lua_pushnumber(L, col.r / 255.0);
|
||||
lua_pushnumber(L, col.g / 255.0);
|
||||
lua_pushnumber(L, col.b / 255.0);
|
||||
lua_pushnumber(L, col.a / 255.0);
|
||||
lua_call(L, 4, 0);
|
||||
}
|
||||
|
||||
|
@ -77,10 +77,10 @@ static void nk_love_getGraphics(float *line_thickness, struct nk_color *color)
|
|||
lua_pop(L, 1);
|
||||
lua_getfield(L, -1, "getColor");
|
||||
lua_call(L, 0, 4);
|
||||
color->r = lua_tointeger(L, -4);
|
||||
color->g = lua_tointeger(L, -3);
|
||||
color->b = lua_tointeger(L, -2);
|
||||
color->a = lua_tointeger(L, -1);
|
||||
color->r = lua_tointeger(L, -4) * 255.0;
|
||||
color->g = lua_tointeger(L, -3) * 255.0;
|
||||
color->b = lua_tointeger(L, -2) * 255.0;
|
||||
color->a = lua_tointeger(L, -1) * 255.0;
|
||||
lua_pop(L, 6);
|
||||
}
|
||||
|
||||
|
@ -255,10 +255,10 @@ static void nk_love_draw_text(int fontref, struct nk_color cbg,
|
|||
lua_getfield(L, -1, "graphics");
|
||||
|
||||
lua_getfield(L, -1, "setColor");
|
||||
lua_pushnumber(L, cbg.r);
|
||||
lua_pushnumber(L, cbg.g);
|
||||
lua_pushnumber(L, cbg.b);
|
||||
lua_pushnumber(L, cbg.a);
|
||||
lua_pushnumber(L, cbg.r / 255.0);
|
||||
lua_pushnumber(L, cbg.g / 255.0);
|
||||
lua_pushnumber(L, cbg.b / 255.0);
|
||||
lua_pushnumber(L, cbg.a / 255.0);
|
||||
lua_call(L, 4, 0);
|
||||
|
||||
lua_getfield(L, -1, "rectangle");
|
||||
|
@ -270,10 +270,10 @@ static void nk_love_draw_text(int fontref, struct nk_color cbg,
|
|||
lua_call(L, 5, 0);
|
||||
|
||||
lua_getfield(L, -1, "setColor");
|
||||
lua_pushnumber(L, cfg.r);
|
||||
lua_pushnumber(L, cfg.g);
|
||||
lua_pushnumber(L, cfg.b);
|
||||
lua_pushnumber(L, cfg.a);
|
||||
lua_pushnumber(L, cfg.r / 255.0);
|
||||
lua_pushnumber(L, cfg.g / 255.0);
|
||||
lua_pushnumber(L, cfg.b / 255.0);
|
||||
lua_pushnumber(L, cfg.a / 255.0);
|
||||
lua_call(L, 4, 0);
|
||||
|
||||
lua_getfield(L, -1, "setFont");
|
||||
|
@ -318,9 +318,9 @@ static void nk_love_draw_rect_multi_color(int x, int y, unsigned int w,
|
|||
lua_pushstring(L, "all");
|
||||
lua_call(L, 1, 0);
|
||||
lua_getfield(L, -1, "setColor");
|
||||
lua_pushnumber(L, 255);
|
||||
lua_pushnumber(L, 255);
|
||||
lua_pushnumber(L, 255);
|
||||
lua_pushnumber(L, 1.0);
|
||||
lua_pushnumber(L, 1.0);
|
||||
lua_pushnumber(L, 1.0);
|
||||
lua_call(L, 3, 0);
|
||||
lua_getfield(L, -1, "setPointSize");
|
||||
lua_pushnumber(L, 1);
|
||||
|
@ -368,10 +368,10 @@ static void nk_love_clear(struct nk_color col)
|
|||
lua_getglobal(L, "love");
|
||||
lua_getfield(L, -1, "graphics");
|
||||
lua_getfield(L, -1, "clear");
|
||||
lua_pushnumber(L, col.r);
|
||||
lua_pushnumber(L, col.g);
|
||||
lua_pushnumber(L, col.b);
|
||||
lua_pushnumber(L, col.a);
|
||||
lua_pushnumber(L, col.r / 255.0);
|
||||
lua_pushnumber(L, col.g / 255.0);
|
||||
lua_pushnumber(L, col.b / 255.0);
|
||||
lua_pushnumber(L, col.a / 255.0);
|
||||
lua_call(L, 4, 0);
|
||||
lua_pop(L, 2);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue