|
|
@ -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));
|
|
|
|
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};
|
|
|
|
vec2 map_size = {250, 200};
|
|
|
|
|
|
|
|
|
|
|
|
UIDrawable map_rects[] = {
|
|
|
|
UIDrawable map_rects[] = {
|
|
|
@ -52,14 +83,14 @@ VkResult render_thread(GLFWwindow* window, RenderContext* render) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
UIContainerInput map_info = {
|
|
|
|
UIContainerInput map_info = {
|
|
|
|
.id = 0x01,
|
|
|
|
.id = 0x02,
|
|
|
|
.offset = {WINDOW_WIDTH-map_size[0], 0.0},
|
|
|
|
.anchor = ANCHOR_TOP_RIGHT,
|
|
|
|
.size = {map_size[0], map_size[1]},
|
|
|
|
.size = {map_size[0], map_size[1]},
|
|
|
|
.layer_count = sizeof(map_layers)/sizeof(UILayerInput),
|
|
|
|
.layer_count = sizeof(map_layers)/sizeof(UILayerInput),
|
|
|
|
.layers = map_layers,
|
|
|
|
.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[] = {
|
|
|
|
UIDrawable inventory_rects[] = {
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -78,14 +109,14 @@ VkResult render_thread(GLFWwindow* window, RenderContext* render) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
UIContainerInput inventory_info = {
|
|
|
|
UIContainerInput inventory_info = {
|
|
|
|
.id = 0x02,
|
|
|
|
.id = 0x03,
|
|
|
|
.offset = {WINDOW_WIDTH-inventory_size[0], WINDOW_HEIGHT-inventory_size[1]},
|
|
|
|
.anchor = ANCHOR_BOTTOM_RIGHT,
|
|
|
|
.size = {inventory_size[0], inventory_size[1]},
|
|
|
|
.size = {inventory_size[0], inventory_size[1]},
|
|
|
|
.layer_count = sizeof(inventory_layers)/sizeof(UILayerInput),
|
|
|
|
.layer_count = sizeof(inventory_layers)/sizeof(UILayerInput),
|
|
|
|
.layers = inventory_layers,
|
|
|
|
.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[] = {
|
|
|
|
UIDrawable chat_rects[] = {
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -104,13 +135,14 @@ VkResult render_thread(GLFWwindow* window, RenderContext* render) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
UIContainerInput chat_info = {
|
|
|
|
UIContainerInput chat_info = {
|
|
|
|
.id = 0x02,
|
|
|
|
.id = 0x04,
|
|
|
|
.offset = {0, WINDOW_HEIGHT-chat_size[1]},
|
|
|
|
.anchor = ANCHOR_BOTTOM_LEFT,
|
|
|
|
.size = {chat_size[0], chat_size[1]},
|
|
|
|
.size = {chat_size[0], chat_size[1]},
|
|
|
|
.layer_count = sizeof(chat_layers)/sizeof(UILayerInput),
|
|
|
|
.layer_count = sizeof(chat_layers)/sizeof(UILayerInput),
|
|
|
|
.layers = chat_layers,
|
|
|
|
.layers = chat_layers,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VK_RESULT(create_container(&context_info, render, &ui));
|
|
|
|
VK_RESULT(create_container(&map_info, render, &ui));
|
|
|
|
VK_RESULT(create_container(&map_info, render, &ui));
|
|
|
|
VK_RESULT(create_container(&inventory_info, render, &ui));
|
|
|
|
VK_RESULT(create_container(&inventory_info, render, &ui));
|
|
|
|
VK_RESULT(create_container(&chat_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 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 mouse_button_callback(GLFWwindow* window, int button, int action, int mods) {
|
|
|
|
|
|
|
|
(void)mods;
|
|
|
|
switch(button) {
|
|
|
|
switch(button) {
|
|
|
|
// Handle camera hover
|
|
|
|
// Handle camera hover
|
|
|
|
case GLFW_MOUSE_BUTTON_MIDDLE:
|
|
|
|
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 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 cursor_pos_callback(GLFWwindow* window, double xpos, double ypos) {
|
|
|
|
|
|
|
|
(void)window;
|
|
|
|
|
|
|
|
(void)xpos;
|
|
|
|
|
|
|
|
(void)ypos;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
int main() {
|
|
|
|