Ejemplo n.º 1
0
//----------------------------------------------------------------//
MOAIMesh::MOAIMesh () :
	mTotalElements ( 0 ),
	mPrimType ( ZGL_PRIM_TRIANGLES ),
	mPenWidth ( 1.0f ) {

	RTTI_BEGIN
		RTTI_EXTEND ( MOAIStandardDeck )
		RTTI_EXTEND ( MOAIVertexArray )
	RTTI_END
	
	this->ClearBounds ();
}
Ejemplo n.º 2
0
//----------------------------------------------------------------//
MOAILayoutFrame::MOAILayoutFrame () {
	
	RTTI_BEGIN
		RTTI_EXTEND ( MOAITransform )
	RTTI_END
	
	this->mMargin [ X_AXIS ][ MIN ] = 0.0f;
	this->mMargin [ Y_AXIS ][ MIN ] = 0.0f;
	this->mMargin [ X_AXIS ][ MAX ] = 0.0f;
	this->mMargin [ Y_AXIS ][ MAX ] = 0.0f;
	
	this->mLayout [ X_AXIS ] = LAYOUT_ALIGN_MIN;
	this->mLayout [ Y_AXIS ] = LAYOUT_ALIGN_MIN;
	
	this->mFit [ X_AXIS ] = FIT_ABSOLUTE;
	this->mFit [ Y_AXIS ] = FIT_ABSOLUTE;
	
	this->mWeight [ X_AXIS ] = 1.0f;
	this->mWeight [ Y_AXIS ] = 1.0f;
	
	this->mIdealSize [ X_AXIS ] = 0.0f;
	this->mIdealSize [ Y_AXIS ] = 0.0f;
	
	this->mLinkInChildren.Data ( this );
}
Ejemplo n.º 3
0
//----------------------------------------------------------------//
MOAIGfxQuadDeck2D::MOAIGfxQuadDeck2D () {

    RTTI_BEGIN
    RTTI_EXTEND ( MOAIDeck )
    RTTI_END

    this->SetContentMask ( MOAIProp::CAN_DRAW );
}
Ejemplo n.º 4
0
//----------------------------------------------------------------//
MOAIMath::MOAIMath () {

	RTTI_BEGIN
		RTTI_EXTEND ( MOAILuaObject )
	RTTI_END
	
	this->mSFMT = ( SFMT_T* )calloc ( 1, sizeof ( SFMT_T ));
}
Ejemplo n.º 5
0
//----------------------------------------------------------------//
MOAIScissorRect::MOAIScissorRect () {
	
	RTTI_BEGIN
		RTTI_EXTEND ( MOAITransform )
	RTTI_END
	
	this->mRect.Init ( 0.0f, 0.0f, 0.0f, 0.0f );
}
Ejemplo n.º 6
0
//----------------------------------------------------------------//
MOAIGridDeck2D::MOAIGridDeck2D () {
	
	RTTI_BEGIN
		RTTI_EXTEND ( MOAIDeck )
	RTTI_END
	
	this->SetContentMask ( MOAIProp::CAN_DRAW );
	this->mMaxBounds.Init ( 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f );
}
Ejemplo n.º 7
0
//----------------------------------------------------------------//
MOAICpPrim::MOAICpPrim () :
	mSpace ( 0 ) {
	
	RTTI_BEGIN
		RTTI_EXTEND ( MOAILuaObject )
	RTTI_END
	
	this->mLinkInSpace.Data ( this );
}
Ejemplo n.º 8
0
//----------------------------------------------------------------//
MOAIStretchPatch2D::MOAIStretchPatch2D () :
	mNeedsUpdate ( true ) {

	RTTI_BEGIN
		RTTI_EXTEND ( MOAIDeck )
	RTTI_END
	
	this->SetContentMask ( MOAIProp::CAN_DRAW );
	this->mRect.Init ( 0.0f, 0.0f, 0.0f, 0.0f );
}
Ejemplo n.º 9
0
//----------------------------------------------------------------//
MOAIMath::MOAIMath () {

	RTTI_BEGIN
		RTTI_EXTEND ( MOAILuaObject )
	RTTI_END
	
	#if MOAI_WITH_SFMT
		this->mSFMT = ( SFMT_T* )calloc ( 1, sizeof ( SFMT_T ));
		sfmt_init_gen_rand ( this->mSFMT, ( u32 )time ( 0 ));
	#endif
}
Ejemplo n.º 10
0
//----------------------------------------------------------------//
MOAIMesh::MOAIMesh () :
	mPrimType ( ZGL_PRIM_TRIANGLES  ),
	mPenWidth ( 1.0f ),
	mPointSize ( 1.0f ) {

	RTTI_BEGIN
		RTTI_EXTEND ( MOAIDeck )
	RTTI_END
	
	this->SetContentMask ( MOAIProp::CAN_DRAW );
	this->mDefaultShaderID = MOAIShaderMgr::MESH_SHADER;
}
Ejemplo n.º 11
0
//----------------------------------------------------------------//
MOAIParticleForce::MOAIParticleForce () :
	mShape ( LINEAR ),
	mType ( GRAVITY ) {
	
	RTTI_BEGIN
		RTTI_EXTEND ( MOAITransform )
	RTTI_END
	
	this->mVec.Init ( 0.0f, 0.0f, 0.0f );
	
	this->mWorldLoc.Init ( 0.0f, 0.0f, 0.0f );
	this->mWorldVec.Init ( 0.0f, 0.0f, 0.0f );
}
MOAIFmodEventGroup::MOAIFmodEventGroup () {
	
	// register all classes MOAIFoo derives from
	// we need this for custom RTTI implementation
	RTTI_BEGIN
		RTTI_EXTEND ( MOAILuaObject )
		
		// and any other objects from multiple inheritance...
		// RTTI_EXTEND ( MOAIFooBase )
	RTTI_END

	eventGroup = new FMOD::EventGroup();
}
Ejemplo n.º 13
0
//----------------------------------------------------------------//
MOAIXboxController::MOAIXboxController () {
	
	RTTI_BEGIN
		RTTI_EXTEND ( MOAIAction )
	RTTI_END

	this->mControllerId = -1;
	this->mPrevState = nullptr;
	this->mCurrentState = nullptr;
	this->mStateShift = 0;
	this->mNormalTriggerState[0] = 0.0;
	this->mNormalTriggerState[1] = 0.0;
}
Ejemplo n.º 14
0
Pathfinder::Pathfinder(): MOAIEntity2D(), m_navmesh{navmeshFilename} {
	RTTI_BEGIN
		RTTI_EXTEND(MOAIEntity2D)
		RTTI_END

	m_pathfinder = this;
	//fill m_nodes
	uint16_t numPolygons = m_navmesh.GetNumPolygons();
	float cost = 0;
	USVec2D diagonal;
	float centreDist;
	for (uint16_t index = 0; index < numPolygons; ++index) {
		cost = rand() % 3000 + 500;
		PathNode node(m_navmesh.GetPolygon(index), cost, 0.f);
		diagonal = node.GetPolygon()->m_vertices[2] - node.GetPolygon()->m_vertices[0];
		centreDist = diagonal.Length() / 2;
		node.SetCentrePos(node.GetPolygon()->m_vertices[0] + (diagonal.NormVector() * centreDist));
		m_nodes.push_back(node);
	}
}
Ejemplo n.º 15
0
	if ( this->mDataBuffer ) {
		
		this->mByteStream.SetBuffer ( 0, 0 );
		this->mByteStream.SetLength ( 0 );
		
		this->SetZLStream ( 0 );
		this->mDataBuffer->Unlock ();
		this->mDataBuffer.Set ( *this, 0 );
	}
}

