-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathButtonImage.h
More file actions
53 lines (43 loc) · 1.39 KB
/
Copy pathButtonImage.h
File metadata and controls
53 lines (43 loc) · 1.39 KB
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
#pragma once
#include "common_header.h"
#include "ImageManager.h"
namespace pyrodactyl
{
struct ButtonImage
{
ImageKey normal, select, hover;
bool operator== (const ButtonImage &img){ return normal == img.normal && select == img.select && hover == img.hover; }
ButtonImage() { normal = 0; select = 0; hover = 0; }
void Load(rapidxml::xml_node<char> *node, const bool &echo = true)
{
if (NodeValid(node))
{
LoadImgKey(normal, "img_b", node, echo);
LoadImgKey(select, "img_s", node, echo);
LoadImgKey(hover, "img_h", node, echo);
}
}
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root)
{
root->append_attribute(doc.allocate_attribute("img_b", gStrPool.Get(normal)));
root->append_attribute(doc.allocate_attribute("img_s", gStrPool.Get(select)));
root->append_attribute(doc.allocate_attribute("img_h", gStrPool.Get(hover)));
}
};
//State buttons require two image sets
struct StateButtonImage
{
ButtonImage normal, select;
StateButtonImage() {}
StateButtonImage(rapidxml::xml_node<char> *node, const bool &echo = true) { Load(node, echo); }
void Load(rapidxml::xml_node<char> *node, const bool &echo = true)
{
if (NodeValid("normal", node, echo))
normal.Load(node->first_node("normal"), echo);
if (NodeValid("select", node, false))
select.Load(node->first_node("select"), echo);
else
select = normal;
}
};
}