diff --git a/SConscript b/SConscript index 82bae101b..fd62c65d3 100644 --- a/SConscript +++ b/SConscript @@ -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": diff --git a/SConstruct b/SConstruct index 862d7c7ce..56255fbb8 100644 --- a/SConstruct +++ b/SConstruct @@ -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: diff --git a/src/lua/LuaScriptInterface.cpp b/src/lua/LuaScriptInterface.cpp index 78a6fee1c..11375175e 100644 --- a/src/lua/LuaScriptInterface.cpp +++ b/src/lua/LuaScriptInterface.cpp @@ -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 diff --git a/src/lua/LuaScriptInterface.h b/src/lua/LuaScriptInterface.h index e73a9b144..433ce8e64 100644 --- a/src/lua/LuaScriptInterface.h +++ b/src/lua/LuaScriptInterface.h @@ -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);