World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
UIInventory.cpp
См. документацию.
1 #include "GUI/UI/UIInventory.h"
2 
3 #include "Engine/Localization.h"
4 
7 
8 #include "Engine/Objects/Actor.h"
9 
10 #include "GUI/GUIFont.h"
11 #include "GUI/GUIButton.h"
12 #include "GUI/UI/UIStatusBar.h"
13 
14 #include "IO/Keyboard.h"
15 #include "IO/Mouse.h"
16 
18  DrawMessageBox(0);
19  DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0);
21  if (!pKeyActionMap->field_204) {
22  ItemGen ItemGen2;
23  ItemGen2.Reset();
24  Release();
28  int v39 = atoi(pKeyActionMap->pPressedKeysBuffer);
29  if (v39 > 0 && v39 < 800) {
30  SpawnActor(v39);
31  }
32  }
33 }
34 
35 // GUIWindow_Inventory_CastSpell
36 
37 GUIWindow_Inventory_CastSpell::GUIWindow_Inventory_CastSpell(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const String &hint) :
39  mouse->SetCursorImage("MICON2");
40  pBtn_ExitCancel = CreateButton(392, 318, 75, 33, 1, 0, UIMSG_Escape, 0, 0, localization->GetString(34), // Cancel
41  { { ui_buttdesc2 } });
42  GameUI_StatusBar_OnEvent(localization->GetString(39), 2); // Choose target
45 }
46 
48  render->ClearZBuffer(0, 479);
49  draw_leather();
52  render->DrawTextureAlphaNew(pBtn_ExitCancel->uX / 640.0f, pBtn_ExitCancel->uY / 480.0f, dialogue_ui_x_x_u);
53 }
GUIWindow::DrawText
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)
Definition: GUIWindow.cpp:694
Localization::GetString
const char * GetString(unsigned int index) const
Definition: Localization.cpp:13
UIInventory.h
UIMSG_Escape
@ UIMSG_Escape
Definition: GUIWindow.h:96
Viewport.h
GUIWindow
Definition: GUIWindow.h:433
Timer::Resume
void Resume()
Definition: Time.cpp:27
SpawnActor
bool SpawnActor(unsigned int uMonsterID)
Definition: Actor.cpp:4922
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
height
EGLSurface EGLint EGLint EGLint EGLint height
Definition: SDL_egl.h:1596
CURRENT_SCREEN::SCREEN_CASTING
@ SCREEN_CASTING
WINDOW_CastSpell_InInventory
@ WINDOW_CastSpell_InInventory
Definition: GUIWindow.h:313
localization
Localization * localization
Definition: Localization.cpp:11
dialogue_ui_x_x_u
Image * dialogue_ui_x_x_u
Definition: GUIWindow.cpp:92
GUIWindow::Release
virtual void Release()
Definition: GUIWindow.cpp:292
GUIFont.h
CharacterUI_DrawPaperdoll
void CharacterUI_DrawPaperdoll(Player *player)
Definition: UICharacter.cpp:930
ItemGen::Reset
void Reset()
Definition: Items.cpp:133
pPlayers
NZIArray< struct Player *, 5 > pPlayers
Definition: Player.cpp:46
current_screen_type
enum CURRENT_SCREEN current_screen_type
Definition: GUIWindow.cpp:83
CharacterUI_InventoryTab_Draw
void CharacterUI_InventoryTab_Draw(Player *player, bool a2)
Definition: UICharacter.cpp:1829
Actor.h
current_character_screen_window
enum WindowType current_character_screen_window
Definition: GUIWindow.cpp:78
Localization.h
y
EGLSurface EGLint EGLint y
Definition: SDL_egl.h:1596
GUIWindow_Inventory_CastSpell::GUIWindow_Inventory_CastSpell
GUIWindow_Inventory_CastSpell(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const String &hint=String())
Definition: UIInventory.cpp:37
GUIButton.h
pBtn_ExitCancel
GUIButton * pBtn_ExitCancel
Definition: GUIButton.cpp:28
IRender.h
x
EGLSurface EGLint x
Definition: SDL_egl.h:1596
WINDOW_CharacterWindow_Inventory
@ WINDOW_CharacterWindow_Inventory
Definition: GUIWindow.h:330
viewparams
struct ViewingParams * viewparams
Definition: mm7_data.cpp:22
GUIWindow::DrawMessageBox
void DrawMessageBox(bool inside_game_viewport)
Definition: GUIWindow.cpp:319
KeyboardActionMapping::pPressedKeysBuffer
char pPressedKeysBuffer[257]
Definition: Keyboard.h:66
width
EGLSurface EGLint EGLint EGLint width
Definition: SDL_egl.h:1596
KeyboardActionMapping::field_204
int field_204
Definition: Keyboard.h:70
GUIButton::uX
unsigned int uX
Definition: GUIButton.h:21
GUIWindow_Inventory_CastSpell::Update
virtual void Update()
Definition: UIInventory.cpp:47
CURRENT_SCREEN::SCREEN_GAME
@ SCREEN_GAME
draw_leather
void draw_leather()
Definition: UICharacter.cpp:925
UIStatusBar.h
pKeyActionMap
struct KeyboardActionMapping * pKeyActionMap
Definition: Keyboard.cpp:35
GUIWindow::mouse
Mouse * mouse
Definition: GUIWindow.h:491
uActiveCharacter
unsigned int uActiveCharacter
Definition: mm7_data.cpp:555
GUIButton::uY
unsigned int uY
Definition: GUIButton.h:22
GameUI_StatusBar_OnEvent
void GameUI_StatusBar_OnEvent(const String &str, unsigned int num_seconds)
Definition: UIStatusBar.cpp:33
ViewingParams::bRedrawGameUI
int bRedrawGameUI
Definition: Viewport.h:74
Mouse::SetCursorImage
void SetCursorImage(const String &name)
Definition: Mouse.cpp:38
GUIWindow_Inventory::Update
virtual void Update()
Definition: UIInventory.cpp:17
ItemGen
Definition: Items.h:263
pFontLucida
GUIFont * pFontLucida
Definition: GUIFont.cpp:19
String
std::string String
Definition: Strings.h:10
Keyboard.h
pEventTimer
Timer * pEventTimer
Definition: Time.cpp:8
Mouse.h
render
std::shared_ptr< IRender > render
Definition: RenderOpenGL.cpp:52