1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef MUTATIONOFJB_GUI_H
24 #define MUTATIONOFJB_GUI_H
25 
26 #include "mutationofjb/inventory.h"
27 #include "mutationofjb/script.h"
28 #include "mutationofjb/guiscreen.h"
29 #include "mutationofjb/widgets/buttonwidget.h"
30 #include "mutationofjb/widgets/inventorywidget.h"
31 #include "mutationofjb/widgets/gamewidget.h"
32 
33 #include "common/array.h"
34 #include "common/hashmap.h"
35 #include "common/hash-str.h"
36 
37 #include "graphics/surface.h"
38 
39 namespace Common {
40 struct Event;
41 }
42 
43 namespace Graphics {
44 class Screen;
45 }
46 
47 namespace MutationOfJB {
48 
49 class Game;
50 class Widget;
51 class InventoryWidget;
52 class ConversationWidget;
53 class LabelWidget;
54 class GameWidget;
55 
56 class GameScreen : public GuiScreen, public InventoryObserver, public ButtonWidgetCallback, public InventoryWidgetCallback, public GameWidgetCallback {
57 public:
58 	friend class InventoryAnimationDecoderCallback;
59 	friend class HudAnimationDecoderCallback;
60 
61 	GameScreen(Game &game, Graphics::Screen *screen);
62 	~GameScreen() override;
63 
64 	bool init();
65 
66 	void handleEvent(const Common::Event &event) override;
67 
68 	void onInventoryChanged() override;
69 	void onButtonClicked(ButtonWidget *) override;
70 	void onInventoryItemHovered(InventoryWidget *widget, int posInWidget) override;
71 	void onInventoryItemClicked(InventoryWidget *widget, int posInWidget) override;
72 	void onGameDoorClicked(GameWidget *, Door *door) override;
73 	void onGameStaticClicked(GameWidget *, Static *stat) override;
74 	void onGameEntityHovered(GameWidget *, const Common::String &entity) override;
75 
76 	ConversationWidget &getConversationWidget();
77 
78 	void showConversationWidget(bool show);
79 	void refreshAfterSceneChanged();
80 
81 private:
82 	bool loadInventoryGfx();
83 	bool loadHudGfx();
84 	void drawInventoryItem(const Common::String &item, int pos);
85 	void drawInventory();
86 
87 	void updateStatusBarText(const Common::String &entity, bool inventory);
88 
89 	Common::Array<Graphics::Surface> _inventorySurfaces;
90 	Common::Array<Graphics::Surface> _hudSurfaces;
91 
92 	Common::Array<ButtonWidget *> _buttons;
93 	InventoryWidget *_inventoryWidget;
94 	ConversationWidget *_conversationWidget;
95 	LabelWidget *_statusBarWidget;
96 	GameWidget *_gameWidget;
97 
98 	ActionInfo::Action _currentAction;
99 	Common::String _currentPickedItem;
100 };
101 
102 }
103 
104 #endif
105