|
|
@ -11,9 +11,9 @@
|
|
|
|
typedef struct EditorDataStruct {
|
|
|
|
typedef struct EditorDataStruct {
|
|
|
|
uint32_t selected_region;
|
|
|
|
uint32_t selected_region;
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t last_clicked_region;
|
|
|
|
uint32_t clicked_region;
|
|
|
|
uint32_t last_clicked_hex;
|
|
|
|
uint32_t clicked_hex;
|
|
|
|
uint32_t last_clicked_vertex;
|
|
|
|
uint32_t clicked_vertex;
|
|
|
|
|
|
|
|
|
|
|
|
double current_hsv[3];
|
|
|
|
double current_hsv[3];
|
|
|
|
vec4 current;
|
|
|
|
vec4 current;
|
|
|
@ -862,10 +862,8 @@ VkResult update_region_info_ui(ClientContext* context) {
|
|
|
|
char temp[20];
|
|
|
|
char temp[20];
|
|
|
|
VkResult result;
|
|
|
|
VkResult result;
|
|
|
|
EditorData* data = context->app_data;
|
|
|
|
EditorData* data = context->app_data;
|
|
|
|
HexRegion* selected_region = context->hex.regions[data->selected_region];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(data->selected_region >= MAX_LOADED_REGIONS) {
|
|
|
|
if(selected_region == NULL) {
|
|
|
|
|
|
|
|
snprintf(temp,
|
|
|
|
snprintf(temp,
|
|
|
|
sizeof(temp),
|
|
|
|
sizeof(temp),
|
|
|
|
"");
|
|
|
|
"");
|
|
|
@ -889,6 +887,7 @@ VkResult update_region_info_ui(ClientContext* context) {
|
|
|
|
"");
|
|
|
|
"");
|
|
|
|
VK_RESULT(update_ui_string(temp, 0x01, 0, 3, &context->ui, &context->render));
|
|
|
|
VK_RESULT(update_ui_string(temp, 0x01, 0, 3, &context->ui, &context->render));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
HexRegion* selected_region = context->hex.regions[data->selected_region];
|
|
|
|
snprintf(temp,
|
|
|
|
snprintf(temp,
|
|
|
|
sizeof(temp),
|
|
|
|
sizeof(temp),
|
|
|
|
"Region %4d", data->selected_region);
|
|
|
|
"Region %4d", data->selected_region);
|
|
|
@ -919,10 +918,10 @@ VkResult update_region_info_ui(ClientContext* context) {
|
|
|
|
VkResult update_hex_info_ui(ClientContext* context) {
|
|
|
|
VkResult update_hex_info_ui(ClientContext* context) {
|
|
|
|
char temp[20];
|
|
|
|
char temp[20];
|
|
|
|
VkResult result;
|
|
|
|
VkResult result;
|
|
|
|
HexRegion* region = context->hex.regions[context->hex.data.clicked_region];
|
|
|
|
EditorData* data = context->app_data;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(region == NULL) {
|
|
|
|
if(data->clicked_region >= MAX_LOADED_REGIONS) {
|
|
|
|
snprintf(
|
|
|
|
snprintf(
|
|
|
|
temp,
|
|
|
|
temp,
|
|
|
|
sizeof(temp),
|
|
|
|
sizeof(temp),
|
|
|
@ -971,17 +970,19 @@ VkResult update_hex_info_ui(ClientContext* context) {
|
|
|
|
"");
|
|
|
|
"");
|
|
|
|
VK_RESULT(update_ui_string(temp, 0x02, 0, 7, &context->ui, &context->render));
|
|
|
|
VK_RESULT(update_ui_string(temp, 0x02, 0, 7, &context->ui, &context->render));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
GPUHex* hex = ®ion->data.hexes[context->hex.data.clicked_hex];
|
|
|
|
HexRegion* region = context->hex.regions[data->clicked_region];
|
|
|
|
|
|
|
|
GPUHex* hex = ®ion->data.hexes[data->clicked_hex];
|
|
|
|
snprintf(temp,
|
|
|
|
snprintf(temp,
|
|
|
|
sizeof(temp),
|
|
|
|
sizeof(temp),
|
|
|
|
"%d-%d",
|
|
|
|
"%d-%d",
|
|
|
|
context->hex.data.clicked_region,
|
|
|
|
data->clicked_region,
|
|
|
|
context->hex.data.clicked_hex);
|
|
|
|
data->clicked_hex);
|
|
|
|
VK_RESULT(update_ui_string(temp, 0x02, 0, 0, &context->ui, &context->render));
|
|
|
|
VK_RESULT(update_ui_string(temp, 0x02, 0, 0, &context->ui, &context->render));
|
|
|
|
|
|
|
|
|
|
|
|
HexCoord hex_world;
|
|
|
|
HexCoord hex_world;
|
|
|
|
hex_qr(context->hex.data.clicked_hex, &hex_world);
|
|
|
|
hex_qr(data->clicked_hex, &hex_world);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fprintf(stderr, "region: %d\n", data->clicked_region);
|
|
|
|
HexCoord region_coord = {region->data.position.q, region->data.position.r};
|
|
|
|
HexCoord region_coord = {region->data.position.q, region->data.position.r};
|
|
|
|
HexCoord region_world;
|
|
|
|
HexCoord region_world;
|
|
|
|
region_qr(region_coord, ®ion_world);
|
|
|
|
region_qr(region_coord, ®ion_world);
|
|
|
@ -994,7 +995,7 @@ VkResult update_hex_info_ui(ClientContext* context) {
|
|
|
|
hex_world.q,
|
|
|
|
hex_world.q,
|
|
|
|
hex_world.r,
|
|
|
|
hex_world.r,
|
|
|
|
region->data.y,
|
|
|
|
region->data.y,
|
|
|
|
context->hex.data.clicked_vertex);
|
|
|
|
data->clicked_vertex);
|
|
|
|
VK_RESULT(update_ui_string(temp, 0x02, 0, 1, &context->ui, &context->render));
|
|
|
|
VK_RESULT(update_ui_string(temp, 0x02, 0, 1, &context->ui, &context->render));
|
|
|
|
|
|
|
|
|
|
|
|
snprintf(
|
|
|
|
snprintf(
|
|
|
@ -1059,21 +1060,23 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case GLFW_KEY_MINUS:
|
|
|
|
case GLFW_KEY_MINUS:
|
|
|
|
free_hex_region(data->selected_region, &context->hex, &context->render);
|
|
|
|
if(data->selected_region < MAX_LOADED_REGIONS) {
|
|
|
|
start = data->selected_region;
|
|
|
|
free_hex_region(data->selected_region, &context->hex, &context->render);
|
|
|
|
next_region = start;
|
|
|
|
start = data->selected_region;
|
|
|
|
do {
|
|
|
|
next_region = start;
|
|
|
|
next_region -= 1;
|
|
|
|
do {
|
|
|
|
if(next_region > MAX_LOADED_REGIONS) next_region = MAX_LOADED_REGIONS;
|
|
|
|
next_region -= 1;
|
|
|
|
if(next_region != MAX_LOADED_REGIONS && context->hex.regions[next_region] != NULL) break;
|
|
|
|
if(next_region > MAX_LOADED_REGIONS) next_region = MAX_LOADED_REGIONS;
|
|
|
|
} while(next_region != start);
|
|
|
|
if(next_region != MAX_LOADED_REGIONS && context->hex.regions[next_region] != NULL) break;
|
|
|
|
if(next_region == start) {
|
|
|
|
} while(next_region != start);
|
|
|
|
data->selected_region = MAX_LOADED_REGIONS;
|
|
|
|
if(next_region == start) {
|
|
|
|
} else {
|
|
|
|
data->selected_region = MAX_LOADED_REGIONS;
|
|
|
|
data->selected_region = next_region;
|
|
|
|
} else {
|
|
|
|
|
|
|
|
data->selected_region = next_region;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
update_region_info_ui(context);
|
|
|
|
|
|
|
|
update_hex_info_ui(context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
update_region_info_ui(context);
|
|
|
|
|
|
|
|
update_hex_info_ui(context);
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case GLFW_KEY_LEFT_BRACKET:
|
|
|
|
case GLFW_KEY_LEFT_BRACKET:
|
|
|
@ -1101,7 +1104,7 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case GLFW_KEY_I:
|
|
|
|
case GLFW_KEY_I:
|
|
|
|
if(context->hex.regions[data->selected_region] != NULL) {
|
|
|
|
if(data->selected_region < MAX_LOADED_REGIONS) {
|
|
|
|
context->hex.regions[data->selected_region]->data.position.q += 1;
|
|
|
|
context->hex.regions[data->selected_region]->data.position.q += 1;
|
|
|
|
add_transfer(
|
|
|
|
add_transfer(
|
|
|
|
&context->hex.regions[data->selected_region]->data.position,
|
|
|
|
&context->hex.regions[data->selected_region]->data.position,
|
|
|
@ -1114,7 +1117,7 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods)
|
|
|
|
update_region_info_ui(context);
|
|
|
|
update_region_info_ui(context);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case GLFW_KEY_K:
|
|
|
|
case GLFW_KEY_K:
|
|
|
|
if(context->hex.regions[data->selected_region] != NULL) {
|
|
|
|
if(data->selected_region < MAX_LOADED_REGIONS) {
|
|
|
|
context->hex.regions[data->selected_region]->data.position.q -= 1;
|
|
|
|
context->hex.regions[data->selected_region]->data.position.q -= 1;
|
|
|
|
add_transfer(
|
|
|
|
add_transfer(
|
|
|
|
&context->hex.regions[data->selected_region]->data.position.q,
|
|
|
|
&context->hex.regions[data->selected_region]->data.position.q,
|
|
|
@ -1127,7 +1130,7 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods)
|
|
|
|
update_region_info_ui(context);
|
|
|
|
update_region_info_ui(context);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case GLFW_KEY_J:
|
|
|
|
case GLFW_KEY_J:
|
|
|
|
if(context->hex.regions[data->selected_region] != NULL) {
|
|
|
|
if(data->selected_region < MAX_LOADED_REGIONS) {
|
|
|
|
context->hex.regions[data->selected_region]->data.position.r += 1;
|
|
|
|
context->hex.regions[data->selected_region]->data.position.r += 1;
|
|
|
|
add_transfer(
|
|
|
|
add_transfer(
|
|
|
|
&context->hex.regions[data->selected_region]->data.position.r,
|
|
|
|
&context->hex.regions[data->selected_region]->data.position.r,
|
|
|
@ -1140,7 +1143,7 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods)
|
|
|
|
update_region_info_ui(context);
|
|
|
|
update_region_info_ui(context);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case GLFW_KEY_L:
|
|
|
|
case GLFW_KEY_L:
|
|
|
|
if(context->hex.regions[data->selected_region] != NULL) {
|
|
|
|
if(data->selected_region < MAX_LOADED_REGIONS) {
|
|
|
|
context->hex.regions[data->selected_region]->data.position.r -= 1;
|
|
|
|
context->hex.regions[data->selected_region]->data.position.r -= 1;
|
|
|
|
add_transfer(
|
|
|
|
add_transfer(
|
|
|
|
&context->hex.regions[data->selected_region]->data.position.r,
|
|
|
|
&context->hex.regions[data->selected_region]->data.position.r,
|
|
|
@ -1153,7 +1156,7 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods)
|
|
|
|
update_region_info_ui(context);
|
|
|
|
update_region_info_ui(context);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case GLFW_KEY_O:
|
|
|
|
case GLFW_KEY_O:
|
|
|
|
if(context->hex.regions[data->selected_region] != NULL) {
|
|
|
|
if(data->selected_region < MAX_LOADED_REGIONS) {
|
|
|
|
context->hex.regions[data->selected_region]->data.y += 1;
|
|
|
|
context->hex.regions[data->selected_region]->data.y += 1;
|
|
|
|
add_transfer(
|
|
|
|
add_transfer(
|
|
|
|
&context->hex.regions[data->selected_region]->data.y,
|
|
|
|
&context->hex.regions[data->selected_region]->data.y,
|
|
|
@ -1166,7 +1169,7 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods)
|
|
|
|
update_region_info_ui(context);
|
|
|
|
update_region_info_ui(context);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case GLFW_KEY_U:
|
|
|
|
case GLFW_KEY_U:
|
|
|
|
if(context->hex.regions[data->selected_region] != NULL) {
|
|
|
|
if(data->selected_region < MAX_LOADED_REGIONS) {
|
|
|
|
context->hex.regions[data->selected_region]->data.y -= 1;
|
|
|
|
context->hex.regions[data->selected_region]->data.y -= 1;
|
|
|
|
add_transfer(
|
|
|
|
add_transfer(
|
|
|
|
&context->hex.regions[data->selected_region]->data.y,
|
|
|
|
&context->hex.regions[data->selected_region]->data.y,
|
|
|
@ -1180,9 +1183,9 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case GLFW_KEY_Y:
|
|
|
|
case GLFW_KEY_Y:
|
|
|
|
region = context->hex.regions[context->hex.data.clicked_region];
|
|
|
|
if(data->clicked_region < MAX_LOADED_REGIONS && data->clicked_vertex != 0) {
|
|
|
|
if(region != NULL && context->hex.data.clicked_vertex != 0) {
|
|
|
|
region = context->hex.regions[data->clicked_region];
|
|
|
|
float height = region->data.hexes[context->hex.data.clicked_hex].height[context->hex.data.clicked_vertex-1] + 0.1;
|
|
|
|
float height = region->data.hexes[data->clicked_hex].height[data->clicked_vertex-1] + 0.1;
|
|
|
|
|
|
|
|
|
|
|
|
if(~mods & GLFW_MOD_CONTROL) {
|
|
|
|
if(~mods & GLFW_MOD_CONTROL) {
|
|
|
|
uint32_t n_vertex[2], n_hex[2];
|
|
|
|
uint32_t n_vertex[2], n_hex[2];
|
|
|
@ -1190,9 +1193,9 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods)
|
|
|
|
HexCoord world, region_center;
|
|
|
|
HexCoord world, region_center;
|
|
|
|
|
|
|
|
|
|
|
|
region_qr(region->data.position, ®ion_center);
|
|
|
|
region_qr(region->data.position, ®ion_center);
|
|
|
|
hex_qr(context->hex.data.clicked_hex, &world);
|
|
|
|
hex_qr(data->clicked_hex, &world);
|
|
|
|
hex_add(region_center, &world);
|
|
|
|
hex_add(region_center, &world);
|
|
|
|
hex_vertex_neighbors(context->hex.data.clicked_vertex, world, n_vertex, n_region, n_hex);
|
|
|
|
hex_vertex_neighbors(data->clicked_vertex, world, n_vertex, n_region, n_hex);
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t n0, n1;
|
|
|
|
uint32_t n0, n1;
|
|
|
|
first_matching_region(n_region[0], region->data.y, &n0, &context->hex);
|
|
|
|
first_matching_region(n_region[0], region->data.y, &n0, &context->hex);
|
|
|
@ -1201,15 +1204,15 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods)
|
|
|
|
if(n0 != MAX_LOADED_REGIONS) set_vertex_height(height, n0, n_hex[0], n_vertex[0], context);
|
|
|
|
if(n0 != MAX_LOADED_REGIONS) set_vertex_height(height, n0, n_hex[0], n_vertex[0], context);
|
|
|
|
if(n1 != MAX_LOADED_REGIONS) set_vertex_height(height, n1, n_hex[1], n_vertex[1], context);
|
|
|
|
if(n1 != MAX_LOADED_REGIONS) set_vertex_height(height, n1, n_hex[1], n_vertex[1], context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
set_vertex_height(height, context->hex.data.clicked_region, context->hex.data.clicked_hex, context->hex.data.clicked_vertex, context);
|
|
|
|
set_vertex_height(height, data->clicked_region, data->clicked_hex, data->clicked_vertex, context);
|
|
|
|
update_hex_info_ui(context);
|
|
|
|
update_hex_info_ui(context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case GLFW_KEY_H:
|
|
|
|
case GLFW_KEY_H:
|
|
|
|
region = context->hex.regions[context->hex.data.clicked_region];
|
|
|
|
if(data->clicked_region < MAX_LOADED_REGIONS && data->clicked_vertex != 0) {
|
|
|
|
if(region != NULL && context->hex.data.clicked_vertex != 0) {
|
|
|
|
region = context->hex.regions[data->clicked_region];
|
|
|
|
float height = region->data.hexes[context->hex.data.clicked_hex].height[context->hex.data.clicked_vertex-1] - 0.1;
|
|
|
|
float height = region->data.hexes[data->clicked_hex].height[data->clicked_vertex-1] - 0.1;
|
|
|
|
|
|
|
|
|
|
|
|
if(~mods & GLFW_MOD_CONTROL) {
|
|
|
|
if(~mods & GLFW_MOD_CONTROL) {
|
|
|
|
uint32_t n_vertex[2], n_hex[2];
|
|
|
|
uint32_t n_vertex[2], n_hex[2];
|
|
|
@ -1217,9 +1220,9 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods)
|
|
|
|
HexCoord world, region_center;
|
|
|
|
HexCoord world, region_center;
|
|
|
|
|
|
|
|
|
|
|
|
region_qr(region->data.position, ®ion_center);
|
|
|
|
region_qr(region->data.position, ®ion_center);
|
|
|
|
hex_qr(context->hex.data.clicked_hex, &world);
|
|
|
|
hex_qr(data->clicked_hex, &world);
|
|
|
|
hex_add(region_center, &world);
|
|
|
|
hex_add(region_center, &world);
|
|
|
|
hex_vertex_neighbors(context->hex.data.clicked_vertex, world, n_vertex, n_region, n_hex);
|
|
|
|
hex_vertex_neighbors(data->clicked_vertex, world, n_vertex, n_region, n_hex);
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t n0, n1;
|
|
|
|
uint32_t n0, n1;
|
|
|
|
first_matching_region(n_region[0], region->data.y, &n0, &context->hex);
|
|
|
|
first_matching_region(n_region[0], region->data.y, &n0, &context->hex);
|
|
|
@ -1228,23 +1231,23 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods)
|
|
|
|
if(n0 != MAX_LOADED_REGIONS) set_vertex_height(height, n0, n_hex[0], n_vertex[0], context);
|
|
|
|
if(n0 != MAX_LOADED_REGIONS) set_vertex_height(height, n0, n_hex[0], n_vertex[0], context);
|
|
|
|
if(n1 != MAX_LOADED_REGIONS) set_vertex_height(height, n1, n_hex[1], n_vertex[1], context);
|
|
|
|
if(n1 != MAX_LOADED_REGIONS) set_vertex_height(height, n1, n_hex[1], n_vertex[1], context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
set_vertex_height(height, context->hex.data.clicked_region, context->hex.data.clicked_hex, context->hex.data.clicked_vertex, context);
|
|
|
|
set_vertex_height(height, data->clicked_region, data->clicked_hex, data->clicked_vertex, context);
|
|
|
|
update_hex_info_ui(context);
|
|
|
|
update_hex_info_ui(context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case GLFW_KEY_E:
|
|
|
|
case GLFW_KEY_E:
|
|
|
|
region = context->hex.regions[context->hex.data.clicked_region];
|
|
|
|
if(data->clicked_region < MAX_LOADED_REGIONS) {
|
|
|
|
if(region != NULL) {
|
|
|
|
region = context->hex.regions[data->clicked_region];
|
|
|
|
uint32_t n_vertex[2], n_hex[2];
|
|
|
|
uint32_t n_vertex[2], n_hex[2];
|
|
|
|
HexCoord n_region[2];
|
|
|
|
HexCoord n_region[2];
|
|
|
|
HexCoord world, region_center;
|
|
|
|
HexCoord world, region_center;
|
|
|
|
|
|
|
|
|
|
|
|
if(context->hex.data.clicked_vertex != 0) {
|
|
|
|
if(data->clicked_vertex != 0 && data->clicked_vertex <= 6) {
|
|
|
|
region_qr(region->data.position, ®ion_center);
|
|
|
|
region_qr(region->data.position, ®ion_center);
|
|
|
|
hex_qr(context->hex.data.clicked_hex, &world);
|
|
|
|
hex_qr(data->clicked_hex, &world);
|
|
|
|
hex_add(region_center, &world);
|
|
|
|
hex_add(region_center, &world);
|
|
|
|
hex_vertex_neighbors(context->hex.data.clicked_vertex, world, n_vertex, n_region, n_hex);
|
|
|
|
hex_vertex_neighbors(data->clicked_vertex, world, n_vertex, n_region, n_hex);
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t n0, n1;
|
|
|
|
uint32_t n0, n1;
|
|
|
|
first_matching_region(n_region[0], region->data.y, &n0, &context->hex);
|
|
|
|
first_matching_region(n_region[0], region->data.y, &n0, &context->hex);
|
|
|
@ -1253,7 +1256,7 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods)
|
|
|
|
if(n0 != MAX_LOADED_REGIONS) set_vertex_color(data->current, n0, n_hex[0], n_vertex[0], context);
|
|
|
|
if(n0 != MAX_LOADED_REGIONS) set_vertex_color(data->current, n0, n_hex[0], n_vertex[0], context);
|
|
|
|
if(n1 != MAX_LOADED_REGIONS) set_vertex_color(data->current, n1, n_hex[1], n_vertex[1], context);
|
|
|
|
if(n1 != MAX_LOADED_REGIONS) set_vertex_color(data->current, n1, n_hex[1], n_vertex[1], context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
set_vertex_color(data->current, context->hex.data.clicked_region, context->hex.data.clicked_hex, context->hex.data.clicked_vertex, context);
|
|
|
|
set_vertex_color(data->current, data->clicked_region, data->clicked_hex, data->clicked_vertex, context);
|
|
|
|
update_hex_info_ui(context);
|
|
|
|
update_hex_info_ui(context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -1262,18 +1265,6 @@ bool editor_key_callback(ClientContext* context, int key, int action, int mods)
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void editor_frame(ClientContext* context) {
|
|
|
|
|
|
|
|
EditorData* data = context->app_data;
|
|
|
|
|
|
|
|
if(data->last_clicked_region != context->hex.data.clicked_region ||
|
|
|
|
|
|
|
|
data->last_clicked_hex != context->hex.data.clicked_hex ||
|
|
|
|
|
|
|
|
data->last_clicked_vertex != context->hex.data.clicked_vertex) {
|
|
|
|
|
|
|
|
data->last_clicked_region = context->hex.data.clicked_region;
|
|
|
|
|
|
|
|
data->last_clicked_hex = context->hex.data.clicked_hex;
|
|
|
|
|
|
|
|
data->last_clicked_vertex = context->hex.data.clicked_vertex;
|
|
|
|
|
|
|
|
update_hex_info_ui(context);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void editor_startup(ClientContext* context) {
|
|
|
|
void editor_startup(ClientContext* context) {
|
|
|
|
region_info_ui(context);
|
|
|
|
region_info_ui(context);
|
|
|
|
hex_info_ui(context);
|
|
|
|
hex_info_ui(context);
|
|
|
@ -1284,7 +1275,9 @@ int main() {
|
|
|
|
EditorData* data = malloc(sizeof(EditorData));
|
|
|
|
EditorData* data = malloc(sizeof(EditorData));
|
|
|
|
memset(data, 0, sizeof(EditorData));
|
|
|
|
memset(data, 0, sizeof(EditorData));
|
|
|
|
data->selected_region = MAX_LOADED_REGIONS;
|
|
|
|
data->selected_region = MAX_LOADED_REGIONS;
|
|
|
|
data->last_clicked_region = MAX_LOADED_REGIONS;
|
|
|
|
data->clicked_region = MAX_LOADED_REGIONS;
|
|
|
|
|
|
|
|
data->clicked_hex = UINT32_MAX;
|
|
|
|
|
|
|
|
data->clicked_vertex = UINT32_MAX;
|
|
|
|
|
|
|
|
|
|
|
|
return run_app(data, editor_startup, editor_frame, NULL, editor_key_callback, NULL, NULL, NULL);
|
|
|
|
return run_app(data, editor_startup, NULL, NULL, editor_key_callback, NULL, NULL, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|