World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Класс GUIWindow_MainMenu

#include <UIMainMenu.h>

+ Граф наследования:GUIWindow_MainMenu:
+ Граф связей класса GUIWindow_MainMenu:

Открытые члены

 GUIWindow_MainMenu ()
 
virtual ~GUIWindow_MainMenu ()
 
virtual void Update ()
 
void EventLoop ()
 
- Открытые члены унаследованные от GUIWindow
 GUIWindow ()
 
 GUIWindow (WindowType windowType, unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, int pButton, const String &hint=String())
 
virtual ~GUIWindow ()
 
GUIButtonCreateButton (int x, int y, int width, int height, int a6, int a7, UIMessageType msg, unsigned int msg_param, uint8_t hotkey, const String &label, const std::vector< Image * > &textures=std::vector< Image * >())
 
bool Contains (unsigned int x, unsigned int y)
 
void DrawFlashingInputCursor (int uX, int uY, GUIFont *a2)
 
int DrawTextInRect (GUIFont *font, unsigned int x, unsigned int y, unsigned int color, const char *text, int rect_width, int reverse_text)
 
int DrawTextInRect (GUIFont *font, unsigned int x, unsigned int y, unsigned int color, String &str, int rect_width, int reverse_text)
 
void DrawText (GUIFont *font, int x, int y, unsigned short uFontColor, const char *str, bool present_time_transparency=false, int max_text_height=0, int uFontShadowColor=0)
 
void DrawText (GUIFont *font, int x, int y, unsigned short uFontColor, const String &str, bool present_time_transparency=false, int max_text_height=0, int uFontShadowColor=0)
 
void DrawTitleText (GUIFont *font, int horizontal_margin, int vertical_margin, unsigned __int16 uDefaultColor, const char *pInString, int line_spacing)
 
void DrawTitleText (GUIFont *font, int horizontal_margin, int vertical_margin, unsigned __int16 uDefaultColor, const String &str, int line_spacing)
 
void DrawShops_next_generation_time_string (GameTime time)
 
void HouseDialogManager ()
 
void DrawMessageBox (bool inside_game_viewport)
 
GUIButtonGetControl (unsigned int uID)
 
void _41D08F_set_keyboard_control_group (int num_buttons, int a3, int a4, int a5)
 
void _41D73D_draw_buff_tooltip ()
 
virtual void Release ()
 
void DeleteButtons ()
 

Открытые статические члены

static void Loop ()
 
- Открытые статические члены унаследованные от GUIWindow
static void InitializeGUI ()
 

Защищенные данные

GUIButtonpBtnExit
 
GUIButtonpBtnCredits
 
GUIButtonpBtnLoad
 
GUIButtonpBtnNew
 
Imagemain_menu_background
 
Imageui_mainmenu_new
 
Imageui_mainmenu_load
 
Imageui_mainmenu_credits
 
Imageui_mainmenu_exit
 

Дополнительные унаследованные члены

- Открытые атрибуты унаследованные от GUIWindow
unsigned int uFrameX
 
unsigned int uFrameY
 
unsigned int uFrameWidth
 
unsigned int uFrameHeight
 
unsigned int uFrameZ
 
unsigned int uFrameW
 
WindowType eWindowType
 
union {
   void *   ptr_1C
 
   unsigned int   par1C
 
}; 
 
int field_24
 
int pNumPresenceButton
 
int pCurrentPosActiveItem
 
int field_30
 
int field_34
 
int pStartingPosActiveItem
 
int receives_keyboard_input_2
 
bool receives_keyboard_input
 
String sHint
 
std::vector< GUIButton * > vButtons
 
Mousemouse = nullptr
 
Loglog = nullptr
 

Подробное описание

См. определение в файле UIMainMenu.h строка 5

Конструктор(ы)

◆ GUIWindow_MainMenu()

GUIWindow_MainMenu::GUIWindow_MainMenu ( )

См. определение в файле UIMainMenu.cpp строка 20

