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()
|
conf.CheckBit()
|
||||||
findLibs(env, conf)
|
findLibs(env, conf)
|
||||||
env = conf.Finish()
|
env = conf.Finish()
|
||||||
|
else:
|
||||||
|
import os, shutil
|
||||||
|
try:
|
||||||
|
shutil.rmtree("generated/")
|
||||||
|
except:
|
||||||
|
print "couldn't remove build/generated/"
|
||||||
|
|
||||||
if not msvc:
|
if not msvc:
|
||||||
if platform == "Windows":
|
if platform == "Windows":
|
||||||
|
@ -9,7 +9,13 @@ if GetOption('clean'):
|
|||||||
try:
|
try:
|
||||||
shutil.rmtree(".sconf_temp/")
|
shutil.rmtree(".sconf_temp/")
|
||||||
except:
|
except:
|
||||||
print "couldn't remove .sconf_temp"
|
print "couldn't remove .sconf_temp/"
|
||||||
|
|
||||||
|
try:
|
||||||
|
shutil.rmtree("generated/")
|
||||||
|
except:
|
||||||
|
print "couldn't remove generated/"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.remove(".sconsign.dblite")
|
os.remove(".sconsign.dblite")
|
||||||
except:
|
except:
|
||||||
|
@ -2394,6 +2394,7 @@ void LuaScriptInterface::initGraphicsAPI()
|
|||||||
{"fillRect", graphics_fillRect},
|
{"fillRect", graphics_fillRect},
|
||||||
{"drawCircle", graphics_drawCircle},
|
{"drawCircle", graphics_drawCircle},
|
||||||
{"fillCircle", graphics_fillCircle},
|
{"fillCircle", graphics_fillCircle},
|
||||||
|
{"getColors", graphics_getColors},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
luaL_register(l, "graphics", graphicsAPIMethods);
|
luaL_register(l, "graphics", graphicsAPIMethods);
|
||||||
@ -2560,6 +2561,22 @@ int LuaScriptInterface::graphics_fillCircle(lua_State * l)
|
|||||||
return 0;
|
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()
|
void LuaScriptInterface::initFileSystemAPI()
|
||||||
{
|
{
|
||||||
//Methods
|
//Methods
|
||||||
|
@ -131,6 +131,7 @@ class LuaScriptInterface: public CommandInterface
|
|||||||
static int graphics_fillRect(lua_State * l);
|
static int graphics_fillRect(lua_State * l);
|
||||||
static int graphics_drawCircle(lua_State * l);
|
static int graphics_drawCircle(lua_State * l);
|
||||||
static int graphics_fillCircle(lua_State * l);
|
static int graphics_fillCircle(lua_State * l);
|
||||||
|
static int graphics_getColors(lua_State * l);
|
||||||
|
|
||||||
void initFileSystemAPI();
|
void initFileSystemAPI();
|
||||||
static int fileSystem_list(lua_State * l);
|
static int fileSystem_list(lua_State * l);
|
||||||
|
Loading…
Reference in New Issue
Block a user