Skip to content
Permalink
Browse files

Added language selector to main menu

  • Loading branch information...
ccw808 committed Sep 11, 2018
1 parent 177ba3e commit 6f6b2ed336db827d3fc4100e0fc77107c972c6e3
Showing with 470 additions and 7 deletions.
  1. +402 −0 Client/core/CLanguageSelector.cpp
  2. +55 −0 Client/core/CLanguageSelector.h
  3. +4 −0 Client/core/CMainMenu.cpp
  4. +9 −7 Client/core/CMainMenu.h
  5. BIN Shared/data/MTA San Andreas/MTA/locale/ar/flag.png
  6. BIN Shared/data/MTA San Andreas/MTA/locale/bg/flag.png
  7. BIN Shared/data/MTA San Andreas/MTA/locale/cs/flag.png
  8. BIN Shared/data/MTA San Andreas/MTA/locale/de/flag.png
  9. BIN Shared/data/MTA San Andreas/MTA/locale/el/flag.png
  10. BIN Shared/data/MTA San Andreas/MTA/locale/en_US/flag.png
  11. BIN Shared/data/MTA San Andreas/MTA/locale/es/flag.png
  12. BIN Shared/data/MTA San Andreas/MTA/locale/et/flag.png
  13. BIN Shared/data/MTA San Andreas/MTA/locale/fr/flag.png
  14. BIN Shared/data/MTA San Andreas/MTA/locale/hr/flag.png
  15. BIN Shared/data/MTA San Andreas/MTA/locale/hu/flag.png
  16. BIN Shared/data/MTA San Andreas/MTA/locale/id/flag.png
  17. BIN Shared/data/MTA San Andreas/MTA/locale/it/flag.png
  18. BIN Shared/data/MTA San Andreas/MTA/locale/ja/flag.png
  19. BIN Shared/data/MTA San Andreas/MTA/locale/lt/flag.png
  20. BIN Shared/data/MTA San Andreas/MTA/locale/lv/flag.png
  21. BIN Shared/data/MTA San Andreas/MTA/locale/mk/flag.png
  22. BIN Shared/data/MTA San Andreas/MTA/locale/nb/flag.png
  23. BIN Shared/data/MTA San Andreas/MTA/locale/nl/flag.png
  24. BIN Shared/data/MTA San Andreas/MTA/locale/pl/flag.png
  25. BIN Shared/data/MTA San Andreas/MTA/locale/pt_BR/flag.png
  26. BIN Shared/data/MTA San Andreas/MTA/locale/ro/flag.png
  27. BIN Shared/data/MTA San Andreas/MTA/locale/ru/flag.png
  28. BIN Shared/data/MTA San Andreas/MTA/locale/sk/flag.png
  29. BIN Shared/data/MTA San Andreas/MTA/locale/sl/flag.png
  30. BIN Shared/data/MTA San Andreas/MTA/locale/sv/flag.png
  31. BIN Shared/data/MTA San Andreas/MTA/locale/tr/flag.png
  32. BIN Shared/data/MTA San Andreas/MTA/locale/uk/flag.png
  33. BIN Shared/data/MTA San Andreas/MTA/locale/zh_CN/flag.png
  34. BIN Shared/data/MTA San Andreas/MTA/locale/zh_TW/flag.png

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,55 @@
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: core/CLanguageSelector.h
*
* Multi Theft Auto is available from http://www.multitheftauto.com/
*
*****************************************************************************/

struct CLangListItem
{
CLangListItem(void) : fFocusEffectPos(0), fFocusEffectTarget(0), pContainerPane(nullptr), pFlag(nullptr), pLabel(nullptr) {}
float fFocusEffectPos;
float fFocusEffectTarget;
SString strLocale;
CGUIElement* pContainerPane;
CGUIStaticImage* pFlag;
CVector2D vecFlagInitialPos;
CVector2D vecFlagInitialSize;
CGUILabel* pLabel;
CVector2D vecLabelInitialPos;
CVector2D vecLabelInitialSize;
};

class CLanguageSelector
{
public:
ZERO_ON_NEW
CLanguageSelector(CGUIElement* pMainMenuCanvas);
~CLanguageSelector(void);
void DoPulse(void);

protected:
void CreateGUI(CGUIElement* pMainMenuCanvas);
CLangListItem CreateGUILangItem(CGUIElement* pGUIParent, const CVector2D& vecPanePosition, const SString& strLocale = "");
void SetLanguageListVisible(bool bVisible);
SString GetFlagFilename(SString strLocale = "");
CLangListItem* GetListItemByIndex(uint uiIndex);
bool OnButtonEnter(CGUIElement* pElement);
bool OnButtonLeave(CGUIElement* pElement);
bool OnButtonClick(CGUIElement* pElement);
bool OnListItemEnter(CGUIElement* pElement);
bool OnListItemLeave(CGUIElement* pElement);
bool OnListItemClick(CGUIElement* pElement);
bool OnListDeactivate(CGUIElement* pElement);

CGUIScrollPane* m_pButtonWindow;
CGUIWindow* m_pListWindow;
CLangListItem m_ButtonItem;
std::vector<CLangListItem> m_ListItems;
CTickCount m_LastTickCount;
bool m_bMouseOverButton;
bool m_bListWasVisible;
};
@@ -12,6 +12,7 @@
#include "StdInc.h"
#include <game/CGame.h>
#include "CNewsBrowser.h"
#include "CLanguageSelector.h"

#define NATIVE_RES_X 1280.0f
#define NATIVE_RES_Y 1024.0f
@@ -281,6 +282,7 @@ CMainMenu::CMainMenu(CGUI* pManager)
m_Settings.SetVisible(false);
m_Credits.SetVisible(false);
m_pNewsBrowser->SetVisible(false);
m_pLanguageSelector = new CLanguageSelector(m_pCanvas);

// We're not ingame
SetIsIngame(false);
@@ -348,6 +350,7 @@ CMainMenu::~CMainMenu(void)

delete m_pDisconnect->image;
delete m_pDisconnect;
delete m_pLanguageSelector;
}

void CMainMenu::SetMenuVerticalPosition(int iPosY)
@@ -652,6 +655,7 @@ void CMainMenu::Update(void)
// Call subdialog pulses
m_ServerBrowser.Update();
m_ServerInfo.DoPulse();
m_pLanguageSelector->DoPulse();
}

void CMainMenu::Show(bool bOverlay)
@@ -22,6 +22,7 @@ class CMainMenu;
#include "CCredits.h"
#include <Graphics/CGraphics.h>
class CNewsBrowser;
class CLanguageSelector;

#define CORE_MTA_NEWS_ITEMS 3

@@ -117,13 +118,14 @@ class CMainMenu
bool m_bMouseOverMenu;

// Submenu classes
CQuestionBox m_QuestionBox;
CQuickConnect m_QuickConnect;
CSettings m_Settings;
CNewsBrowser* m_pNewsBrowser;
CCredits m_Credits;
CServerBrowser m_ServerBrowser;
CServerInfo m_ServerInfo;
CQuestionBox m_QuestionBox;
CQuickConnect m_QuickConnect;
CSettings m_Settings;
CNewsBrowser* m_pNewsBrowser;
CCredits m_Credits;
CServerBrowser m_ServerBrowser;
CServerInfo m_ServerInfo;
CLanguageSelector* m_pLanguageSelector;

// Properties
bool m_bIsIngame;
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.

0 comments on commit 6f6b2ed

Please sign in to comment.
You can’t perform that action at this time.