20  :
21  GUIWindow(WINDOW_MainMenu, 0, 0, window->GetWidth(), window->GetHeight(), 0) {
23 
24  ui_mainmenu_new = assets->GetImage_ColorKey("title_new", 0x7FF);
25  ui_mainmenu_load = assets->GetImage_ColorKey("title_load", 0x7FF);
26  ui_mainmenu_credits = assets->GetImage_ColorKey("title_cred", 0x7FF);
27  ui_mainmenu_exit = assets->GetImage_ColorKey("title_exit", 0x7FF);
28 
30  1, 0, UIMSG_MainMenu_ShowPartyCreationWnd, 0, 'N', "", { { ui_mainmenu_new } });
32  1, 0, UIMSG_MainMenu_ShowLoadWindow, 1, 'L', "", { { ui_mainmenu_load } });
34  1, 0, UIMSG_ShowCredits, 2, 'C', "", { { ui_mainmenu_credits } });
36  1, 0, UIMSG_ExitToWindows, 3, 0, "", { { ui_mainmenu_exit } });
37 }

Перекрестные ссылки assets, GUIWindow::CreateButton(), Image::GetHeight(), AssetsManager::GetImage_ColorKey(), AssetsManager::GetImage_PCXFromIconsLOD(), Image::GetWidth(), main_menu_background, pBtnNew, ui_mainmenu_credits, ui_mainmenu_exit, ui_mainmenu_load, ui_mainmenu_new и UIMSG_MainMenu_ShowPartyCreationWnd.

Используется в Loop().

+ Граф вызовов:
+ Граф вызова функции:

◆ ~GUIWindow_MainMenu()

GUIWindow_MainMenu::~GUIWindow_MainMenu ( )
virtual

См. определение в файле UIMainMenu.cpp строка 39

Перекрестные ссылки main_menu_background, Image::Release(), ui_mainmenu_credits, ui_mainmenu_exit, ui_mainmenu_load и ui_mainmenu_new.

+ Граф вызовов:

Методы

◆ Update()

void GUIWindow_MainMenu::Update ( )
virtual

Переопределяет метод предка GUIWindow.

См. определение в файле UIMainMenu.cpp строка 47

47  {
48  render->DrawTextureNew(0, 0, main_menu_background);
49 
50  Point pt = mouse->GetCursorPos();
51  GUIWindow *pWindow = this;
52 
53  Image *pTexture = nullptr;
54  if (!pModalWindow) { // ???
55  for (GUIButton *pButton : pWindow->vButtons) {
56  if (pButton->Contains(pt.x, pt.y) && pWindow == pWindow_MainMenu) {
57  auto pControlParam = pButton->msg_param;
58  int pY = 0;
59  switch (pControlParam) { // backlight for buttons
60  case 0:
61  pTexture = assets->GetImage_ColorKey("title_new", 0x7FF);
62  pY = 172;
63  break;
64  case 1:
65  pTexture = assets->GetImage_ColorKey("title_load", 0x7FF);
66  pY = 227;
67  break;
68  case 2:
69  pTexture = assets->GetImage_ColorKey("title_cred", 0x7FF);
70  pY = 282;
71  break;
72  case 3:
73  pTexture = assets->GetImage_ColorKey("title_exit", 0x7FF);
74  pY = 337;
75  break;
76  }
77  render->DrawTextureAlphaNew(495 / 640.0f, pY / 480.0f, pTexture);
78  }
79  }
80  }
81 }

Перекрестные ссылки assets, GUIButton::Contains(), Mouse::GetCursorPos(), AssetsManager::GetImage_ColorKey(), main_menu_background, GUIWindow::mouse, GUIButton::msg_param, pModalWindow, pWindow_MainMenu, render, GUIWindow::vButtons, Point::x и Point::y.

+ Граф вызовов:

◆ Loop()

void GUIWindow_MainMenu::Loop ( )
static

См. определение в файле UIMainMenu.cpp строка 118

