Changes
1 changed files (+22/-12)
-
-
@@ -447,7 +447,6 @@ set <| ← loadState path| ["v", speed] => setf speed (String.toNat! speed) | "b" :: variant :: dims => -- TODO refactor into own function, check collisions, update dists let variant := BuildingVariant.ofString? variant if h : dims.length = 10 && variant.isSome then let dims := dims.map String.toNat!
-
@@ -499,16 +498,25 @@ let entranceV3 := b.entrance.toVector3Shift s + (Vector3.mk 0 0.05 0)let exitV3 := b.exit.toVector3Shift s + (Vector3.mk 0 0.05 0) drawCubeV posV3 sizeV3 b.color drawCubeWiresV posV3 sizeV3 .black drawCubeV entranceV3 ⟨0.1, 0.1, 0.1⟩ Color.Raylean.beige drawCubeV exitV3 ⟨0.1, 0.1, 0.1⟩ Color.Raylean.skyblue drawCubeV entranceV3 ⟨0.1, 0.1, 0.1⟩ .green drawCubeV exitV3 ⟨0.1, 0.1, 0.1⟩ .red if h : s.grid.contains b.entrance then let name := s.grid[b.entrance].name let pos2D ← getWorldToScreen (posV3 + ⟨0, 0.2, 0⟩) camera endMode3D let address := if b.entrance.x == b.pos.x || b.entrance.x == b.pos.x + b.size.x then b.entrance.y else b.entrance.x drawText s!"{address} {name} Street" pos2D.x.toUInt64.toNat pos2D.y.toUInt64.toNat 10 Color.black beginMode3D camera -- Render road names -- for (pos, pt) in s.grid do -- if (2 * pos.x + pos.z) % 20 == 0 then -- -- https://www.raylib.com/examples/core/loader.html?name=core_world_screen -- let pos2D ← getWorldToScreen (pos.toVector3Shift s) camera -- let dir := pt.eout[di 1 0 0] != .none || pt.eout[di (-1) 0 0] != .none -- drawText s!"{if dir then pos.x else pos.z} {pt.name} Street" pos2D.x.toUInt64.toNat pos2D.y.toUInt64.toNat 10 Color.black -- Render roads for (pos, pt) in s.grid do if (2 * pos.x + pos.z) % 20 == 0 then -- https://www.raylib.com/examples/core/loader.html?name=core_world_screen let pos2D ← getWorldToScreen (pos.toVector3Shift s) camera let dir := pt.eout[di 1 0 0] != .none || pt.eout[di (-1) 0 0] != .none -- TODO this might not work drawText s!"{if dir then pos.x else pos.z} {pt.name} Street" pos2D.x.toUInt64.toNat pos2D.y.toUInt64.toNat 10 Color.black let posV3 := pos.toVector3Shift s for hi : i in List.range 27 do -- TODO choose better colors
-
@@ -517,9 +525,9 @@ match pt.eout[i]'(by grind) with| .none => pure () | .low => drawLine3D posV3 (pos.appd i |>.toVector3Shift s) Color.black drawLine3D posV3 (pos.appd i |>.toVector3Shift s) Color.Raylean.pink | .high => drawLine3D posV3 (pos.appd i |>.toVector3Shift s) Color.Raylean.gray drawLine3D posV3 (pos.appd i |>.toVector3Shift s) Color.Raylean.gold -- Render peeps for peep in s.peeps do if peep.pos != s.buildings[peep.dest]!.entrance then
-
@@ -630,9 +638,11 @@ clearBackground Color.whitelet mousePosV3 ← getMouse3D y camera let mousePos := mousePosV3.toNat3Shift (← get) drawText s!"{mousePos}" 10 10 20 Color.black if (← get).grid.contains mousePos then drawText s!"{(← get).grid[mousePos]!.name} Street" 10 30 20 Color.black renderWithCamera camera do -- For debugging: drawCubeV mousePosV3 ⟨0.1, 0.1, 0.1⟩ Color.Raylean.pink -- drawCubeV mousePosV3 ⟨0.1, 0.1, 0.1⟩ Color.Raylean.pink drawGrid ((← get).origin.x / scaleN * 2) 1 match start with | some (pos, isHigh) =>
-