textHelp in Lua

This commit is contained in:
Glenn Maynard
2007-03-05 23:27:15 +00:00
parent 743f8ec257
commit 60be259f3e
4 changed files with 36 additions and 26 deletions
@@ -0,0 +1,29 @@
local children = { };
children[#children+1] = Def.HelpDisplay {
File = THEME:GetPathF("HelpDisplay", "text");
InitCommand=function(self)
local s = ScreenString("HelpText");
self:SetTipsColonSeparated(s);
end;
SetHelpTextCommand=function(self, params)
self:SetTipsColonSeparated( params.Text );
end;
OnCommand=function(self)
self:x( ScreenMetric("HelpX") );
self:y( ScreenMetric("HelpY") );
local f = ScreenMetric("HelpOnCommand");
f(self);
end;
OffCommand=function(self)
local f = ScreenMetric("HelpOffCommand");
f(self);
end;
};
return Def.ActorFrame {
children = children;
};
+2 -4
View File
@@ -21,10 +21,8 @@ void ScreenCenterImage::Init()
ScreenWithMenuElements::Init();
#if defined(XBOX)
vector<RString> strArray;
RString text("Use the left analog stick to translate the screen and right right analog stick to scale");
strArray.push_back(text);
m_textHelp->SetTips(strArray);
// XXX
SetHelpText( "Use the left analog stick to translate the screen and right right analog stick to scale" );
#endif
m_textInstructions.LoadFromFont( THEME->GetPathF("Common","normal") );
+4 -19
View File
@@ -1,7 +1,6 @@
#include "global.h"
#include "ScreenWithMenuElements.h"
#include "MenuTimer.h"
#include "HelpDisplay.h"
#include "RageLog.h"
#include "ThemeManager.h"
#include "GameState.h"
@@ -22,7 +21,6 @@
ScreenWithMenuElements::ScreenWithMenuElements()
{
m_MenuTimer = NULL;
m_textHelp = new HelpDisplay;
FOREACH_PlayerNumber( p )
m_MemoryCardDisplay[p] = NULL;
m_MenuTimer = NULL;
@@ -84,13 +82,6 @@ void ScreenWithMenuElements::Init()
LOAD_ALL_COMMANDS_AND_SET_XY( m_autoFooter );
this->AddChild( m_autoFooter );
m_textHelp->SetName( "Help" );
m_textHelp->Load( "HelpDisplay" );
m_textHelp->LoadFromFont( THEME->GetPathF("HelpDisplay","text") );
LOAD_ALL_COMMANDS_AND_SET_XY( m_textHelp );
LoadHelpText();
this->AddChild( m_textHelp );
m_sprUnderlay.Load( THEME->GetPathB(m_sName,"underlay") );
m_sprUnderlay->SetName("Underlay");
m_sprUnderlay->SetDrawOrder( DRAW_ORDER_UNDERLAY );
@@ -175,7 +166,6 @@ void ScreenWithMenuElements::TweenOnScreen()
ON_COMMAND( m_MenuTimer );
ON_COMMAND( m_autoFooter );
ON_COMMAND( m_textHelp );
m_sprUnderlay->PlayCommand("On");
m_sprOverlay->PlayCommand("On");;
m_In.PlayCommand("On");;
@@ -186,7 +176,6 @@ void ScreenWithMenuElements::TweenOnScreen()
ScreenWithMenuElements::~ScreenWithMenuElements()
{
SAFE_DELETE( m_MenuTimer );
SAFE_DELETE( m_textHelp );
FOREACH_PlayerNumber( p )
{
if( m_MemoryCardDisplay[p] != NULL )
@@ -194,14 +183,11 @@ ScreenWithMenuElements::~ScreenWithMenuElements()
}
}
void ScreenWithMenuElements::LoadHelpText()
void ScreenWithMenuElements::SetHelpText( RString s )
{
vector<RString> vs;
RString s = THEME->GetString(m_sName,"HelpText");
split( s, "::", vs );
m_textHelp->SetTips( vs );
m_textHelp->PlayCommand( "Changed" );
Message msg("SetHelpText");
msg.SetParam( "Text", s );
this->HandleMessage( msg );
}
void ScreenWithMenuElements::StartPlayingMusic()
@@ -275,7 +261,6 @@ void ScreenWithMenuElements::TweenOffScreen()
if( m_MemoryCardDisplay[p] )
OFF_COMMAND( m_MemoryCardDisplay[p] );
OFF_COMMAND( m_autoFooter );
OFF_COMMAND( m_textHelp );
m_sprUnderlay->PlayCommand("Off");
m_sprOverlay->PlayCommand("Off");;
+1 -3
View File
@@ -7,7 +7,6 @@
#include "ThemeMetric.h"
class MenuTimer;
class HelpDisplay;
class MemoryCardDisplay;
class ScreenWithMenuElements : public Screen
@@ -37,7 +36,7 @@ public:
protected:
virtual void StartPlayingMusic();
virtual void LoadHelpText();
void SetHelpText( RString s );
/* If true, BeginScreen() will run OnCommand on the whole screen, and
* TweenOnScreen will not be called. (Eventually, all screens should
@@ -51,7 +50,6 @@ protected:
MemoryCardDisplay *m_MemoryCardDisplay[NUM_PLAYERS];
MenuTimer *m_MenuTimer;
AutoActor m_autoFooter;
HelpDisplay *m_textHelp;
AutoActor m_sprOverlay;
Transition m_In;