update registration for various types

This commit is contained in:
Glenn Maynard
2005-06-20 04:17:02 +00:00
parent 9f51cfbf5a
commit c998564adf
8 changed files with 143 additions and 131 deletions
+42 -4
View File
@@ -10,10 +10,6 @@
#include "ScreenDimensions.h"
#include "Foreach.h"
// lua start
LUA_REGISTER_CLASS( ActorFrame )
// lua end
/* Tricky: We need ActorFrames created in XML to auto delete their children.
* We don't want classes that derive from ActorFrame to auto delete their
* children. The name "ActorFrame" is widely used in XML, so we'll have
@@ -328,6 +324,48 @@ void ActorFrame::SetDrawByZPosition( bool b )
m_bDrawByZPosition = b;
}
// lua start
#include "LuaBinding.h"
template<class T>
class LunaActorFrame : public Luna<T>
{
public:
LunaActorFrame() { LUA->Register( Register ); }
static int propagate( T* p, lua_State *L ) { p->SetPropagateCommands( !!IArg(1) ); return 0; }
static int fov( T* p, lua_State *L ) { p->SetFOV( FArg(1) ); return 0; }
static int SetUpdateRate( T* p, lua_State *L ) { p->SetUpdateRate( FArg(1) ); return 0; }
static int SetFOV( T* p, lua_State *L ) { p->SetFOV( FArg(1) ); return 0; }
static int GetChild( T* p, lua_State *L )
{
Actor *pChild = p->GetChild( SArg(1) );
if( pChild )
pChild->PushSelf( L );
else
lua_pushnil( L );
return 1;
}
static int GetNumChildren( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumChildren() ); return 1; }
static int SetDrawByZPosition( T* p, lua_State *L ) { p->SetDrawByZPosition( BArg(1) ); return 1; }
static void Register(lua_State *L)
{
ADD_METHOD( propagate )
ADD_METHOD( fov )
ADD_METHOD( SetUpdateRate )
ADD_METHOD( SetFOV )
ADD_METHOD( GetChild )
ADD_METHOD( GetNumChildren )
ADD_METHOD( SetDrawByZPosition )
Luna<T>::Register( L );
}
};
LUA_REGISTER_DERIVED_CLASS( ActorFrame, Actor )
// lua end
/*
* (c) 2001-2004 Chris Danford
* All rights reserved.
-35
View File
@@ -5,41 +5,6 @@
#include "Actor.h"
template<class T>
class LunaActorFrame : public LunaActor<T>
{
public:
LunaActorFrame() { LUA->Register( Register ); }
static int propagate( T* p, lua_State *L ) { p->SetPropagateCommands( !!IArg(1) ); return 0; }
static int fov( T* p, lua_State *L ) { p->SetFOV( FArg(1) ); return 0; }
static int SetUpdateRate( T* p, lua_State *L ) { p->SetUpdateRate( FArg(1) ); return 0; }
static int SetFOV( T* p, lua_State *L ) { p->SetFOV( FArg(1) ); return 0; }
static int GetChild( T* p, lua_State *L )
{
Actor *pChild = p->GetChild( SArg(1) );
if( pChild )
pChild->PushSelf( L );
else
lua_pushnil( L );
return 1;
}
static int GetNumChildren( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumChildren() ); return 1; }
static int SetDrawByZPosition( T* p, lua_State *L ) { p->SetDrawByZPosition( BArg(1) ); return 1; }
static void Register(lua_State *L)
{
ADD_METHOD( propagate )
ADD_METHOD( fov )
ADD_METHOD( SetUpdateRate )
ADD_METHOD( SetFOV )
ADD_METHOD( GetChild )
ADD_METHOD( GetNumChildren )
ADD_METHOD( SetDrawByZPosition )
LunaActor<T>::Register( L );
}
};
class ActorFrame : public Actor
{
public:
+21 -4
View File
@@ -9,10 +9,6 @@
#include "ActorUtil.h"
#include <sstream>
// lua start
LUA_REGISTER_CLASS( ActorScroller )
// lua end
/* Tricky: We need ActorFrames created in XML to auto delete their children.
* We don't want classes that derive from ActorFrame to auto delete their
* children. The name "ActorFrame" is widely used in XML, so we'll have
@@ -282,6 +278,27 @@ void ActorScroller::DrawPrimitives()
}
}
// lua start
#include "LuaBinding.h"
template<class T>
class LunaActorScroller : public Luna<T>
{
public:
LunaActorScroller() { LUA->Register( Register ); }
static int SetCurrentAndDestinationItem( T* p, lua_State *L ) { p->SetCurrentAndDestinationItem( FArg(1) ); return 0; }
static void Register(lua_State *L)
{
ADD_METHOD( SetCurrentAndDestinationItem )
Luna<T>::Register( L );
}
};
LUA_REGISTER_DERIVED_CLASS( ActorScroller, ActorFrame )
// lua end
/*
* (c) 2003-2004 Chris Danford
* All rights reserved.
-15
View File
@@ -7,21 +7,6 @@
#include "Quad.h"
struct XNode;
template<class T>
class LunaActorScroller : public LunaActorFrame<T>
{
public:
LunaActorScroller() { LUA->Register( Register ); }
static int SetCurrentAndDestinationItem( T* p, lua_State *L ) { p->SetCurrentAndDestinationItem( FArg(1) ); return 0; }
static void Register(lua_State *L)
{
ADD_METHOD( SetCurrentAndDestinationItem )
LunaActor<T>::Register( L );
}
};
class ActorScroller : public ActorFrame
{
public:
+51 -3
View File
@@ -12,9 +12,6 @@
#include "Style.h"
#include "XmlFile.h"
// lua start
LUA_REGISTER_CLASS( DifficultyMeter )
// lua end
REGISTER_ACTOR_CLASS( DifficultyMeter );
@@ -255,6 +252,57 @@ void DifficultyMeter::SetInternal( int iMeter, Difficulty dc, const CString &sDi
m_textMeter.PlayCommand( sDifficultyCommand );
}
// lua start
#include "LuaBinding.h"
template<class T>
class LunaDifficultyMeter : public Luna<T>
{
public:
LunaDifficultyMeter() { LUA->Register( Register ); }
static int Load( T* p, lua_State *L ) { p->Load( SArg(1) ); return 0; }
static int SetFromMeterAndDifficulty( T* p, lua_State *L ) { p->SetFromMeterAndDifficulty( IArg(1), (Difficulty)IArg(2) ); return 0; }
static int SetFromSteps( T* p, lua_State *L )
{
if( lua_isnil(L,1) )
{
p->SetFromSteps( NULL );
}
else
{
Steps *pS = Luna<Steps>::check(L,1);
p->SetFromSteps( pS );
}
return 0;
}
static int SetFromTrail( T* p, lua_State *L )
{
if( lua_isnil(L,1) )
{
p->SetFromTrail( NULL );
}
else
{
Trail *pT = Luna<Trail>::check(L,1);
p->SetFromTrail( pT );
}
return 0;
}
static void Register(lua_State *L)
{
ADD_METHOD( Load )
ADD_METHOD( SetFromMeterAndDifficulty )
ADD_METHOD( SetFromSteps )
ADD_METHOD( SetFromTrail )
Luna<T>::Register( L );
}
};
LUA_REGISTER_DERIVED_CLASS( DifficultyMeter, ActorFrame )
// lua end
/*
* (c) 2001-2004 Chris Danford, Glenn Maynard
* All rights reserved.
-45
View File
@@ -15,51 +15,6 @@
class Steps;
class Trail;
template<class T>
class LunaDifficultyMeter : public LunaActorFrame<T>
{
public:
LunaDifficultyMeter() { LUA->Register( Register ); }
static int Load( T* p, lua_State *L ) { p->Load( SArg(1) ); return 0; }
static int SetFromMeterAndDifficulty( T* p, lua_State *L ) { p->SetFromMeterAndDifficulty( IArg(1), (Difficulty)IArg(2) ); return 0; }
static int SetFromSteps( T* p, lua_State *L )
{
if( lua_isnil(L,1) )
{
p->SetFromSteps( NULL );
}
else
{
Steps *pS = Luna<Steps>::check(L,1);
p->SetFromSteps( pS );
}
return 0;
}
static int SetFromTrail( T* p, lua_State *L )
{
if( lua_isnil(L,1) )
{
p->SetFromTrail( NULL );
}
else
{
Trail *pT = Luna<Trail>::check(L,1);
p->SetFromTrail( pT );
}
return 0;
}
static void Register(lua_State *L)
{
ADD_METHOD( Load )
ADD_METHOD( SetFromMeterAndDifficulty )
ADD_METHOD( SetFromSteps )
ADD_METHOD( SetFromTrail )
LunaActor<T>::Register( L );
}
};
class DifficultyMeter: public ActorFrame
{
public:
+29 -3
View File
@@ -11,9 +11,6 @@
#include "ThemeMetric.h"
#include "ActorUtil.h"
// lua start
LUA_REGISTER_CLASS( FadingBanner )
// lua end
REGISTER_ACTOR_CLASS( FadingBanner )
/*
@@ -210,6 +207,35 @@ void FadingBanner::LoadFallback()
m_Banner[m_iIndexLatest].LoadFallback();
}
// lua start
#include "LuaBinding.h"
template<class T>
class LunaFadingBanner : public Luna<T>
{
public:
LunaFadingBanner() { LUA->Register( Register ); }
static int ScaleToClipped( T* p, lua_State *L ) { p->ScaleToClipped(FArg(1),FArg(2)); return 0; }
static int LoadFromSong( T* p, lua_State *L )
{
if( lua_isnil(L,1) ) { p->LoadFromSong( NULL ); }
else { Song *pS = Luna<Song>::check(L,1); p->LoadFromSong( pS ); }
return 0;
}
static void Register(lua_State *L)
{
ADD_METHOD( ScaleToClipped )
ADD_METHOD( LoadFromSong )
Luna<T>::Register( L );
}
};
LUA_REGISTER_DERIVED_CLASS( FadingBanner, ActorFrame )
// lua end
/*
* (c) 2001-2004 Chris Danford
* All rights reserved.
-22
View File
@@ -7,28 +7,6 @@
#include "ActorFrame.h"
#include "RageTimer.h"
template<class T>
class LunaFadingBanner : public LunaActorFrame<T>
{
public:
LunaFadingBanner() { LUA->Register( Register ); }
static int ScaleToClipped( T* p, lua_State *L ) { p->ScaleToClipped(FArg(1),FArg(2)); return 0; }
static int LoadFromSong( T* p, lua_State *L )
{
if( lua_isnil(L,1) ) { p->LoadFromSong( NULL ); }
else { Song *pS = Luna<Song>::check(L,1); p->LoadFromSong( pS ); }
return 0;
}
static void Register(lua_State *L)
{
ADD_METHOD( ScaleToClipped )
ADD_METHOD( LoadFromSong )
LunaActor<T>::Register( L );
}
};
class FadingBanner : public ActorFrame
{
public: