Temporary resolution change and fixes
This commit is contained in:
@@ -3,9 +3,9 @@ package common
|
|||||||
import rl "vendor:raylib"
|
import rl "vendor:raylib"
|
||||||
|
|
||||||
// Screen Width
|
// Screen Width
|
||||||
WIDTH :: 1920
|
WIDTH :: 1366
|
||||||
// Screen Height
|
// Screen Height
|
||||||
HEIGHT :: 1080
|
HEIGHT :: 768
|
||||||
// Default Monitor
|
// Default Monitor
|
||||||
MONITOR :: 0
|
MONITOR :: 0
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,10 @@ handle_mouse_input :: proc(self: ^Simulator, pos: rl.Vector2) {
|
|||||||
// Handles left click functionality
|
// Handles left click functionality
|
||||||
@(private="file")
|
@(private="file")
|
||||||
left_click_event :: proc(self: ^Simulator, pos: rl.Vector2) {
|
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)
|
create_road(self, pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,14 +41,6 @@ update :: proc(self: ^Simulator, pos: rl.Vector2) {
|
|||||||
update_highlighted_road(self, pos)
|
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
|
// Implementation of road building after a click has been registered
|
||||||
@private
|
@private
|
||||||
create_road :: proc(self: ^Simulator, pos: rl.Vector2) {
|
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
|
// 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) {
|
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
|
// 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]
|
road := self.roads[road_to_delete]
|
||||||
|
|||||||
Reference in New Issue
Block a user