Exemple #1
0
/** \brief Change the Image in a Picture Widget
 *
 */
int UI_Lua::setPicture(lua_State *L){
	int n = lua_gettop(L);  // Number of arguments
	if (n == 2){
		Picture* pic = (Picture*)checkWidget(L,1);
		luaL_argcheck(L, pic->GetMask() & WIDGET_PICTURE, 1, "`Picture' expected.");
		string picname = luaL_checkstring (L, 2);
		pic->Set( picname );
	
	} else {
		luaL_error(L, "Got %d arguments expected 2 (self, picname)", n);
	}
	return 0;
}
Exemple #2
0
/** \brief Rotate a Picture Widget
 *
 */
int UI_Lua::rotatePicture(lua_State *L){
	int n = lua_gettop(L);  // Number of arguments
	if (n != 2)
		return luaL_error(L, "Got %d arguments expected 2 (self, angle )", n);

	Picture* pic = (Picture*)checkWidget(L,1);
	luaL_argcheck(L, pic->GetMask() & WIDGET_PICTURE, 1, "`Picture' expected.");

	double angle = luaL_checknumber (L, 2);

	pic->Rotate(angle);

	return 1;
}
Exemple #3
0
/** \brief Change the Background of a Picture Widget
 *
 */
int UI_Lua::setBackground(lua_State *L){
	int n = lua_gettop(L);  // Number of arguments
	if ((n == 4) || (n == 5)){
		Picture* pic = (Picture*)checkWidget(L,1);
		luaL_argcheck(L, pic->GetMask() & WIDGET_PICTURE, 1, "`Picture' expected.");

		float r = luaL_checknumber (L, 2);
		float g = luaL_checknumber (L, 3);
		float b = luaL_checknumber (L, 4);
		float a = pic->GetAlpha();
		if( n == 5 ) {
			a = luaL_checknumber (L, 5);
		}

		pic->SetColor( r, g, b, a );
	
	} else {
		luaL_error(L, "Got %d arguments expected 2 (self, picname)", n);
	}
	return 0;
}