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

#include <GUIProgressBar.h>

+ Граф связей класса GUIProgressBar:

Открытые типы

enum  Type { TYPE_None = 0, TYPE_Fullscreen = 1, TYPE_Box = 2 }
 

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

 GUIProgressBar ()
 
bool Initialize (Type type)
 
void Reset (uint8_t uMaxProgress)
 
void Progress ()
 
void Release ()
 
void Draw ()
 

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

int uX
 
int uY
 
int uWidth
 
int uHeight
 
uint8_t uProgressMax
 
uint8_t uProgressCurrent
 
Type uType
 
Imageprogressbar_dungeon
 
Imageprogressbar_loading
 
Imageloading_bg
 

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

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

Перечисления

◆ Type

Элементы перечислений
TYPE_None 
TYPE_Fullscreen 
TYPE_Box 

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

9  {
10  TYPE_None = 0,
11  TYPE_Fullscreen = 1,
12  TYPE_Box = 2
13  };

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

◆ GUIProgressBar()

GUIProgressBar::GUIProgressBar ( )

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

16  {
17  progressbar_dungeon = nullptr;
18  progressbar_loading = nullptr;
19  loading_bg = nullptr;
20 }

Перекрестные ссылки loading_bg, progressbar_dungeon и progressbar_loading.

Методы

◆ Initialize()

bool GUIProgressBar::Initialize ( Type  type)

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

22  {
23  Release();
24 
25  switch (type) {
26  case TYPE_None:
27  return true;
28 
29  case TYPE_Box:
30  case TYPE_Fullscreen:
31  break;
32 
33  default:
34  Error("Invalid GUIProgressBar type: %u", type);
35  }
36 
37  if (loading_bg) {
38  return false;
39  }
40 
41  uType = type;
42 
43  if (uType == TYPE_Fullscreen) {
44  loading_bg = assets->GetImage_PCXFromIconsLOD(StringPrintf("loading%d.pcx", rand() % 5 + 1));
45 
46  uProgressCurrent = 0;
47  uX = 122;
48  uY = 151;
49  uWidth = 449;
50  uHeight = 56;
51  uProgressMax = 26;
52 
54  Draw();
55  return true;
56  } else {
57  switch (pParty->alignment) {
59  progressbar_dungeon = assets->GetImage_ColorKey("bardata-b", 0x7FF);
60  break;
62  progressbar_dungeon = assets->GetImage_ColorKey("bardata", 0x7FF);
63  break;
65  progressbar_dungeon = assets->GetImage_ColorKey("bardata-c", 0x7FF);
66  break;
67  default:
68  Error("Invalid alignment type: %u", pParty->alignment);
69  }
70  }
71 
72  uProgressCurrent = 0;
73  uProgressMax = 26;
74  Draw();
75  return true;
76 }

Перекрестные ссылки Party::alignment, assets, Draw(), AssetsManager::GetImage_Alpha(), AssetsManager::GetImage_ColorKey(), AssetsManager::GetImage_PCXFromIconsLOD(), loading_bg, PartyAlignment_Evil, PartyAlignment_Good, PartyAlignment_Neutral, pParty, progressbar_dungeon, progressbar_loading, Release(), StringPrintf(), TYPE_Box, TYPE_Fullscreen, TYPE_None, uHeight, uProgressCurrent, uProgressMax, uType, uWidth, uX и uY.

Используется в DoPrepareWorld(), Application::Game::EventLoop(), EventProcessor() и TeleportToNWCDungeon().

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

◆ Reset()

void GUIProgressBar::Reset ( uint8_t  uMaxProgress)

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

78  {
79  uProgressCurrent = 0;
80  uProgressMax = uMaxProgress;
81 }

Перекрестные ссылки uProgressCurrent и uProgressMax.

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

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

◆ Progress()

void GUIProgressBar::Progress ( )

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

83  {
85  Draw();
86 }

Перекрестные ссылки Draw(), uProgressCurrent и uProgressMax.

Используется в Engine::_461103_load_level_sub(), OutdoorLocation::ArrangeSpriteObjects(), DoPrepareWorld(), Application::Game::EventLoop(), OutdoorLocation::InitalizeActors(), OutdoorLocation::Load(), IndoorLocation::Load(), OutdoorLocation::PrepareDecorations() и PrepareToLoadBLV().

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

◆ Release()

void GUIProgressBar::Release ( )

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

88  {
89  if (loading_bg != nullptr) {
91  loading_bg = nullptr;
92  }
93 
94  if (progressbar_loading != nullptr) {
96  progressbar_loading = nullptr;
97  }
98 
99  if (progressbar_dungeon != nullptr) {
101  progressbar_dungeon = nullptr;
102  }
103 }

Перекрестные ссылки loading_bg, progressbar_dungeon, progressbar_loading и Image::Release().

Используется в DoPrepareWorld(), Application::Game::EventLoop() и Initialize().

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

◆ Draw()

void GUIProgressBar::Draw ( )

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

