bar limit

This commit is contained in:
Luka Jankovic 2025-06-24 22:04:14 +02:00
parent e51ab673c5
commit 01a6c5e4ff

View file

@ -41,7 +41,7 @@ void kubo_window_render(struct kubo_context *context) {
for (int i = 0; i < context->walls.count; i++) {
struct kubo_wall *wall = kubo_wall_arr_get(&context->walls, i);
assert(wall != NULL);
kubo_wall_render(wall);
}
@ -51,6 +51,8 @@ void kubo_window_render(struct kubo_context *context) {
}
void kubo_window_input(struct kubo_context *context) {
int bar_limit = GetScreenHeight() - KUBO_BAR_HEIGHT;
if (IsKeyPressed(KEY_Q)) {
context->exit_pending = true;
}
@ -59,8 +61,10 @@ void kubo_window_input(struct kubo_context *context) {
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
Vector2 new_pos = GetMousePosition();
kubo_wall_add_vertex(current_wall, new_pos);
current_wall->state = KUBO_WALL_DRAWING;
if (new_pos.y < bar_limit) {
kubo_wall_add_vertex(current_wall, new_pos);
current_wall->state = KUBO_WALL_DRAWING;
}
} else if (IsMouseButtonPressed(MOUSE_BUTTON_RIGHT)) {
current_wall->state = KUBO_WALL_DONE;
}