New graphics api function: getColors, returns r, b, g, and a from a hex color
Also, remove generated/ and build/generated when using scons -c
This commit is contained in:
parent
ec29044ce6
commit
89ffa60529
@ -337,6 +337,12 @@ if not GetOption('clean'):
|
||||
conf.CheckBit()
|
||||
findLibs(env, conf)
|
||||
env = conf.Finish()
|
||||
else:
|
||||
import os, shutil
|
||||
try:
|
||||
shutil.rmtree("generated/")
|
||||
except:
|
||||
print "couldn't remove build/generated/"
|
||||
|
||||
if not msvc:
|
||||
if platform == "Windows":
|
||||
|
@ -9,7 +9,13 @@ if GetOption('clean'):
|
||||
try:
|
||||
shutil.rmtree(".sconf_temp/")
|
||||
except:
|
||||
print "couldn't remove .sconf_temp"
|
||||
print "couldn't remove .sconf_temp/"
|
||||
|
||||
try:
|
||||
shutil.rmtree("generated/")
|
||||
except:
|
||||
print "couldn't remove generated/"
|
||||
|
||||
try:
|
||||
os.remove(".sconsign.dblite")
|
||||
except:
|
||||
|
@ -2394,6 +2394,7 @@ void LuaScriptInterface::initGraphicsAPI()
|
||||
{"fillRect", graphics_fillRect},
|
||||
{"drawCircle", graphics_drawCircle},
|
||||
{"fillCircle", graphics_fillCircle},
|
||||
{"getColors", graphics_getColors},
|
||||
{NULL, NULL}
|
||||
};
|
||||
luaL_register(l, "graphics", graphicsAPIMethods);
|
||||
@ -2560,6 +2561,22 @@ int LuaScriptInterface::graphics_fillCircle(lua_State * l)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LuaScriptInterface::graphics_getColors(lua_State * l)
|
||||
{
|
||||
int color = lua_tointeger(l, 1);
|
||||
|
||||
int a = color >> 24;
|
||||
int r = (color >> 16)&0xFF;
|
||||
int g = (color >> 8)&0xFF;
|
||||
int b = color&0xFF;
|
||||
|
||||
lua_pushinteger(l, r);
|
||||
lua_pushinteger(l, g);
|
||||
lua_pushinteger(l, b);
|
||||
lua_pushinteger(l, a);
|
||||
return 4;
|
||||
}
|
||||
|
||||
void LuaScriptInterface::initFileSystemAPI()
|
||||
{
|
||||
//Methods
|
||||
|
@ -131,6 +131,7 @@ class LuaScriptInterface: public CommandInterface
|
||||
static int graphics_fillRect(lua_State * l);
|
||||
static int graphics_drawCircle(lua_State * l);
|
||||
static int graphics_fillCircle(lua_State * l);
|
||||
static int graphics_getColors(lua_State * l);
|
||||
|
||||
void initFileSystemAPI();
|
||||
static int fileSystem_list(lua_State * l);
|
||||
|
Loading…
Reference in New Issue
Block a user