105  {
106  render->BeginScene();
107 
108  if (uType != TYPE_Fullscreen) {
109  render->DrawTextureAlphaNew(80 / 640.0f, 122 / 480.0f, progressbar_dungeon);
110  render->DrawTextureAlphaNew(100 / 640.0f, 146 / 480.0f, pIconsFrameTable->GetFrame(uIconID_TurnHour, 0)->GetTexture());
111  render->FillRectFast(174, 164, floorf(((double)(113 * uProgressCurrent) / (double)uProgressMax) + 0.5f), 16, 0xF800);
112  } else {
113  if (loading_bg) {
114  render->DrawTextureNew(0, 0, loading_bg);
115  }
116  render->SetUIClipRect(172, 459, (int)((double)(300 * uProgressCurrent) / (double)uProgressMax) + 172, 471);
117  render->DrawTextureAlphaNew(172 / 640.0f, 459 / 480.0f, progressbar_loading);
118  render->ResetUIClipRect();
119  }
120 
121  render->EndScene();
122  render->Present();
123 }

Перекрестные ссылки IconFrameTable::GetFrame(), Icon::GetTexture(), loading_bg, pIconsFrameTable, progressbar_dungeon, progressbar_loading, render, TYPE_Fullscreen, uIconID_TurnHour, uProgressCurrent, uProgressMax и uType.

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

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

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

◆ uX

int GUIProgressBar::uX
protected

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

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

◆ uY

int GUIProgressBar::uY
protected

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

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

◆ uWidth

int GUIProgressBar::uWidth
protected

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

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

◆ uHeight

int GUIProgressBar::uHeight
protected

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

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

◆ uProgressMax

uint8_t GUIProgressBar::uProgressMax
protected

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

Используется в Draw(), Initialize(), Progress() и Reset().

◆ uProgressCurrent

uint8_t GUIProgressBar::uProgressCurrent
protected

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

Используется в Draw(), Initialize(), Progress() и Reset().

◆ uType

Type GUIProgressBar::uType
protected

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

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

◆ progressbar_dungeon

Image* GUIProgressBar::progressbar_dungeon
protected

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

Используется в Draw(), GUIProgressBar(), Initialize() и Release().

◆ progressbar_loading

Image* GUIProgressBar::progressbar_loading
protected

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

Используется в Draw(), GUIProgressBar(), Initialize() и Release().

◆ loading_bg

Image* GUIProgressBar::loading_bg
protected

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

Используется в Draw(), GUIProgressBar(), Initialize() и Release().


Объявления и описания членов классов находятся в файлах:
GUIProgressBar::progressbar_dungeon
Image * progressbar_dungeon
Definition: GUIProgressBar.h:34
PartyAlignment::PartyAlignment_Good
@ PartyAlignment_Good
PartyAlignment::PartyAlignment_Neutral
@ PartyAlignment_Neutral
GUIProgressBar::TYPE_Fullscreen
@ TYPE_Fullscreen
Definition: GUIProgressBar.h:11
pIconsFrameTable
struct IconFrameTable * pIconsFrameTable
Definition: mm7_data.cpp:168
PartyAlignment::PartyAlignment_Evil
@ PartyAlignment_Evil
GUIProgressBar::uType
Type uType
Definition: GUIProgressBar.h:32
AssetsManager::GetImage_PCXFromIconsLOD
Texture * GetImage_PCXFromIconsLOD(const String &name)
Definition: AssetsManager.cpp:81
GUIProgressBar::uHeight
int uHeight
Definition: GUIProgressBar.h:28
Icon::GetTexture
Texture * GetTexture()
Definition: IconFrameTable.cpp:9
pParty
Party * pParty
Definition: Party.cpp:30
GUIProgressBar::TYPE_Box
@ TYPE_Box
Definition: GUIProgressBar.h:12
AssetsManager::GetImage_ColorKey
Texture * GetImage_ColorKey(const String &name, uint16_t colorkey)
Definition: AssetsManager.cpp:34
GUIProgressBar::uY
int uY
Definition: GUIProgressBar.h:26
f
GLfloat f
Definition: SDL_opengl_glext.h:1873
GUIProgressBar::uX
int uX
Definition: GUIProgressBar.h:25
type
EGLenum type
Definition: SDL_egl.h:850
GUIProgressBar::Draw
void Draw()
Definition: GUIProgressBar.cpp:105
GUIProgressBar::uProgressCurrent
uint8_t uProgressCurrent
Definition: GUIProgressBar.h:31
GUIProgressBar::TYPE_None
@ TYPE_None
Definition: GUIProgressBar.h:10
uIconID_TurnHour
unsigned int uIconID_TurnHour
Definition: mm7_data.cpp:572
IconFrameTable::GetFrame
Icon * GetFrame(unsigned int uIconID, unsigned int frame_time)
Definition: IconFrameTable.cpp:39
GUIProgressBar::uProgressMax
uint8_t uProgressMax
Definition: GUIProgressBar.h:30
uint8_t
unsigned __int8 uint8_t
Definition: SDL_config.h:35
GUIProgressBar::Release
void Release()
Definition: GUIProgressBar.cpp:88
assets
AssetsManager * assets
Definition: AssetsManager.cpp:12
AssetsManager::GetImage_Alpha
Texture * GetImage_Alpha(const String &name)
Definition: AssetsManager.cpp:66
GUIProgressBar::uWidth
int uWidth
Definition: GUIProgressBar.h:27
StringPrintf
String StringPrintf(const char *fmt,...)
Definition: Strings.cpp:9
GUIProgressBar::progressbar_loading
Image * progressbar_loading
Definition: GUIProgressBar.h:35
GUIProgressBar::loading_bg
Image * loading_bg
Definition: GUIProgressBar.h:37
Image::Release
bool Release()
Definition: Image.cpp:335
Party::alignment
PartyAlignment alignment
Definition: Party.h:308
render
std::shared_ptr< IRender > render
Definition: RenderOpenGL.cpp:52