move this out
This commit is contained in:
parent
ca1df3f172
commit
744850d3f0
1 changed files with 4 additions and 4 deletions
|
@ -210,15 +210,15 @@ movePlayer _ = return ()
|
||||||
playerInteract :: MouseMessage -> Affection UserData ()
|
playerInteract :: MouseMessage -> Affection UserData ()
|
||||||
playerInteract (MsgMouseButton _ _ SDL.Pressed _ SDL.ButtonRight _ m) = do
|
playerInteract (MsgMouseButton _ _ SDL.Pressed _ SDL.ButtonRight _ m) = do
|
||||||
ud <- getAffection
|
ud <- getAffection
|
||||||
|
(V2 rx ry) <- liftIO $ relativizeMouseCoords m
|
||||||
|
let dr = (ry / sin (atan 0.5) / 2) + rx
|
||||||
|
dc = rx - (ry / sin (atan 0.5) / 2)
|
||||||
(nws, relEnts) <- liftIO $ yieldSystemT (worldState ud) $ do
|
(nws, relEnts) <- liftIO $ yieldSystemT (worldState ud) $ do
|
||||||
emap allEnts $ do
|
emap allEnts $ do
|
||||||
with player
|
with player
|
||||||
with rot
|
with rot
|
||||||
rot' <- query rot
|
rot' <- query rot
|
||||||
(V2 rx ry) <- liftIO $ relativizeMouseCoords m
|
let ndir = direction (V2 dr dc)
|
||||||
let dr = (ry / sin (atan 0.5) / 2) + rx
|
|
||||||
dc = rx - (ry / sin (atan 0.5) / 2)
|
|
||||||
ndir = direction (V2 dr dc)
|
|
||||||
return $ unchanged
|
return $ unchanged
|
||||||
{ rot = Set $ fromMaybe rot' ndir
|
{ rot = Set $ fromMaybe rot' ndir
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue