示例#1
0
//----------------------------------------------------------------//
USBox MOAIDeck::GetBounds ( u32 idx, MOAIDeckRemapper* remapper ) {

	idx = remapper ? remapper->Remap ( idx ) : idx;
	
	USBox bounds;
	
	if ( this->mBoundsDeck ) {
		bounds = this->mBoundsDeck->GetBounds ( idx & MOAITileFlags::CODE_MASK );
	}
	else {
		bounds = this->GetBounds ( idx & MOAITileFlags::CODE_MASK );
	}

	if ( idx & MOAITileFlags::FLIP_MASK ) {

		USVec3D scale;
		scale.mX = ( idx & MOAITileFlags::XFLIP ) ? -1.0f : 1.0f;
		scale.mY = ( idx & MOAITileFlags::YFLIP ) ? -1.0f : 1.0f;
		scale.mZ = 1.0f;

		bounds.Scale ( scale );
		bounds.Bless ();
	}
	return bounds;
}
示例#2
0
/**	@name	setBounds
	@text	Set the dimensions of a bounding box at a given index.
	
	@in		MOAIBoundsDeck self
	@in		number idx
	@in		number xMin
	@in		number yMin
	@in		number zMin
	@in		number xMax
	@in		number yMax
	@in		number zMax
	@out	nil
*/
int	MOAIBoundsDeck::_setBounds ( lua_State* L ) {
	MOAI_LUA_SETUP ( MOAIBoundsDeck, "UN" )
	
	u32 idx = state.GetValue < u32 >( 2, 1 ) - 1;
	
	if ( idx < self->mBoundsArray.Size ()) {
		USBox bounds = state.GetBox ( 3 );
		bounds.Bless ();
		self->mBoundsArray [ idx ] = bounds;
		self->SetBoundsDirty ();
	}
	return 0;
}