//----------------------------------------------------------------//
MOAIDataBufferStream::MOAIDataBufferStream () {
	
	RTTI_BEGIN
		RTTI_EXTEND ( MOAIStream )
	RTTI_END
}

//----------------------------------------------------------------//
MOAIDataBufferStream::~MOAIDataBufferStream () {

	this->Close ();
}

//----------------------------------------------------------------//
bool MOAIDataBufferStream::Open ( MOAIDataBuffer* buffer ) {

	this->Close ();

	if ( !buffer ) return false;
Ejemplo n.º 16
0
	return bounds;
}

//----------------------------------------------------------------//
USBox MOAIBoundsDeck::GetItemBounds ( u32 idx ) {

	idx = ( idx - 1 ) % this->mIndexMap.Size ();
	idx = this->mIndexMap [ idx ] % this->mBoundsArray.Size ();
	return this->mBoundsArray [ idx ];
}

//----------------------------------------------------------------//
MOAIBoundsDeck::MOAIBoundsDeck () {

	RTTI_BEGIN
		RTTI_EXTEND ( MOAIDeck )
	RTTI_END
	
	//this->SetContentMask ( MOAIProp::CAN_DRAW );
}

//----------------------------------------------------------------//
MOAIBoundsDeck::~MOAIBoundsDeck () {
}

