bound alignment constants

This commit is contained in:
Glenn Maynard
2006-09-26 20:00:27 +00:00
parent 6641cec9f9
commit 02a4b35d51
3 changed files with 20 additions and 23 deletions
+16 -18
View File
@@ -32,6 +32,20 @@ Actor *Actor::Copy() const { return new Actor(*this); }
static float g_fCabinetLights[NUM_CABINET_LIGHTS]; static float g_fCabinetLights[NUM_CABINET_LIGHTS];
static const char *HorizAlignNames[] = {
"Left",
"Center",
"Right"
};
LuaXType( HorizAlign );
static const char *VertAlignNames[] = {
"Top",
"Middle",
"Bottom"
};
LuaXType( VertAlign );
void Actor::SetBGMTime( float fTime, float fBeat ) void Actor::SetBGMTime( float fTime, float fBeat )
{ {
g_fCurrentBGMTime = fTime; g_fCurrentBGMTime = fTime;
@@ -829,22 +843,6 @@ void Actor::ScaleTo( const RectF &rect, StretchType st )
SetZoom( fNewZoom ); SetZoom( fNewZoom );
} }
void Actor::SetHorizAlignString( const RString &s )
{
if (s.EqualsNoCase("left")) this->SetHorizAlign( HorizAlign_Left ); /* call derived */
else if(s.EqualsNoCase("center")) this->SetHorizAlign( HorizAlign_Center );
else if(s.EqualsNoCase("right")) this->SetHorizAlign( HorizAlign_Right );
else ASSERT(0);
}
void Actor::SetVertAlignString( const RString &s )
{
if (s.EqualsNoCase("top")) this->SetVertAlign( VertAlign_Top ); /* call derived */
else if(s.EqualsNoCase("middle")) this->SetVertAlign( VertAlign_Middle );
else if(s.EqualsNoCase("bottom")) this->SetVertAlign( VertAlign_Bottom );
else ASSERT(0);
}
void Actor::SetEffectClockString( const RString &s ) void Actor::SetEffectClockString( const RString &s )
{ {
if (s.EqualsNoCase("timer")) this->SetEffectClock( CLOCK_TIMER ); if (s.EqualsNoCase("timer")) this->SetEffectClock( CLOCK_TIMER );
@@ -1388,8 +1386,8 @@ public:
static int pitch( T* p, lua_State *L ) { p->AddRotationP(FArg(1)); return 0; } static int pitch( T* p, lua_State *L ) { p->AddRotationP(FArg(1)); return 0; }
static int roll( T* p, lua_State *L ) { p->AddRotationR(FArg(1)); return 0; } static int roll( T* p, lua_State *L ) { p->AddRotationR(FArg(1)); return 0; }
static int shadowlength( T* p, lua_State *L ) { p->SetShadowLength(FArg(1)); return 0; } static int shadowlength( T* p, lua_State *L ) { p->SetShadowLength(FArg(1)); return 0; }
static int horizalign( T* p, lua_State *L ) { p->SetHorizAlignString(SArg(1)); return 0; } static int horizalign( T* p, lua_State *L ) { p->SetHorizAlign(Enum::Check<HorizAlign>(L, 1)); return 0; }
static int vertalign( T* p, lua_State *L ) { p->SetVertAlignString(SArg(1)); return 0; } static int vertalign( T* p, lua_State *L ) { p->SetVertAlign(Enum::Check<VertAlign>(L, 1)); return 0; }
static int luaeffect( T* p, lua_State *L ) { p->SetEffectLua(SArg(1)); return 0; } static int luaeffect( T* p, lua_State *L ) { p->SetEffectLua(SArg(1)); return 0; }
static int diffuseblink( T* p, lua_State *L ) { p->SetEffectDiffuseBlink(); return 0; } static int diffuseblink( T* p, lua_State *L ) { p->SetEffectDiffuseBlink(); return 0; }
static int diffuseshift( T* p, lua_State *L ) { p->SetEffectDiffuseShift(); return 0; } static int diffuseshift( T* p, lua_State *L ) { p->SetEffectDiffuseShift(); return 0; }
+4 -3
View File
@@ -6,6 +6,7 @@
#include "RageTypes.h" #include "RageTypes.h"
#include "RageUtil_AutoPtr.h" #include "RageUtil_AutoPtr.h"
#include "LuaReference.h" #include "LuaReference.h"
#include "EnumHelper.h"
#include <map> #include <map>
class XNode; class XNode;
struct lua_State; struct lua_State;
@@ -30,6 +31,7 @@ enum HorizAlign
NUM_HorizAlign, NUM_HorizAlign,
HorizAlign_Invalid HorizAlign_Invalid
}; };
LuaDeclareType( HorizAlign );
enum VertAlign enum VertAlign
{ {
@@ -39,6 +41,8 @@ enum VertAlign
NUM_VertAlign, NUM_VertAlign,
VertAlign_Invalid VertAlign_Invalid
}; };
LuaDeclareType( VertAlign );
#define align_left HorizAlign_Left #define align_left HorizAlign_Left
#define align_center HorizAlign_Center #define align_center HorizAlign_Center
#define align_right HorizAlign_Right #define align_right HorizAlign_Right
@@ -251,10 +255,7 @@ public:
// Alignment settings. These need to be virtual for BitmapText // Alignment settings. These need to be virtual for BitmapText
// //
virtual void SetHorizAlign( HorizAlign ha ) { m_HorizAlign = ha; } virtual void SetHorizAlign( HorizAlign ha ) { m_HorizAlign = ha; }
void SetHorizAlignString( const RString &s ); // convenience
virtual void SetVertAlign( VertAlign va ) { m_VertAlign = va; } virtual void SetVertAlign( VertAlign va ) { m_VertAlign = va; }
void SetVertAlignString( const RString &s ); // convenience
// //
-2
View File
@@ -430,8 +430,6 @@ void ActorUtil::ParseActorCommands( Lua *L, const RString &sCommands )
s << "\tself:" << sName << "("; s << "\tself:" << sName << "(";
bool bFirstParamIsString = bool bFirstParamIsString =
sName == "horizalign" ||
sName == "vertalign" ||
sName == "effectclock" || sName == "effectclock" ||
sName == "playcommand" || sName == "playcommand" ||
sName == "queuecommand" || sName == "queuecommand" ||