template<> bool FromStack<apActorCommands>( lua_State *L, apActorCommands &Object, int iOffset ) { LuaReference *pRef = new LuaReference; FromStack( L, *pRef, iOffset ); Object = apActorCommands( pRef ); return true; }
apActorCommands ActorUtil::ParseActorCommands( const RString &sCommands, const RString &sName ) { Lua *L = LUA->Get(); LuaHelpers::ParseCommandList( L, sCommands, sName, false ); LuaReference *pRet = new LuaReference; pRet->SetFromStack( L ); LUA->Release( L ); return apActorCommands( pRet ); }
void ScreenTestInput::Init() { ScreenWithMenuElements::Init(); m_textDevices.LoadFromFont( THEME->GetPathF("Common","normal") ); m_textDevices.SetName( "Devices" ); /* load metrics for the Devices text */ ActorUtil::SetXY( m_textDevices, m_sName ); ActorUtil::LoadAllCommands( m_textDevices, m_sName ); /* HACK: if we're missing metrics, use defaults. */ if( m_textDevices.GetX() == 0 || m_textDevices.GetY() == 0 ) m_textDevices.SetXY( SCREEN_LEFT+20, SCREEN_TOP+80 ); if( !m_textDevices.HasCommand("On") ) { CString sCommand = "diffuse,1,1,1,1;zoom,0.7;horizalign,left"; m_textDevices.AddCommand( "On", apActorCommands(new ActorCommands(sCommand)) ); } m_textDevices.PlayCommand( "On" ); /* set the devices text */ { vector<InputDevice> vDevices; vector<CString> vDescriptions; INPUTMAN->GetDevicesAndDescriptions( vDevices, vDescriptions ); FOREACH( CString, vDescriptions, s ) { if( *s == "MonkeyKeyboard" ) { vDescriptions.erase( s ); break; } } m_textDevices.SetText( join("\n",vDescriptions) ); } m_textInputs.LoadFromFont( THEME->GetPathF("Common","normal") ); m_textInputs.SetName( "Inputs" ); /* load metrics for the Inputs text */ ActorUtil::SetXY( m_textInputs, m_sName ); ActorUtil::LoadAllCommands( m_textInputs, m_sName ); /* HACK: if we're missing metrics, use defaults. */ if( m_textInputs.GetX() == 0 || m_textInputs.GetY() == 0 ) m_textInputs.SetXY( SCREEN_CENTER_X-250, SCREEN_CENTER_Y ); if( !m_textInputs.HasCommand("On") ) { CString sCommand = "diffuse,1,1,1,1;zoom,0.7;horizalign,left"; m_textInputs.AddCommand( "On", apActorCommands(new ActorCommands(sCommand)) ); } m_textInputs.PlayCommand( "On" ); this->AddChild( &m_textDevices ); this->AddChild( &m_textInputs ); this->SortByDrawOrder(); }