From e16d94c130259a83f529af81616acc1d78d69358 Mon Sep 17 00:00:00 2001 From: Noah Metz Date: Sun, 10 Nov 2024 21:55:32 -0700 Subject: [PATCH] Added height modification inputs --- client/src/main.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/client/src/main.c b/client/src/main.c index 6e138a2..e9675db 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -508,6 +508,43 @@ void key_callback(GLFWwindow* window, int key, int scancode, int action, int mod update_region_info_ui(context); } 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( + ®ion->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( + ®ion->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; } }