This commit is contained in:
Glenn Maynard
2005-04-25 07:01:07 +00:00
parent 90474dbd7b
commit ee8309859a
2 changed files with 45 additions and 0 deletions
+41
View File
@@ -6,6 +6,7 @@
#include "ThemeManager.h" #include "ThemeManager.h"
#include "ActorUtil.h" #include "ActorUtil.h"
REGISTER_ACTOR_CLASS( HelpDisplay )
HelpDisplay::HelpDisplay() HelpDisplay::HelpDisplay()
{ {
@@ -73,6 +74,46 @@ void HelpDisplay::Update( float fDeltaTime )
} }
template<class T>
class LunaHelpDisplay : public LunaBitmapText<T>
{
public:
LunaHelpDisplay() { LUA->Register( Register ); }
static int settips( T* p, lua_State *L )
{
luaL_checktype( L, 1, LUA_TTABLE );
lua_pushvalue( L, 1 );
vector<CString> arrayTips;
LuaHelpers::ReadArrayFromTable( arrayTips, LUA->L );
lua_pop( L, 1 );
if( lua_gettop(L) > 1 && !lua_isnil( L, 2 ) )
{
vector<CString> arrayTipsAlt;
luaL_checktype( L, 2, LUA_TTABLE );
lua_pushvalue( L, 2 );
LuaHelpers::ReadArrayFromTable( arrayTipsAlt, L );
lua_pop( L, 1 );
p->SetTips( arrayTips, arrayTipsAlt );
}
else
p->SetTips( arrayTips );
return 0;
}
static void Register(lua_State *L)
{
ADD_METHOD( settips )
LunaActor<T>::Register( L );
}
};
LUA_REGISTER_CLASS( HelpDisplay )
#include "song.h" #include "song.h"
#include "GameState.h" #include "GameState.h"
#include "Course.h" #include "Course.h"
+4
View File
@@ -7,6 +7,7 @@
#include "ThemeMetric.h" #include "ThemeMetric.h"
#include "MessageManager.h" #include "MessageManager.h"
struct lua_State;
class HelpDisplay : public BitmapText class HelpDisplay : public BitmapText
{ {
@@ -22,6 +23,9 @@ public:
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void SetName( const CString &sName, const CString &sID = "" ); virtual void SetName( const CString &sName, const CString &sID = "" );
// Lua
virtual void PushSelf( lua_State *L );
protected: protected:
ThemeMetric<float> TIP_SHOW_TIME; ThemeMetric<float> TIP_SHOW_TIME;