From b31bbd93915b6a167679975ce85da04c44cd786b Mon Sep 17 00:00:00 2001 From: Marto Date: Sun, 26 Apr 2026 13:21:04 +0200 Subject: [PATCH] Temporary resolution change and fixes --- src/common/constants.odin | 4 ++-- src/input.odin | 5 ++++- src/simulator.odin | 10 +--------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/common/constants.odin b/src/common/constants.odin index a93723a..865ffa5 100644 --- a/src/common/constants.odin +++ b/src/common/constants.odin @@ -3,9 +3,9 @@ package common import rl "vendor:raylib" // Screen Width -WIDTH :: 1920 +WIDTH :: 1366 // Screen Height -HEIGHT :: 1080 +HEIGHT :: 768 // Default Monitor MONITOR :: 0 diff --git a/src/input.odin b/src/input.odin index f2a2288..3611f44 100644 --- a/src/input.odin +++ b/src/input.odin @@ -37,7 +37,10 @@ handle_mouse_input :: proc(self: ^Simulator, pos: rl.Vector2) { // Handles left click functionality @(private="file") left_click_event :: proc(self: ^Simulator, pos: rl.Vector2) { - demolish_road(self) + if road, ok := self.highlighted_road.?; ok && self.delete_mode { + delete_road(self, road) + return + } create_road(self, pos) } diff --git a/src/simulator.odin b/src/simulator.odin index 0403361..38cd873 100644 --- a/src/simulator.odin +++ b/src/simulator.odin @@ -41,14 +41,6 @@ update :: proc(self: ^Simulator, pos: rl.Vector2) { update_highlighted_road(self, pos) } -// Implementation of removing the road after a click has been registered -@private -demolish_road :: proc(self: ^Simulator) { - if !self.delete_mode do return - - if road, ok := self.highlighted_road.?; ok do delete_road(self, road) -} - // Implementation of road building after a click has been registered @private create_road :: proc(self: ^Simulator, pos: rl.Vector2) { @@ -156,7 +148,7 @@ add_road :: proc(self: ^Simulator, start: u32, end: u32) { } // Deletes the road which index was sent in, alongside deleting references of said road and removal of nodes if that road was their only connection -@(private="file") +@private delete_road :: proc(self: ^Simulator, road_to_delete: u32) { // First we need to unreference this road from surrounding nodes and then delete those nodes IF this was the last road connection road := self.roads[road_to_delete]