diff --git a/stepmania/src/HelpDisplay.cpp b/stepmania/src/HelpDisplay.cpp index fb07e37408..ce163cb80d 100644 --- a/stepmania/src/HelpDisplay.cpp +++ b/stepmania/src/HelpDisplay.cpp @@ -6,6 +6,7 @@ #include "ThemeManager.h" #include "ActorUtil.h" +REGISTER_ACTOR_CLASS( HelpDisplay ) HelpDisplay::HelpDisplay() { @@ -73,6 +74,46 @@ void HelpDisplay::Update( float fDeltaTime ) } +template +class LunaHelpDisplay : public LunaBitmapText +{ +public: + LunaHelpDisplay() { LUA->Register( Register ); } + + static int settips( T* p, lua_State *L ) + { + luaL_checktype( L, 1, LUA_TTABLE ); + lua_pushvalue( L, 1 ); + vector arrayTips; + LuaHelpers::ReadArrayFromTable( arrayTips, LUA->L ); + lua_pop( L, 1 ); + + if( lua_gettop(L) > 1 && !lua_isnil( L, 2 ) ) + { + vector 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::Register( L ); + } +}; + +LUA_REGISTER_CLASS( HelpDisplay ) + + #include "song.h" #include "GameState.h" #include "Course.h" diff --git a/stepmania/src/HelpDisplay.h b/stepmania/src/HelpDisplay.h index 9aaf381e76..c1f97c49a5 100644 --- a/stepmania/src/HelpDisplay.h +++ b/stepmania/src/HelpDisplay.h @@ -7,6 +7,7 @@ #include "ThemeMetric.h" #include "MessageManager.h" +struct lua_State; class HelpDisplay : public BitmapText { @@ -22,6 +23,9 @@ public: virtual void Update( float fDeltaTime ); virtual void SetName( const CString &sName, const CString &sID = "" ); + // Lua + virtual void PushSelf( lua_State *L ); + protected: ThemeMetric TIP_SHOW_TIME;