//----------------------------------------------------------------//
void MOAIBoundsDeck::RegisterLuaClass ( MOAILuaState& state ) {

	MOAIDeck::RegisterLuaClass ( state );
}
Ejemplo n.º 17
0
	this->Clear ();
	
	int status;
	MOAIScopedLuaState state = MOAILuaRuntime::Get ().State ();

	// load the lua file
	status = luaL_loadfile ( state, filename );
	if ( state.PrintErrors ( ZLLog::CONSOLE, status )) return LOAD_ERROR;
	
	// load self as the func param
	this->PushLuaUserdata ( state );
	
	// call the chunk
	if ( state.DebugCall ( 1, 0 )) return LUA_ERROR;
	
	// done!
	return SUCCESS;
}

//----------------------------------------------------------------//
MOAIDeserializer::MOAIDeserializer () {
	
	RTTI_BEGIN
		RTTI_EXTEND ( MOAISerializerBase )
	RTTI_END
}

//----------------------------------------------------------------//
MOAIDeserializer::~MOAIDeserializer () {
}
Ejemplo n.º 18
0
cc8* MOAISerializerBase::GetFileMagic () {
	return "--MOAI";
}

//----------------------------------------------------------------//
uintptr MOAISerializerBase::GetID ( MOAILuaObject* object ) {

	MOAILuaStateHandle state = object->GetSelf ();
	return ( uintptr )lua_topointer ( state, -1 );
}

//----------------------------------------------------------------//
uintptr MOAISerializerBase::GetID ( MOAILuaState& state, int idx ) {

	return ( uintptr )lua_topointer ( state, idx );
}

//----------------------------------------------------------------//
MOAISerializerBase::MOAISerializerBase () {
	
	RTTI_BEGIN
		RTTI_EXTEND ( MOAILuaObject )
	RTTI_END
}

//----------------------------------------------------------------//
MOAISerializerBase::~MOAISerializerBase () {

	this->Clear ();
}
Ejemplo n.º 19
0
}


//----------------------------------------------------------------//
int MOAITBPropContainer::_setProp ( lua_State *L ) {
	MOAI_LUA_SETUP( MOAITBPropContainer, "U" )
	MOAIGraphicsProp* prop = state.GetLuaObject< MOAIGraphicsProp >( 2, true );
	self->GetInternal()->SetProp( prop );
	return 0;
}


//----------------------------------------------------------------//
MOAITBPropContainer::MOAITBPropContainer () {
	RTTI_BEGIN
		RTTI_EXTEND ( MOAITBWidget )
	RTTI_END	
}

//----------------------------------------------------------------//
MOAITBPropContainer::~MOAITBPropContainer () {
}