118  {
119  pAudioPlayer->StopChannels(-1, -1);
121 
122  if (first_initialization) {
123  first_initialization = false;
124 
125  Image *tex = assets->GetImage_PCXFromIconsLOD("mm6title.pcx");
126 
127  render->ResetUIClipRect();
128  render->BeginScene();
129  {
130  render->DrawTextureNew(0, 0, tex);
132  }
133  render->EndScene();
134  render->Present();
135 
136  engine->SecondaryInitialization();
138 
139  tex->Release();
140  }
141 
143 
144  pGUIWindow2 = nullptr;
145 
147 
149  // window->Activate();
150 
151  while (GetCurrentMenuID() == MENU_MAIN) {
152  window->PeekMessageLoop();
153  if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE) {
154  OS_WaitMessage();
155  continue;
156  }
157 
158  render->BeginScene();
159  {
162  }
163  render->EndScene();
164  render->Present();
165  }
166 
168  delete pWindow_MainMenu;
169  pWindow_MainMenu = nullptr;
170 }

Перекрестные ссылки assets, current_screen_type, DrawMM7CopyrightWindow(), dword_6BE364_game_settings_1, engine, EventLoop(), FinalInitialization(), first_initialization, GetCurrentMenuID(), AssetsManager::GetImage_PCXFromIconsLOD(), GUI_UpdateWindows(), GUIWindow_MainMenu(), MENU_MAIN, MUSIC_MainMenu, AudioPlayer::MusicPlayTrack(), OS_WaitMessage(), pAudioPlayer, pGUIWindow2, pWindow_MainMenu, Image::Release(), GUIWindow::Release(), render, SCREEN_GAME, SetCurrentMenuID() и AudioPlayer::StopChannels().

Используется в Application::Game::Run().

+ Граф вызовов:
+ Граф вызова функции:

◆ EventLoop()

void GUIWindow_MainMenu::EventLoop ( )

См. определение в файле UIMainMenu.cpp строка 83

83  {
84  while (!pMessageQueue_50CBD0->Empty()) {
85  UIMessageType pUIMessageType;
86  int pParam;
87  int param2;
88  pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &pParam, &param2);
89 
90  switch (pUIMessageType) { // For buttons of window MainMenu
92  new OnButtonClick2(495, 172, 0, 0, (int)pBtnNew);
94  break;
96  new OnButtonClick2(495, 227, 0, 0, (int)pBtnLoad);
98  break;
99  case UIMSG_ShowCredits:
100  new OnButtonClick2(495, 282, 0, 0, (int)pBtnCredits);
102  break;
103  case UIMSG_ExitToWindows:
104  new OnButtonClick2(495, 337, 0, 0, (int)pBtnExit);
106  break;
109  break;
110  default:
111  break;
112  }
113  }
114 }

Перекрестные ссылки GUIMessageQueue::Empty(), GAME_FINISHED, MENU_CREDITS, MENU_EXIT_GAME, MENU_NEWGAME, MENU_SAVELOAD, pBtnCredits, pBtnExit, pBtnLoad, pBtnNew, pMessageQueue_50CBD0, GUIMessageQueue::PopMessage(), SetCurrentMenuID(), uGameState, UIMSG_ChangeGameState, UIMSG_ExitToWindows, UIMSG_MainMenu_ShowLoadWindow, UIMSG_MainMenu_ShowPartyCreationWnd и UIMSG_ShowCredits.

Используется в Loop().

+ Граф вызовов:
+ Граф вызова функции:

Данные класса

◆ pBtnExit

GUIButton* GUIWindow_MainMenu::pBtnExit
protected

См. определение в файле UIMainMenu.h строка 16

Используется в EventLoop().

◆ pBtnCredits

GUIButton* GUIWindow_MainMenu::pBtnCredits
protected

См. определение в файле UIMainMenu.h строка 17

Используется в EventLoop().

◆ pBtnLoad

GUIButton* GUIWindow_MainMenu::pBtnLoad
protected

См. определение в файле UIMainMenu.h строка 18

Используется в EventLoop().

◆ pBtnNew

GUIButton* GUIWindow_MainMenu::pBtnNew
protected

См. определение в файле UIMainMenu.h строка 19

Используется в EventLoop() и GUIWindow_MainMenu().

◆ main_menu_background

Image* GUIWindow_MainMenu::main_menu_background
protected

См. определение в файле UIMainMenu.h строка 21

Используется в GUIWindow_MainMenu(), Update() и ~GUIWindow_MainMenu().

◆ ui_mainmenu_new

Image* GUIWindow_MainMenu::ui_mainmenu_new
protected

См. определение в файле UIMainMenu.h строка 23

Используется в GUIWindow_MainMenu() и ~GUIWindow_MainMenu().

