Added height modification inputs

main
noah metz 2024-11-10 21:55:32 -07:00
parent 8321fb0510
commit e16d94c130
1 changed files with 37 additions and 0 deletions

@ -508,6 +508,43 @@ void key_callback(GLFWwindow* window, int key, int scancode, int action, int mod
update_region_info_ui(context); update_region_info_ui(context);
} }
break; break;
case GLFW_KEY_Y:
if(action == GLFW_PRESS) {
HexRegion* region = context->hex->regions[context->hex->data.clicked_region];
if(region != NULL) {
region->data.hexes[context->hex->data.clicked_hex].height[context->hex->data.clicked_vertex-1] += 0.1;
add_transfer(
&region->data.hexes[context->hex->data.clicked_hex].height[context->hex->data.clicked_vertex-1],
region->region,
offsetof(GPUHexRegion, hexes)
+ sizeof(GPUHex)*context->hex->data.clicked_hex
+ offsetof(GPUHex, height)
+ sizeof(float)*(context->hex->data.clicked_vertex-1),
sizeof(float),
context->render->current_frame,
context->render);
}
}
break;
case GLFW_KEY_H:
if(action == GLFW_PRESS) {
HexRegion* region = context->hex->regions[context->hex->data.clicked_region];
if(region != NULL) {
region->data.hexes[context->hex->data.clicked_hex].height[context->hex->data.clicked_vertex-1] -= 0.1;
add_transfer(
&region->data.hexes[context->hex->data.clicked_hex].height[context->hex->data.clicked_vertex-1],
region->region,
offsetof(GPUHexRegion, hexes)
+ sizeof(GPUHex)*context->hex->data.clicked_hex
+ offsetof(GPUHex, height)
+ sizeof(float)*(context->hex->data.clicked_vertex-1),
sizeof(float),
context->render->current_frame,
context->render);
}
}
break;
} }
} }