Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
w0rm committed Dec 7, 2023
1 parent 60bf9ff commit 4bba9ce
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/Cue.elm
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ offset =
Length.centimeters 2


entity : Camera3d Meters WorldCoordinates -> Length -> Axis3d Meters WorldCoordinates -> Color -> Entity WorldCoordinates
entity camera3d clipDepth axis color =
entity : Camera3d Meters WorldCoordinates -> Length -> Color -> Axis3d Meters WorldCoordinates -> Entity WorldCoordinates
entity camera3d clipDepth color axis =
case cylinder camera3d clipDepth axis of
Just trimmedCylinder ->
Scene3d.cylinderWithShadow
Expand Down Expand Up @@ -89,8 +89,8 @@ cylinder camera3d clipDepth axis =

{-| Check if the cue doesn't overlap with any other objects
-}
canShoot : Axis3d Meters WorldCoordinates -> World Id -> Bool
canShoot axis world =
canShoot : World Id -> Axis3d Meters WorldCoordinates -> Bool
canShoot world axis =
let
direction =
Axis3d.direction axis
Expand Down
8 changes: 4 additions & 4 deletions src/Game.elm
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ update window msg oldModel =
in
-- the message can be sent many times
-- we need to check if the button isn't already pressed
if Cue.canShoot axis model.world && shot.shootPressedAt == Nothing then
if Cue.canShoot model.world axis && shot.shootPressedAt == Nothing then
let
-- save the time the buttom was pressed
newShot =
Expand All @@ -279,7 +279,7 @@ update window msg oldModel =
startTime =
Maybe.withDefault model.time shot.shootPressedAt
in
if Cue.canShoot axis model.world then
if Cue.canShoot model.world axis then
{ model
| state = Simulating [] pool
, camera = Camera.zoomOut model.camera
Expand Down Expand Up @@ -851,13 +851,13 @@ view ballTextures roughnessTexture table window model =
cueAxis (cueBallPosition model.world) (Camera.azimuth model.camera) cue

color =
if Cue.canShoot axis model.world then
if Cue.canShoot model.world axis then
Color.white

else
inactiveColor
in
Cue.entity camera3d clipDepth axis color :: entities
Cue.entity camera3d clipDepth color axis :: entities

_ ->
entities
Expand Down
8 changes: 4 additions & 4 deletions src/Table.elm
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ tableDecoder =
, -- floor
Scene3d.quad
(Material.matte (Color.rgb255 46 52 54))
(Point3d.meters -15 -15 0)
(Point3d.meters 15 -15 0)
(Point3d.meters 15 15 0)
(Point3d.meters -15 15 0)
(Point3d.meters -15 -15 -0.45)
(Point3d.meters 15 -15 -0.45)
(Point3d.meters 15 15 -0.45)
(Point3d.meters -15 15 -0.45)
]
}
)
Expand Down

0 comments on commit 4bba9ce

Please sign in to comment.