◆ ui_mainmenu_load

Image* GUIWindow_MainMenu::ui_mainmenu_load
protected

См. определение в файле UIMainMenu.h строка 24

Используется в GUIWindow_MainMenu() и ~GUIWindow_MainMenu().

◆ ui_mainmenu_credits

Image* GUIWindow_MainMenu::ui_mainmenu_credits
protected

См. определение в файле UIMainMenu.h строка 25

Используется в GUIWindow_MainMenu() и ~GUIWindow_MainMenu().

◆ ui_mainmenu_exit

Image* GUIWindow_MainMenu::ui_mainmenu_exit
protected

См. определение в файле UIMainMenu.h строка 26

Используется в GUIWindow_MainMenu() и ~GUIWindow_MainMenu().


Объявления и описания членов классов находятся в файлах:
MENU_SAVELOAD
@ MENU_SAVELOAD
Definition: GUIWindow.h:254
pWindow_MainMenu
GUIWindow_MainMenu * pWindow_MainMenu
Definition: UIMainMenu.cpp:18
OnButtonClick2
Definition: GUIWindow.h:523
GUIWindow_MainMenu::GUIWindow_MainMenu
GUIWindow_MainMenu()
Definition: UIMainMenu.cpp:20
UIMessageType
UIMessageType
Definition: GUIWindow.h:13
GUIMessageQueue::Empty
bool Empty()
Definition: GUIWindow.h:659
GUIWindow_MainMenu::ui_mainmenu_exit
Image * ui_mainmenu_exit
Definition: UIMainMenu.h:26
Image::GetHeight
unsigned int GetHeight()
Definition: Image.cpp:230
FinalInitialization
void FinalInitialization()
Definition: Engine.cpp:852
Mouse::GetCursorPos
Point GetCursorPos()
Definition: Mouse.cpp:108
GUIWindow
Definition: GUIWindow.h:433
uGameState
unsigned int uGameState
Definition: mm7_data.cpp:695
GUIWindow_MainMenu::EventLoop
void EventLoop()
Definition: UIMainMenu.cpp:83
GUIWindow::CreateButton
GUIButton * CreateButton(int x, int y, int width, int height, int a6, int a7, UIMessageType msg, unsigned int msg_param, uint8_t hotkey, const String &label, const std::vector< Image * > &textures=std::vector< Image * >())
Definition: GUIWindow.cpp:717
SetCurrentMenuID
void SetCurrentMenuID(MENU_STATE uMenu)
Definition: GUIWindow.cpp:128
GAME_FINISHED
@ GAME_FINISHED
Definition: Engine.h:33
engine
std::shared_ptr< Engine > engine
Definition: Engine.cpp:130
GUIWindow::GUIWindow
GUIWindow()
Definition: GUIWindow.cpp:765
AudioPlayer::MusicPlayTrack
void MusicPlayTrack(enum MusicID eTrack)
Definition: AudioPlayer.cpp:109
Point::x
unsigned int x
Definition: Point.h:7
MENU_MAIN
@ MENU_MAIN
Definition: GUIWindow.h:251
UIMSG_ExitToWindows
@ UIMSG_ExitToWindows
Definition: GUIWindow.h:43
AssetsManager::GetImage_PCXFromIconsLOD
Texture * GetImage_PCXFromIconsLOD(const String &name)
Definition: AssetsManager.cpp:81
GUIWindow::Release
virtual void Release()
Definition: GUIWindow.cpp:292
DrawMM7CopyrightWindow
void DrawMM7CopyrightWindow()
Definition: UIMainMenu.cpp:172
GUIButton
Definition: GUIButton.h:11
current_screen_type
enum CURRENT_SCREEN current_screen_type
Definition: GUIWindow.cpp:83
GUIWindow::vButtons
std::vector< GUIButton * > vButtons
Definition: GUIWindow.h:489
GUIWindow_MainMenu::pBtnExit
GUIButton * pBtnExit
Definition: UIMainMenu.h:16
GetCurrentMenuID
MENU_STATE GetCurrentMenuID()
Definition: GUIWindow.cpp:133
GUIButton::Contains
bool Contains(unsigned int x, unsigned int y)
Definition: GUIButton.cpp:113
MENU_NEWGAME
@ MENU_NEWGAME
Definition: GUIWindow.h:252
MENU_EXIT_GAME
@ MENU_EXIT_GAME
Definition: GUIWindow.h:255
Image::GetWidth
unsigned int GetWidth()
Definition: Image.cpp:217
pGUIWindow2
GUIWindow * pGUIWindow2
Definition: GUIWindow.cpp:60
Image
Definition: Image.h:19
UIMSG_MainMenu_ShowLoadWindow
@ UIMSG_MainMenu_ShowLoadWindow
Definition: GUIWindow.h:41
MUSIC_MainMenu
@ MUSIC_MainMenu
Definition: AudioPlayer.h:109
UIMSG_ShowCredits
@ UIMSG_ShowCredits
Definition: GUIWindow.h:42
AssetsManager::GetImage_ColorKey
Texture * GetImage_ColorKey(const String &name, uint16_t colorkey)
Definition: AssetsManager.cpp:34
GUIWindow_MainMenu::ui_mainmenu_new
Image * ui_mainmenu_new
Definition: UIMainMenu.h:23
AudioPlayer::StopChannels
void StopChannels(int uStartChannel, int uEndChannel)
Definition: AudioPlayer.cpp:331
window
EGLSurface EGLNativeWindowType * window
Definition: SDL_egl.h:1580
f
GLfloat f
Definition: SDL_opengl_glext.h:1873
GUI_UpdateWindows
void GUI_UpdateWindows()
Definition: GUIWindow.cpp:956
UIMSG_MainMenu_ShowPartyCreationWnd
@ UIMSG_MainMenu_ShowPartyCreationWnd
Definition: GUIWindow.h:40
GUIWindow_MainMenu::ui_mainmenu_load
Image * ui_mainmenu_load
Definition: UIMainMenu.h:24
GUIMessageQueue::PopMessage
void PopMessage(UIMessageType *pMsg, int *pParam, int *a4)
Definition: GUIWindow.cpp:174
first_initialization
static bool first_initialization
Definition: UIMainMenu.cpp:116
GUIWindow_MainMenu::pBtnLoad
GUIButton * pBtnLoad
Definition: UIMainMenu.h:18
CURRENT_SCREEN::SCREEN_GAME
@ SCREEN_GAME
GUIWindow_MainMenu::pBtnNew
GUIButton * pBtnNew
Definition: UIMainMenu.h:19
GUIWindow_MainMenu::ui_mainmenu_credits
Image * ui_mainmenu_credits
Definition: UIMainMenu.h:25
Point::y
unsigned int y
Definition: Point.h:8
GUIButton::msg_param
unsigned int msg_param
Definition: GUIButton.h:30
WINDOW_MainMenu
@ WINDOW_MainMenu
Definition: GUIWindow.h:292
GUIWindow::mouse
Mouse * mouse
Definition: GUIWindow.h:491
MENU_CREDITS
@ MENU_CREDITS
Definition: GUIWindow.h:253
assets
AssetsManager * assets
Definition: AssetsManager.cpp:12
UIMSG_ChangeGameState
@ UIMSG_ChangeGameState
Definition: GUIWindow.h:16
dword_6BE364_game_settings_1
int dword_6BE364_game_settings_1
Definition: mm7_data.cpp:714
GUIWindow_MainMenu::pBtnCredits
GUIButton * pBtnCredits
Definition: UIMainMenu.h:17
pAudioPlayer
AudioPlayer * pAudioPlayer
Definition: AudioPlayer.cpp:20
pModalWindow
GUIWindow * pModalWindow
Definition: GUIWindow.cpp:57
Point
Definition: Point.h:3
pMessageQueue_50CBD0
struct GUIMessageQueue * pMessageQueue_50CBD0
Definition: GUIWindow.cpp:86
OS_WaitMessage
void OS_WaitMessage()
Definition: Lin.cpp:32
Image::Release
bool Release()
Definition: Image.cpp:335
GUIWindow_MainMenu::main_menu_background
Image * main_menu_background
Definition: UIMainMenu.h:21
render
std::shared_ptr< IRender > render
Definition: RenderOpenGL.cpp:52