Ejemplo n.º 1
0
void GSYesNo::OnActive()
{
  GSText::OnActive();

  m_gui = LoadGui("gui-yesno.txt");
  Assert(m_gui);

  GuiButton* yes = (GuiButton*)GetElementByName(m_gui, "yes-button");
  yes->SetCommand(Amju::OnYes);
  yes->SetText(m_yesText);

  GuiButton* no = (GuiButton*)GetElementByName(m_gui, "no-button");
  no->SetCommand(Amju::OnNo);
  no->SetText(m_noText);
  
  IGuiText* q = dynamic_cast<IGuiText*>(GetElementByName(m_gui, "question"));
  q->SetText(m_question);

  // Set safe button (blue, pulsing) and non-undoable (red)
  // TODO Decouple these colour signals from keyboard bindings
  if (m_yesRed)
  {
    no->SetHasFocus(true); // blue, pulsing
    yes->SetIsCancelButton(true);  // red
  }
  else
  {
    yes->SetHasFocus(true); // blue, pulsing
    no->SetIsCancelButton(true);  // red
  }
}
Ejemplo n.º 2
0
void GSVe3ViewOtherPlayers::OnActive()
{
  GSGui::OnActive();

  m_gui = LoadGui("gui-ve3-viewotherplayers.txt");
  Assert(m_gui);

  GetElementByName(m_gui, "back-button")->SetCommand(OnBack);
  GetElementByName(m_gui, "prev-player-button")->SetCommand(OnPrevPlayer);
  GetElementByName(m_gui, "next-player-button")->SetCommand(OnNextPlayer);

  GetElementByName(m_gui, "make-trade-button")->SetCommand(Amju::OnMakeATrade);
  GetElementByName(m_gui, "see-guestbook-button")->SetCommand(Amju::OnSeeGuestbook);

  // Initialise character
  if (m_player && 
      m_player->GetId() != GetLocalPlayerId()) // could happen if you log out, then in as this player
  {
    ShowPlayer(m_player, m_gui);
  }
  else
  {
    NextPlayer();
  }

  SetHomeButton();
}
Ejemplo n.º 3
0
Lurker::Lurker()
{
  m_gui = LoadGui("gui-lurk.txt");
  Assert(m_gui);

  m_ok = (GuiButton*)GetElementByName(m_gui, "ok-button");
  Assert(m_ok);
  m_ok->SetCommand(Amju::OnLurkOk);

  m_yes = (GuiButton*)GetElementByName(m_gui, "yes-button");
  Assert(m_yes);
  m_yes->SetCommand(Amju::OnLurkYes);

  m_no = (GuiButton*)GetElementByName(m_gui, "no-button");
  Assert(m_no);
  m_no->SetCommand(Amju::OnLurkNo);

/*
  m_button = new GuiButton;
  m_button->OpenAndLoad("lurk-button.txt");
  TheEventPoller::Instance()->AddListener(m_button);
  m_button->SetVisible(false);
  m_button->SetCommand(Amju::OnLurkOk);
*/
}
Ejemplo n.º 4
0
internal void DisplayMissions(TAUIElement * Root, CampaignList * Campaigns, MemoryArena * TempArena)
{
    Assert(Root->ElementType == TAG_UI_CONTAINER);
    TAUIElement * CoreButton = GetElementByName(ELEMENT_NAME_CORE, Root);

    TAUIElement * CampaignElement = GetElementByName(ELEMENT_NAME_CAMPAIGN, Root);
    TAUIListBox * CampaignListBox = &CampaignElement->ListBox;

    TAUIElement * MissionElement = GetElementByName(ELEMENT_NAME_MISSIONS, Root);
    TAUIListBox * MissionListBox = &MissionElement->ListBox;

    MissionListBox->NumberOfDisplayableItems = 4;

    Campaign * Campaign;
    s32 CampaignIndex = CampaignListBox->SelectedIndex;
    if(CoreButton->Button.Pressed)
    {
	Campaign = &Campaigns->CORECampaigns[CampaignIndex];
    }
    else
    {
	Campaign = &Campaigns->ARMCampaigns[CampaignIndex];
    }

    MissionListBox->NumberOfItems = Campaign->NumberOfMissions;
    MissionListBox->ItemStrings = PushArray(TempArena, MissionListBox->NumberOfItems, char*);
    for(s32 i=0;i<MissionListBox->NumberOfItems;i++)
    {
	MissionListBox->ItemStrings[i] = Campaign->Missions[i].MissionName;
    }
}
Ejemplo n.º 5
0
void GSOptions::OnActive()
{
  GSText::OnActive();

  // buttons
  m_gui = WWLoadGui("gui-options.txt");
  Assert(m_gui);
  GetElementByName(m_gui, "back-button")->SetCommand(OnBack);

  // Checkboxes: get previous value from config
  GameConfigFile* gcf = TheGameConfigFile::Instance();
  bool music = gcf->GetInt(MUSIC_KEY);
  bool sound = gcf->GetInt(SOUND_KEY);

  // Checkbox textures 
  Texture* checked = (Texture*)TheResourceManager::Instance()->GetRes("checked.png");
  Texture* unchecked = (Texture*)TheResourceManager::Instance()->GetRes("unchecked.png");

  // Music checkbox 
  GuiCheck* ch = dynamic_cast<GuiCheck*>(GetElementByName(m_gui, "music-check"));
  Assert(ch);
  ch->Set(checked, unchecked); // checked, unchecked textures
  ch->SetOnChangeValue(OnMusic);
  // Set initial value from config 
  ch->SetValue(music);

  // Sound checkbox 
  ch = dynamic_cast<GuiCheck*>(GetElementByName(m_gui, "sound-check"));
  Assert(ch);
  ch->Set(checked, unchecked); // checked, unchecked textures
  ch->SetOnChangeValue(OnSound);
  // Set initial value from config 
  ch->SetValue(sound); 
}
Ejemplo n.º 6
0
void GuiFileDialog::SetPathAndFile(const std::string& path)
{
  GuiFileListBox* fb = dynamic_cast<GuiFileListBox*>(GetElementByName("fd-file-list-box"));
  Assert(fb);
  fb->SetDir(GetFilePath(path));
  // Set path text
  GuiTextEdit* text = dynamic_cast<GuiTextEdit*>(GetElementByName("fd-path-text"));
  Assert(text);
  text->SetText(path);
}
Ejemplo n.º 7
0
void GSDoThoseCogTests::OnActive()
{
  GSGui::OnActive();

  m_gui = LoadGui("gui-dothosecogtests.txt");
  Assert(m_gui);

  GuiButton* ok = (GuiButton*)GetElementByName(m_gui, "ok-button");
  ok->SetCommand(OnDoCogTestsOk);

  GuiButton* quit = (GuiButton*)GetElementByName(m_gui, "quit-button");
  quit->SetCommand(OnDoCogTestsQuit);
}
Ejemplo n.º 8
0
void GSAdminMenu::OnActive()
{
  GSGui::OnActive();

  m_gui = LoadGui("gui-adminmenu.txt");
  Assert(m_gui);

  // Set focus element, cancel element, command handlers
//  GetElementByName(m_gui, "local-button")->SetCommand(Amju::OnLocalButton);
  GetElementByName(m_gui, "edit-button")->SetCommand(Amju::OnEditButton);
  GetElementByName(m_gui, "cog-button")->SetCommand(Amju::OnCogTestButton);

  GuiButton* cancel = (GuiButton*)GetElementByName(m_gui, "cancel-button");
  cancel->SetCommand(Amju::OnCancelButton);
  cancel->SetIsCancelButton(true);
}
Ejemplo n.º 9
0
void GSMoreMenu::OnActive()
{
  GSText::OnActive();

  m_gui = WWLoadGui("gui-menu-more.txt");
  Assert(m_gui);

  CreateText("");

  GetElementByName(m_gui, "new-button")->SetCommand(OnNew);
  GetElementByName(m_gui, "options-button")->SetCommand(OnOptions);
  GetElementByName(m_gui, "about-button")->SetCommand(OnAbout);
  GetElementByName(m_gui, "back-button")->SetCommand(OnBack);
  GetElementByName(m_gui, "debug-button")->SetCommand(OnDebug);

}
Ejemplo n.º 10
0
void GuiFileDialog::OnPathChange()
{
  GuiTextEdit* text = dynamic_cast<GuiTextEdit*>(GetElementByName("fd-path-text"));
  Assert(text);
  lastPath = CleanPath(text->GetText()); 

  GuiFileListBox* fb = dynamic_cast<GuiFileListBox*>(GetElementByName("fd-file-list-box"));
  Assert(fb);
  fb->SetDir(lastPath);

  ShowPreview();

#ifdef GFD_DEBUG
std::cout << "Path change: lastPath is now \"" << lastPath << "\"\n";
#endif
}
Ejemplo n.º 11
0
void GSGui::SetHomeButton()
{
  GuiButton* home = (GuiButton*)GetElementByName(m_gui, "home-button");
  if (home)
  {
    home->SetCommand(OnHome);
  }
}
Ejemplo n.º 12
0
void GSQuitGame::OnActive()
{
  GSGui::OnActive();

  m_gui = LoadGui("gui-quitgame.txt");
  Assert(m_gui);

  GuiButton* cancel = (GuiButton*)GetElementByName(m_gui, "cancel-button");
  cancel->SetCommand(Amju::OnCancel);
  cancel->SetHasFocus(true); 

  GuiButton* qsession = (GuiButton*)GetElementByName(m_gui, "quitsession-button");
  qsession->SetCommand(Amju::OnQuitSession);

  GuiButton* qprocess = (GuiButton*)GetElementByName(m_gui, "quitprocess-button");
  qprocess->SetCommand(Amju::OnQuitProcess);

}
Ejemplo n.º 13
0
Archivo: XML.cpp Proyecto: GetEnvy/Envy
BOOL CXMLElement::Merge(const CXMLElement* pInput, BOOL bOverwrite)
{
	if ( ! this || ! pInput ) return FALSE;
	if ( this == pInput ) return TRUE;

	TRACE( "Merging   XML: %s\n", (LPCSTR)CT2A( ToString( FALSE, FALSE ) ) );
	TRACE( "      and XML: %s\n", (LPCSTR)CT2A( pInput->ToString( FALSE, FALSE ) ) );

	if ( m_sName.CompareNoCase( pInput->m_sName ) != 0 )
	{
		TRACE( "Failed to merge XML due different schemes \"%s\" and \"%s\".\n", (LPCSTR)CT2A( m_sName ), (LPCSTR)CT2A( pInput->m_sName ) );
		return FALSE;
	}

	BOOL bChanged = FALSE;

	for ( POSITION pos = pInput->GetElementIterator(); pos; )
	{
		const CXMLElement* pElement = pInput->GetNextElement( pos );
		CXMLElement* pTarget = GetElementByName( pElement->m_sName );

		if ( pTarget == NULL )
		{
			AddElement( pElement->Clone() );
			bChanged = TRUE;
		}
		else if ( pTarget->Merge( pElement, bOverwrite ) )
		{
			bChanged = TRUE;
		}
	}

	for ( POSITION pos = pInput->GetAttributeIterator(); pos; )
	{
		CXMLAttribute* pAttribute = pInput->GetNextAttribute( pos );
		CXMLAttribute* pTarget = GetAttribute( pAttribute->m_sName );

		if ( pTarget == NULL )
		{
			AddAttribute( pAttribute->Clone() );
			bChanged = TRUE;
		}
		else if ( bOverwrite && ! pTarget->Equals( pAttribute ) )
		{
			pTarget->SetValue( pAttribute->GetValue() );
			bChanged = TRUE;
		}
	}

	if ( bChanged )
		TRACE( "resulting XML: %s\n", (LPCSTR)CT2A( ToString( FALSE, FALSE ) ) );
	else
		TRACE( "resulting XML unchanged.\n" );

	return bChanged;
}
Ejemplo n.º 14
0
internal void DisplayCampaigns(TAUIElement * Root, CampaignList * Campaigns, MemoryArena * TempArena)
{
    Assert(Root->ElementType == TAG_UI_CONTAINER);
    TAUIElement * ArmButton = GetElementByName(ELEMENT_NAME_ARM,Root);
    TAUIElement * CoreButton = GetElementByName(ELEMENT_NAME_CORE, Root);

    TAUIElement * CampaignElement = GetElementByName(ELEMENT_NAME_CAMPAIGN, Root);
    TAUIListBox * CampaignListBox = &CampaignElement->ListBox;

    CampaignListBox->NumberOfDisplayableItems = 3;
    if(CoreButton->Button.Pressed)
    {
	CampaignListBox->NumberOfItems = Campaigns->NumberOfCORECampaigns;
	CampaignListBox->ItemStrings = PushArray(TempArena, CampaignListBox->NumberOfItems, char*);
	for(s32 i=0;i<Campaigns->NumberOfCORECampaigns;i++)
	{
	    CampaignListBox->ItemStrings[i] = Campaigns->CORECampaigns[i].CampaignName;
	}
    }
Ejemplo n.º 15
0
void GSCogTestHelp::OnActive()
{
  GSGui::OnActive();

  m_gui = LoadGui("gui-cogtest-help.txt");
  Assert(m_gui);

  // Set focus element, cancel element, command handlers
  GetElementByName(m_gui, "done-button")->SetCommand(OnHelpDone);
}
Ejemplo n.º 16
0
void GSYesNo::OnActive()
{
  GSGui::OnActive();

  m_gui = LoadGui("gui-yesno.txt");
  Assert(m_gui);

  GuiButton* yes = (GuiButton*)GetElementByName(m_gui, "yes-button");
  yes->SetCommand(Amju::OnYes);
  yes->SetHasFocus(true);
  yes->SetText(m_yesText);

  GuiButton* no = (GuiButton*)GetElementByName(m_gui, "no-button");
  no->SetCommand(Amju::OnNo);
  no->SetIsCancelButton(true); 
  no->SetText(m_noText);
  
  GuiText* q = (GuiText*)GetElementByName(m_gui, "question");
  q->SetText(m_question);
}
Ejemplo n.º 17
0
void GuiFileDialog::OnListboxClick(const std::string& fullPathAndFilename)
{
  lastPath = CleanPath(fullPathAndFilename); 
  GuiTextEdit* text = dynamic_cast<GuiTextEdit*>(GetElementByName("fd-path-text"));
  Assert(text);
  text->SetText(lastPath);

  ShowPreview();

#ifdef GFD_DEBUG
std::cout << "Listbox click: lastPath is now \"" << lastPath << "\"\n";
#endif
}
Ejemplo n.º 18
0
bool GuiFileDialog::Load(File* f)
{
  if (!GuiDialog::Load(f))
  {
    return false;
  }

  lastFileDialog = this;

  // Element name is in text file.
  // TODO Look up by type instead ??
  GuiFileListBox* fb = dynamic_cast<GuiFileListBox*>(GetElementByName("fd-file-list-box"));
  Assert(fb);
  fb->SetDoubleClickCallback(Amju::OnListboxClick);
  fb->SetSingleClickCallback(Amju::OnListboxClick);

  std::string path = lastPath; 
  // Set default/start dir
  if (path.empty())
  {
#ifdef WIN32
    path = "c:\\";
#endif

#ifdef MACOSX
    path = "/";
#endif
  }

  fb->SetDir(path);
  // Set path text
  GuiTextEdit* text = dynamic_cast<GuiTextEdit*>(GetElementByName("fd-path-text"));
  Assert(text);
  text->SetText(path);
  text->SetOnChangeFunc(Amju::OnPathChange);

  return true;
}
Ejemplo n.º 19
0
void GSNetError::OnActive()
{
  GSGui::OnActive();

  m_gui = LoadGui("gui-error.txt");
  Assert(m_gui);

////  m_gui->GetElementByName("error-ok-button")->SetCommand(Amju::OnErrorOk);
////  m_gui->GetElementByName("error-quit-button")->SetCommand(Amju::OnErrorQuit);
  
  GuiButton* ok = (GuiButton*)GetElementByName(m_gui, "error-ok-button");
  ok->SetCommand(Amju::OnErrorOk);
  ok->SetHasFocus(true);

  GuiButton* quit = (GuiButton*)GetElementByName(m_gui, "error-quit-button");
  quit->SetCommand(Amju::OnErrorQuit);
  quit->SetIsCancelButton(true);


  GuiText* t = dynamic_cast<GuiText*>(m_gui->GetElementByName("error"));
  Assert(t);
  t->SetText(m_errorStr);
}
Ejemplo n.º 20
0
void GSStartMenu::OnActive()
{
    SetGameMode(AMJU_MODE_NONE);

    GSGui::OnActive();

    m_gui = LoadGui("gui-startmenu.txt");
    Assert(m_gui);

    GuiButton* start = (GuiButton*)GetElementByName(m_gui, "start-button");
    start->SetCommand(Amju::OnStartButton);

    GuiButton* guest = (GuiButton*)GetElementByName(m_gui, "guest-button");
    // not supported currently
    //guest->SetCommand(Amju::OnGuestButton);

    GuiButton* options = (GuiButton*)GetElementByName(m_gui, "options-button");
    options->SetCommand(Amju::OnOptionsButton);

    GuiButton* admin = (GuiButton*)GetElementByName(m_gui, "admin-button");
#ifdef _DEBUG
    admin->SetCommand(Amju::OnAdminButton);
#else
    admin->SetVisible(false);
#endif

    GuiButton* cancel = (GuiButton*)GetElementByName(m_gui, "cancel-button");
    cancel->SetCommand(Amju::OnCancelButton);
    cancel->SetIsCancelButton(true);

    // TODO remember last choice and keep highlighted
    start->SetHasFocus(true);

#ifdef PLAY_MUSIC
    TheSoundManager::Instance()->PlaySong("Sound/piano.it");
#endif
}
Ejemplo n.º 21
0
void GuiFileDialog::ShowPreview()
{
  // TODO Look up preview type associated with extension
  if (GetFileExt(lastPath) == "obj")
  {
    // TODO Load mesh - don't use ResourceManager
    ObjMesh* mesh = LoadObjMesh(lastPath);
    if (mesh)
    {
      GuiObjView* gov = dynamic_cast<GuiObjView*>(GetElementByName("fd-obj-view"));
      Assert(gov);
      gov->SetObjMesh(mesh);
    }
  }
}
Ejemplo n.º 22
0
void GSFileUpdateCheck::OnActive()
{
  GSGui::OnActive();

  m_gui = LoadGui("gui-fileupdatecheck.txt");
  Assert(m_gui);

  GetElementByName(m_gui, "skip-button")->SetCommand(Amju::OnSkip);

  // New June 2013: Don't check for updated files. Just skip to next state.
  //TheGame::Instance()->SetCurrentState(TheGSWaitForNewLocation::Instance());

  // Create request
  // Url contains timestamp of last check
  std::string url = TheVe1ReqManager::Instance()->MakeUrl(FILE_UPDATE_CHECK);
  url += "&time=" + m_timestamp;
  TheVe1ReqManager::Instance()->SerialReqManager::AddReq(new FileUpdater(url), 1, false);
}
Ejemplo n.º 23
0
void GSGui::UpdateHeartCount()
{
  if (m_gui)
  {
    GuiText* text = (GuiText*)GetElementByName(m_gui, "score-num");
    if (text)
    {
      int h = 0;
      if (GetPlayerCount(SCORE_KEY, &h))
      {
        text->SetText(ToString(h));
      }
      else
      {
        text->SetText("");
      }
    }
  }
}
Ejemplo n.º 24
0
void GSFileUpdateCheck::OnDownloadedFile(const std::string& filename)
{
  // If we are no longer the current state, it doesn't matter
  if (TheGame::Instance()->GetState() != this)
  {
    return;
  }

  m_numFilesDownloaded++;
  if (m_numFilesDownloaded >= m_numFilesToWaitFor)
  {
    // Done! Update to new timestamp
    OnFinishedChecking(m_newtimestamp);

    if (m_gui)
    {
      GuiText* t = (GuiText*)GetElementByName(m_gui, "filename");
      t->SetText(filename);
    }
  }
}
Ejemplo n.º 25
0
void GSAvatarMod::CheckAvailable()
{
  SceneNode* node = GetGuiSceneGraph()->GetRootNode(SceneGraph::AMJU_OPAQUE);
  GuiButton* ok = (GuiButton*)GetElementByName(m_gui, "ok-button");
 
  if (m_current >= m_howManyCharsAvailable)
  {
    if (node)
    {
      node->SetColour(Colour(0.5f, 0.5f, 0.5f, 0.5f));
      ok->SetIsEnabled(false);
    }
  }
  else
  {
    if (node)
    {
      node->SetColour(Colour(1, 1, 1, 1));
      ok->SetIsEnabled(true);
    }
  }
}
Ejemplo n.º 26
0
void GSVe3ChooseTradeType::OnActive()
{
  GSGui::OnActive();

  m_gui = LoadGui("gui-ve3-choosetradetype.txt");
  Assert(m_gui);

  GetElementByName(m_gui, "back-button")->SetCommand(OnBack);
  GetElementByName(m_gui, "give-treasure-button")->SetCommand(Amju::OnGiveTreasure);
  GetElementByName(m_gui, "give-food-button")->SetCommand(Amju::OnGiveFood);

  Assert(m_player); // the other player
  Player* localPlayer = GetLocalPlayer();
  Assert(localPlayer);
  Player* PLAYER[4] = { localPlayer, m_player, localPlayer, m_player };
  for (int i = 0; i < 4; i++)
  {
    LayerGroups layerGroups; // store settings for each layer
    layerGroups.SetFromSprite(PLAYER[i]->GetSprite());
    layerGroups.SetSprite(&m_spriteNodes[i].GetSprite());

    m_spriteNodes[i].Update();
  }

  SetHomeButton();

  // Set food and treasure counts for both players
  Assert(dynamic_cast<GuiText*>(GetElementByName(m_gui, "food-you-text")));
  Assert(dynamic_cast<GuiText*>(GetElementByName(m_gui, "food-other-text")));
  Assert(dynamic_cast<GuiText*>(GetElementByName(m_gui, "treasure-you-text")));
  Assert(dynamic_cast<GuiText*>(GetElementByName(m_gui, "treasure-other-text")));

  if (localPlayer->Exists(FOOD_STORED_KEY))
  {
    ((GuiText*)GetElementByName(m_gui, "food-you-text"))->SetText(localPlayer->GetVal(FOOD_STORED_KEY));
  }

  if (m_player->Exists(FOOD_STORED_KEY))
  {
    ((GuiText*)GetElementByName(m_gui, "food-other-text"))->SetText(m_player->GetVal(FOOD_STORED_KEY));
  }

  if (localPlayer->Exists(TREASURE_KEY))
  {
    ((GuiText*)GetElementByName(m_gui, "treasure-you-text"))->SetText(localPlayer->GetVal(TREASURE_KEY));
  }

  if (m_player->Exists(TREASURE_KEY))
  {
    ((GuiText*)GetElementByName(m_gui, "treasure-other-text"))->SetText(m_player->GetVal(TREASURE_KEY));
  }
}
Ejemplo n.º 27
0
/// Pushes given element to the interaction/display stack.
int UserInterface::PushToStack(String elementName){
	return PushToStack(GetElementByName(elementName));
}
Ejemplo n.º 28
0
void UserInterface::PopFromStack(String elementName){
	PopFromStack(GetElementByName(elementName));
}
Ejemplo n.º 29
0
std::string GuiFileDialog::GetPathAndFile()
{
  GuiTextEdit* text = dynamic_cast<GuiTextEdit*>(GetElementByName("fd-path-text"));
  Assert(text);
  return text->GetText();
}
Ejemplo n.º 30
0
void GSTitle::OnActive()
{
  static bool first = true;
  if (first)
  {
    first = false;

    TheAvatarManager::Instance()->Load();

    // Set default keyboard layout
    KbSetLayout(KB_LAYOUT_REGULAR);

    TheGSOptions::Instance()->LoadFromConfig();
  }

  // Kill off any dummy player object
  TheGame::Instance()->ClearGameObjects();

#ifdef SHOW_FRAME_TIME
  Font* font = (Font*)TheResourceManager::Instance()->GetRes("font2d/arial-font.font");
  TheGame::Instance()->SetFrameTimeFont(font);
#endif

  GSGui::OnActive();

  if (!m_titleImage.OpenAndLoad("title-bgimage.txt"))
  {
std::cout << "Failed to load GUI title bg image!\n";
    Assert(0);
  }

  m_gui = LoadGui("gui-title.txt");
  Assert(m_gui);

  GuiButton* start = (GuiButton*)GetElementByName(m_gui, "start-button");
  start->SetCommand(Amju::OnStartButton);
  start->SetHasFocus(true); 

  GuiButton* options = (GuiButton*)GetElementByName(m_gui, "options-button");
  options->SetCommand(Amju::OnOptionsButton);

  GuiButton* quick = (GuiButton*)GetElementByName(m_gui, "quick-start-button");
  static PlayerInfoManager* pim = ThePlayerInfoManager::Instance();
  if (pim->GetNumPlayerNames() > 0)
  {
    quick->SetVisible(true);
    quick->SetCommand(Amju::OnQuickStartButton);
    quick->SetHasFocus(true);

    // Change button text to player name
    Strings names = pim->GetPlayerNames();
    Assert(!names.empty());
    pim->SetCurrentPlayer(names[0]);
    PlayerInfo* pi = pim->GetPI();
    Assert(pi);
    std::string playername = pi->PIGetString(PI_KEY("playername"));
    quick->SetText(playername);
  }
  else
  {
    quick->SetVisible(false);
  }

  GuiButton* quit = (GuiButton*)GetElementByName(m_gui, "quit-button");
  quit->SetCommand(Amju::OnQuitButton);
  quit->SetIsCancelButton(true);

#ifdef SHOW_VERSION
  GuiText* ver = (GuiText*)GetElementByName(m_gui, "version");
  std::string s = "v." + ToString(VersionMajor) + "." + ToString(VersionMinor);
#ifdef _DEBUG
  s += " DEBUG";
#endif
  ver->SetText(s);
#endif

  //CreateText("my game");

#ifdef PLAY_MUSIC
  TheSoundManager::Instance()->PlaySong(ROConfig()->GetValue("music-title", "Sound/hammers.it"));
#endif
}