Implementation of road intersections and road splitting (halfway)
This commit is contained in:
@@ -1,19 +1,26 @@
|
||||
package infrastructure
|
||||
|
||||
import "../common"
|
||||
import rl "vendor:raylib"
|
||||
|
||||
Node :: struct {
|
||||
id: u32,
|
||||
enabled: bool,
|
||||
pos: rl.Vector2,
|
||||
roads: [dynamic]u32,
|
||||
}
|
||||
|
||||
node_init :: proc(new_id: u32, new_pos: rl.Vector2) -> Node {
|
||||
node_init :: proc(new_pos: rl.Vector2) -> Node {
|
||||
return {
|
||||
id = new_id,
|
||||
enabled = true,
|
||||
pos = new_pos,
|
||||
roads = nil,
|
||||
}
|
||||
}
|
||||
|
||||
node_within_snapping_radius :: proc(self: ^Node, pos: rl.Vector2) -> bool {
|
||||
return rl.CheckCollisionPointCircle(
|
||||
pos,
|
||||
self.pos,
|
||||
common.NODE_SNAP_RADIUS * common.NODE_RADIUS,
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user