lua/wrappers/gfx/lua_asset.cpp
/**
	 * Sets the texture window rectangle for this asset from a table.
	 * Each value should be treated like a UV coordinate.
	 *
	 * The table is expected to have the values for "left_x", "right_x", "top_y" and "bottom_y".
	 * If these values are not defined, left_x and top_y default to 0 and right_x and bottom_y will default to 1.
	 * 
	 * @param table values Table of values to set the UV coordinates to.
	 * @returns am.asset This
	 */
Sets the texture window rectangle for this asset from a table.
Each value should be treated like a UV coordinate.



@param table values Table of values to set the UV coordinates to.
Sets the texture window rectangle for this asset from a table . Each value should be treated like a UV coordinate . @param table values Table of values to set the UV coordinates to .
int Asset_texture_window(lua_State *lua)
	{
		Asset *asset = castUData<Asset>(lua, 1);
		if (asset)
		{
			if (lua_gettop(lua) == 1)
			{
				const TextureWindow &win = asset->getTextureWindow();
				lua_createtable(lua, 0, 4);
				LuaState L(lua);
				L.setTableValue("left_x", win.getLeftX());
				L.setTableValue("right_x", win.getRightX());
				L.setTableValue("top_y", win.getTopY());
				L.setTableValue("bottom_y", win.getBottomY());
				return 1;
			}
			else if (lua_istable(lua, 2))
			{
				LuaState L(lua);
				double leftX = 0.0, rightX = 1.0, topY = 0.0, bottomY = 1.0, width = -1.0, height = -1.0;
				L.getTableDouble("left_x", leftX);
				L.getTableDouble("right_x", rightX);
				L.getTableDouble("top_y", topY);
				L.getTableDouble("bottom_y", bottomY);
				TextureWindow win;
				win.setValues(topY, bottomY, leftX, rightX);
				asset->setTextureWindow(win);
				lua_first(lua);
			}
			return LuaState::expectedArgs(lua, "texture_window", "table values");
		}
		return LuaState::expectedContext(lua, "texture_window", "am.asset");
	}
int Asset_texture_window ( lua_State * lua ) { Asset * asset = castUData < Asset > ( lua , 1 ) ; if ( asset ) { if ( lua_gettop ( lua ) == 1 ) { const TextureWindow & win = asset -> getTextureWindow ( ) ; lua_createtable ( lua , 0 , 4 ) ; LuaState L ( lua ) ; L . setTableValue ( " " , win . getLeftX ( ) ) ; L . setTableValue ( " " , win . getRightX ( ) ) ; L . setTableValue ( " " , win . getTopY ( ) ) ; L . setTableValue ( " " , win . getBottomY ( ) ) ; return 1 ; } else if ( lua_istable ( lua , 2 ) ) { LuaState L ( lua ) ; double leftX = 0.0 , rightX = 1.0 , topY = 0.0 , bottomY = 1.0 , width = -1.0 , height = -1.0 ; L . getTableDouble ( " " , leftX ) ; L . getTableDouble ( " " , rightX ) ; L . getTableDouble ( " " , topY ) ; L . getTableDouble ( " " , bottomY ) ; TextureWindow win ; win . setValues ( topY , bottomY , leftX , rightX ) ; asset -> setTextureWindow ( win ) ; lua_first ( lua ) ; } return LuaState :: expectedArgs ( lua , " " , " " ) ; } return LuaState :: expectedContext ( lua , " " , " " ) ; }
Sets the texture window rectangle for this asset from a table.
Sets the texture window rectangle for this asset from a table .