aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui.h
blob: eee1d4f50ad18ad40d225231ca63a16b8f0ba981 (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
#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
#define INVENTORY_SPRITE_SIZE 42

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 {
  Rectangle rect;
  bool visable;
  EntityItem 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, EntityItem item);
void updateInventory(Inventory* inventory);

#endif