blob: b5089a3f5c5178240002b3eff27ef5633e5201be (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#include "utils.h"
#include "entity.h"
#include "assets.h"
#include "world.h"
#ifndef UI_H
#define UI_H
#define INTERACTION_COLUMN_MAX 80
#define INVENTORY_MAX 10
typedef char InteractionItems[INTERACTION_MENU_MAX][INTERACTION_LABEL_MAX];
typedef struct {
char text[INTERACTION_CHAT_MAX];
char displayedText[INTERACTION_CHAT_MAX];
size_t textSize;
int displayUpTo; // Used for cool animation.
double lastCharacterUpdate;
Rectangle rect;
bool visible;
EntityId entityId;
} InteractionChat;
typedef struct {
InteractionItems items;
int itemCount;
Rectangle rect;
bool visible;
EntityId entityId;
} InteractionMenu;
typedef struct {
EntityId id;
AssetId texture;
int count;
} InventoryItem;
typedef struct {
Rectangle rect;
bool visable;
InventoryItem items[INVENTORY_MAX];
int itemCount;
} Inventory;
// Interaction chat procedures.
void initInteractionChat(InteractionChat* chat, const Settings* settings);
void showInteractionChat(InteractionChat* chat);
void hideInteractionChat(InteractionChat* chat);
void setInteractionChat(InteractionChat* chat, const char* text);
void writeToInteractionChat(InteractionChat* chat, const char* text);
void clearInteractionChat(InteractionChat* chat);
bool isInteractionChatAnimationDone(InteractionChat* chat);
void endInteractionChatAnimation(InteractionChat* chat);
void updateInteractionChat(InteractionChat* chat, Game* game);
// Interaction menu procedures.
void initInteractionMenu(InteractionMenu* menu, const Settings* settings);
void setInteractionMenu(InteractionMenu* menu,
const InteractionItems items,
int itemCount);
void resetInteractionMenu(InteractionMenu* menu);
void showInteractionMenu(InteractionMenu* menu);
void hideInteractionMenu(InteractionMenu* menu);
void updateInteractionMenu(InteractionMenu* menu, Game* game);
// Inventory
void initInventory(Inventory* inventory);
void showInventory(Inventory* inventory);
void hideInventory(Inventory* inventory);
void addItemToInventory(Inventory* inventory, InventoryItem item);
void updateInventory(Inventory* inventory);
#endif
|