|
|
|
@ -13,6 +13,9 @@ typedef struct ClientContextStruct {
|
|
|
|
|
GLFWwindow* window;
|
|
|
|
|
RenderContext render;
|
|
|
|
|
UIContext ui;
|
|
|
|
|
|
|
|
|
|
uint32_t clicked_container;
|
|
|
|
|
uint32_t clicked_element;
|
|
|
|
|
} ClientContext;
|
|
|
|
|
|
|
|
|
|
void* network_thread(void* data) {
|
|
|
|
@ -97,22 +100,18 @@ VkResult main_thread(ClientContext* context) {
|
|
|
|
|
//
|
|
|
|
|
uint32_t* mapped_codes = context->ui.containers[0].layers[0].codes_buffer;
|
|
|
|
|
GPUString* mapped_string = context->ui.containers[0].layers[0].strings_buffer;
|
|
|
|
|
char str[21] = "1234567890";
|
|
|
|
|
uint32_t last_id = 0;
|
|
|
|
|
uint32_t last_last_id = -1;
|
|
|
|
|
|
|
|
|
|
int test = 0;
|
|
|
|
|
char str[21];
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
while(glfwWindowShouldClose(context->window) == 0) {
|
|
|
|
|
context->clicked_element = 0x00000000;
|
|
|
|
|
context->clicked_container = 0x00000000;
|
|
|
|
|
|
|
|
|
|
glfwPollEvents();
|
|
|
|
|
double frame_time = glfwGetTime();
|
|
|
|
|
|
|
|
|
|
if(last_id != last_last_id) {
|
|
|
|
|
last_last_id = last_id;
|
|
|
|
|
test = (test + 1) % 7;
|
|
|
|
|
|
|
|
|
|
snprintf(str, 21, "Last ID: %d", last_id);
|
|
|
|
|
if(context->clicked_container != 0) {
|
|
|
|
|
snprintf(str, 21, "Clicked: %d.%d", context->clicked_container, context->clicked_element);
|
|
|
|
|
map_string(str, mapped_codes, 0, 0, &context->ui);
|
|
|
|
|
VK_RESULT(add_transfers(
|
|
|
|
|
context->ui.containers[0].layers[0].codes_buffer,
|
|
|
|
@ -179,15 +178,19 @@ void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
|
|
|
|
|
break;
|
|
|
|
|
case GLFW_MOUSE_BUTTON_LEFT:
|
|
|
|
|
if(action == GLFW_PRESS) {
|
|
|
|
|
for(uint32_t c = context->ui.max_containers - 1; c >= 0; c--) {
|
|
|
|
|
for(int32_t c = context->ui.max_containers - 1; c >= 0; c--) {
|
|
|
|
|
if(context->ui.containers[c].id == 0x00000000) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(uint32_t l = 0; l < context->ui.containers[c].layer_count; l++) {
|
|
|
|
|
for(uint32_t d = 0; d < context->ui.containers[c].layers[l].data.num_drawables; d++) {
|
|
|
|
|
if(context->ui.containers[c].layers[l].drawables_buffer[d].id == 0x00000000) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if(contains(cursor, &context->ui.containers[c].data, &context->ui.containers[c].layers[l].drawables_buffer[d])) {
|
|
|
|
|
fprintf(stderr, "hit\n");
|
|
|
|
|
context->clicked_container = context->ui.containers[c].id;
|
|
|
|
|
context->clicked_element = context->ui.containers[c].layers[l].drawables_buffer[d].id;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|