-
Notifications
You must be signed in to change notification settings - Fork 2
/
view_pet_items.h
56 lines (45 loc) · 1.54 KB
/
view_pet_items.h
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
#ifndef VIEW_PET_ITEM
#define VIEW_PET_ITEM
extern struct mre_view_p view_pet_items;
#ifdef VIEWS_SETUP
#include "view_watch_due_main.h"
#include "macro_utils.h"
struct mre_view_p view_pet_items;
static void
view_func_pet_items(struct mre* mre) {
struct nk_context* ctx = &mre->ctx;
struct nk_panel layout;
struct nk_image image;
VMINT i;
nk_button_default(ctx);
if (nk_begin(ctx, &layout, "Items", nk_rect(0, 0, mre->width, mre->height), NK_WINDOW_NO_SCROLLBAR))
{
nk_layout_row_static(ctx, mre->height/4 + 30, mre->width/2, 2);
nk_button_default(ctx);
for (i = 0; i < PET_ITEMS_MAX; i++) {
VMINT item_id;
item_id = current_pet_state.items[i];
image = nk_sprite(sprite_ptr(&SPRITE_FOOD_PACKED, SPRITE_PACKED), 8, item_id);
image.xo = (mre->width/2 - ctx->style.button.padding.x*2 - image.w)/2;
image.yo = (mre->height/4 +30 - ctx->style.button.padding.y*2 - image.h)/2;
if (nk_button_image(ctx, image) == NK_TAPPED) {
// Can only feed when hungry & not already being fed
if (current_pet_state.hunger < PET_STAT_MAX
&& current_pet_state.fed_item == 0 && item_id != 0) {
current_pet_state.fed_item = item_id;
current_pet_state.items[i] = 0;
reset_feeding_particles = true;
nk_mre_set_view(ctx, &view_watch_due_main);
}
}
}
nk_layout_row_static(ctx, mre->height/2 - 60, mre->width, 1);
ctx->style.button.normal.data.color = btn_color_main;
if(nk_button_label(ctx, NK_TXT_PAD("BACK")) == NK_TAPPED) {
nk_mre_set_view(ctx, &view_watch_due_main);
}
nk_end(ctx);
}
}
#endif
#endif