//----------------------------------------------------------------//
void MOAITBPropContainer::RegisterLuaClass ( MOAILuaState& state ) {
	MOAITBWidget::RegisterLuaClass( state );
	
	luaL_Reg regTable [] = {
		{ "new", _new },
		{ NULL,  NULL }
MOAITexture* MOAIStaticGlyphCache::GetTexture ( u32 id ) {

	return this->mTextures [ id ];
}

//----------------------------------------------------------------//
bool MOAIStaticGlyphCache::IsDynamic () {

	return false;
}

//----------------------------------------------------------------//
MOAIStaticGlyphCache::MOAIStaticGlyphCache () {
	
	RTTI_BEGIN
		RTTI_EXTEND ( MOAIGlyphCacheBase )
	RTTI_END
}

//----------------------------------------------------------------//
MOAIStaticGlyphCache::~MOAIStaticGlyphCache () {

	this->ClearTextures ();
}

//----------------------------------------------------------------//
void MOAIStaticGlyphCache::PlaceGlyph ( MOAIFont& font, MOAIGlyph& glyph ) {
	UNUSED ( font );
	UNUSED ( glyph );
}
Ejemplo n.º 21
0
#include "moai-tb/MOAITBCheckBox.h"

//----------------------------------------------------------------//
//MOAITBRadioCheckBox
//----------------------------------------------------------------//
MOAITBRadioCheckBox::MOAITBRadioCheckBox () {
	RTTI_BEGIN
		RTTI_EXTEND ( MOAITBWidget )
	RTTI_END	
}

//----------------------------------------------------------------//
MOAITBRadioCheckBox::~MOAITBRadioCheckBox () {
}


//----------------------------------------------------------------//
void MOAITBRadioCheckBox::RegisterLuaClass ( MOAILuaState& state ) {
	MOAITBWidget::RegisterLuaClass( state );
	luaL_Reg regTable [] = {
		{ "new", _new },
		{ NULL,  NULL }
	};
	luaL_register ( state, 0, regTable );
}

//----------------------------------------------------------------//
void MOAITBRadioCheckBox::RegisterLuaFuncs ( MOAILuaState& state ) {
	MOAITBWidget::RegisterLuaFuncs( state );
	luaL_Reg regTable [] = {
		{ NULL, NULL  }
Ejemplo n.º 22
0
//----------------------------------------------------------------//
void USLuaSerializer::SetRefField ( USLuaState& state, int idx, cc8* name, USLuaObject* object ) {

	if ( state.IsType ( idx, LUA_TTABLE )) {
		
		this->PushRef ( state, object );
		lua_setfield ( state, -2, name );
	}
}

//----------------------------------------------------------------//
USLuaSerializer::USLuaSerializer () {
	
	RTTI_BEGIN
		RTTI_EXTEND ( USLuaSerializer )
	RTTI_END
}

//----------------------------------------------------------------//
USLuaSerializer::~USLuaSerializer () {

	this->Clear ();
}

//----------------------------------------------------------------//
void USLuaSerializer::WriteDecls ( USStream& stream ) {

	stream.Print ( "--Declaring Objects\n" );
	stream.Print ( "local objects = {\n\n" );
	
Ejemplo n.º 23
0
//----------------------------------------------------------------//
void MOAIEventSource::AffirmListenerTable ( USLuaState& state ) {

	if ( !mListenerTable ) {
	
		lua_newtable ( state );
		this->mListenerTable.SetRef ( state, -1, false );
		state.Pop ( 1 );
	}
}

//----------------------------------------------------------------//
MOAIEventSource::MOAIEventSource () {

	RTTI_BEGIN
		RTTI_EXTEND ( USLuaObject )
	RTTI_END
}

//----------------------------------------------------------------//
MOAIEventSource::~MOAIEventSource () {
}

//----------------------------------------------------------------//
bool MOAIEventSource::PushListenerAndSelf ( u32 eventID, USLuaState& state ) {

	if ( this->mListenerTable ) {
	
		this->mListenerTable.PushRef ( state );
		if ( state.GetFieldWithType ( -1, eventID, LUA_TFUNCTION )) {
			
Ejemplo n.º 24
0
//================================================================//
// local
//================================================================//

//----------------------------------------------------------------//

//================================================================//
// MOAIBox2DWheelJoint
//================================================================//

//----------------------------------------------------------------//
MOAIBox2DWheelJoint::MOAIBox2DWheelJoint () {
	
	RTTI_BEGIN
	RTTI_EXTEND ( MOAIBox2DJoint )
	RTTI_END
}

//----------------------------------------------------------------//
/**	@name	getJointTranslation
 @text	See Box2D documentation.
 
 @in		MOAIBox2DWheelJoint self
 @out	number jointTranslation in units, converted from meters
 */
int MOAIBox2DWheelJoint::_getJointTranslation ( lua_State* L ) {
	MOAI_LUA_SETUP ( MOAIBox2DWheelJoint, "U" )
	float unitsToMeters = self->GetUnitsToMeters ();
	
	if ( !self->mJoint ) {