Color values in love's APIs are now in the range of [0, 1] rather than [0, 255].

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2016-01-31 10:49:29 -04:00
parent 50087bd60e
commit ed933847f8
19 changed files with 126 additions and 144 deletions
+2 -2
View File
@@ -45,7 +45,7 @@ static inline size_t writeByteData(lua_State *L, int startidx, int components, c
uint8 *componentdata = (uint8 *) data;
for (int i = 0; i < components; i++)
componentdata[i] = (uint8) luaL_optnumber(L, startidx + i, 255);
componentdata[i] = (uint8) (luaL_optnumber(L, startidx + i, 1.0) * 255.0);
return sizeof(uint8) * components;
}
@@ -78,7 +78,7 @@ static inline size_t readByteData(lua_State *L, int components, const char *data
const uint8 *componentdata = (const uint8 *) data;
for (int i = 0; i < components; i++)
lua_pushnumber(L, (lua_Number) componentdata[i]);
lua_pushnumber(L, (lua_Number) componentdata[i] / 255.0);
return sizeof(uint8) * components;
}