|
|
|
@ -33,6 +33,37 @@ VkResult render_thread(GLFWwindow* window, RenderContext* render) {
|
|
|
|
|
|
|
|
|
|
VK_RESULT(load_font("test.ttf", 16, VK_TRUE, library, render, &ui, &font_index));
|
|
|
|
|
|
|
|
|
|
UIString context_strings[] = {
|
|
|
|
|
{
|
|
|
|
|
.pos = {0, 16},
|
|
|
|
|
.size = 16,
|
|
|
|
|
.color = {1.0, 1.0, 1.0, 1.0},
|
|
|
|
|
.offset = 0,
|
|
|
|
|
.length = strlen("Example"),
|
|
|
|
|
.font = font_index,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
uint32_t context_codes[100];
|
|
|
|
|
map_string("Example Text", context_codes, 0, ui.fonts[0].charmap, ui.fonts[0].num_symbols);
|
|
|
|
|
|
|
|
|
|
UILayerInput context_layers[] = {
|
|
|
|
|
{
|
|
|
|
|
.num_strings = 1,
|
|
|
|
|
.strings = context_strings,
|
|
|
|
|
.num_codes = 100,
|
|
|
|
|
.codes = context_codes,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
UIContainerInput context_info = {
|
|
|
|
|
.id = 0x01,
|
|
|
|
|
.anchor = ANCHOR_TOP_LEFT,
|
|
|
|
|
.size = {WINDOW_MIN_WIDTH, WINDOW_MIN_HEIGHT},
|
|
|
|
|
.layer_count = sizeof(context_layers)/sizeof(UILayerInput),
|
|
|
|
|
.layers = context_layers,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
vec2 map_size = {250, 200};
|
|
|
|
|
|
|
|
|
|
UIDrawable map_rects[] = {
|
|
|
|
@ -52,14 +83,14 @@ VkResult render_thread(GLFWwindow* window, RenderContext* render) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
UIContainerInput map_info = {
|
|
|
|
|
.id = 0x01,
|
|
|
|
|
.offset = {WINDOW_WIDTH-map_size[0], 0.0},
|
|
|
|
|
.id = 0x02,
|
|
|
|
|
.anchor = ANCHOR_TOP_RIGHT,
|
|
|
|
|
.size = {map_size[0], map_size[1]},
|
|
|
|
|
.layer_count = sizeof(map_layers)/sizeof(UILayerInput),
|
|
|
|
|
.layers = map_layers,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
vec2 inventory_size = {map_size[0], WINDOW_HEIGHT-map_size[1]};
|
|
|
|
|
vec2 inventory_size = {map_size[0], WINDOW_MIN_HEIGHT-map_size[1]};
|
|
|
|
|
|
|
|
|
|
UIDrawable inventory_rects[] = {
|
|
|
|
|
{
|
|
|
|
@ -78,14 +109,14 @@ VkResult render_thread(GLFWwindow* window, RenderContext* render) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
UIContainerInput inventory_info = {
|
|
|
|
|
.id = 0x02,
|
|
|
|
|
.offset = {WINDOW_WIDTH-inventory_size[0], WINDOW_HEIGHT-inventory_size[1]},
|
|
|
|
|
.id = 0x03,
|
|
|
|
|
.anchor = ANCHOR_BOTTOM_RIGHT,
|
|
|
|
|
.size = {inventory_size[0], inventory_size[1]},
|
|
|
|
|
.layer_count = sizeof(inventory_layers)/sizeof(UILayerInput),
|
|
|
|
|
.layers = inventory_layers,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
vec2 chat_size = {WINDOW_WIDTH-inventory_size[0], 200};
|
|
|
|
|
vec2 chat_size = {WINDOW_MIN_WIDTH-inventory_size[0], 200};
|
|
|
|
|
|
|
|
|
|
UIDrawable chat_rects[] = {
|
|
|
|
|
{
|
|
|
|
@ -104,13 +135,14 @@ VkResult render_thread(GLFWwindow* window, RenderContext* render) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
UIContainerInput chat_info = {
|
|
|
|
|
.id = 0x02,
|
|
|
|
|
.offset = {0, WINDOW_HEIGHT-chat_size[1]},
|
|
|
|
|
.id = 0x04,
|
|
|
|
|
.anchor = ANCHOR_BOTTOM_LEFT,
|
|
|
|
|
.size = {chat_size[0], chat_size[1]},
|
|
|
|
|
.layer_count = sizeof(chat_layers)/sizeof(UILayerInput),
|
|
|
|
|
.layers = chat_layers,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
VK_RESULT(create_container(&context_info, render, &ui));
|
|
|
|
|
VK_RESULT(create_container(&map_info, render, &ui));
|
|
|
|
|
VK_RESULT(create_container(&inventory_info, render, &ui));
|
|
|
|
|
VK_RESULT(create_container(&chat_info, render, &ui));
|
|
|
|
@ -142,9 +174,15 @@ int network_thread() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) {
|
|
|
|
|
(void)window;
|
|
|
|
|
(void)key;
|
|
|
|
|
(void)scancode;
|
|
|
|
|
(void)action;
|
|
|
|
|
(void)mods;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mouse_button_callback(GLFWwindow* window, int button, int action, int mods) {
|
|
|
|
|
(void)mods;
|
|
|
|
|
switch(button) {
|
|
|
|
|
// Handle camera hover
|
|
|
|
|
case GLFW_MOUSE_BUTTON_MIDDLE:
|
|
|
|
@ -166,9 +204,15 @@ void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) {
|
|
|
|
|
(void)window;
|
|
|
|
|
(void)xoffset;
|
|
|
|
|
(void)yoffset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void cursor_pos_callback(GLFWwindow* window, double xpos, double ypos) {
|
|
|
|
|
(void)window;
|
|
|
|
|
(void)xpos;
|
|
|
|
|
(void)ypos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|