From 25a6186e7be966c065793f563bf3427000605924 Mon Sep 17 00:00:00 2001 From: jgk Date: Wed, 28 Jul 2021 20:58:39 +0200 Subject: [PATCH] Hack partially working gui line to dropped items --- src/Dodge/Render.hs | 2 +- src/Dodge/Render/HUD.hs | 8 +++----- src/Picture.hs | 3 ++- src/Shader.hs | 2 +- src/Shader/Poke.hs | 29 +++++++++++++++-------------- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/Dodge/Render.hs b/src/Dodge/Render.hs index 29dde0e26..9ec2c9f21 100644 --- a/src/Dodge/Render.hs +++ b/src/Dodge/Render.hs @@ -34,7 +34,7 @@ import qualified Control.Foldl as F --import Data.List --import Data.Bifunctor --import Data.Function -import qualified Data.IntMap.Strict as IM +--import qualified Data.IntMap.Strict as IM --import qualified Data.Map as M --import qualified Data.Set as S import Graphics.Rendering.OpenGL hiding (color,scale,translate,rotate) diff --git a/src/Dodge/Render/HUD.hs b/src/Dodge/Render/HUD.hs index 76097d999..133d56e64 100644 --- a/src/Dodge/Render/HUD.hs +++ b/src/Dodge/Render/HUD.hs @@ -214,7 +214,7 @@ closeObjectTexts w = pictures $ zipWith renderList [(0::Int)..] (map colAndText let p' = ( pushout - halfWidth w + 130 , halfHeight w - 20* (fromIntegral invPos +1) + 2.5 ) - return $ lineCol + return $ flip thickLineCol (1 / halfWidth w) [(itScreenPos, withAlpha 0 col) ,(sc p' , col) ,(sc p , col) @@ -222,8 +222,8 @@ closeObjectTexts w = pictures $ zipWith renderList [(0::Int)..] (map colAndText {- | Colour picture and add black drop shadow. -} dShadCol :: Color -> Picture -> Picture dShadCol c p = pictures - [ color c p - , color black $ uncurry translate (1.2,-1.2) p + [ color black $ uncurry translate (1.2,-1.2) p + , color c p ] drawListCursor :: Color -> Int -> World -> Picture @@ -264,9 +264,7 @@ cursorAt wth col xoff yoff yint w = winScale w ,( wth,12.5) ] - displayHP :: Int -> World -> Picture displayHP n w = translate (halfWidth w-80) (halfHeight w-20) $ scale 0.2 0.2 $ text $ reverse $ take 5 $ (++ repeat ' ') $ reverse $ show $ _crHP $ _creatures w IM.! n - diff --git a/src/Picture.hs b/src/Picture.hs index e9bef1c2e..074e3a335 100644 --- a/src/Picture.hs +++ b/src/Picture.hs @@ -12,6 +12,7 @@ module Picture , thickArc , thickCircle , thickLine + , thickLineCol , circleSolid , circleSolidCol , circle @@ -260,7 +261,7 @@ thickLineCol ps t = pictures $ f ps ,(y +.+ n x y,c') ] : f ((y,c'):ys) f _ = [] - n a b = (t*0.5) *.* errorNormalizeV 42 (vNormal (a -.- b)) + n a b = (t*0.5) *.* safeNormalizeV (vNormal (a -.- b)) thickCircle :: Float -> Float -> Picture {-# INLINE thickCircle #-} diff --git a/src/Shader.hs b/src/Shader.hs index c96fd7f55..21ebc9152 100644 --- a/src/Shader.hs +++ b/src/Shader.hs @@ -19,7 +19,7 @@ import Control.Monad import Graphics.Rendering.OpenGL hiding (Point,translate,scale,imageHeight) import Graphics.GL.Core43 import qualified Data.IntMap.Strict as IM -import Data.Bifunctor +--import Data.Bifunctor --import Text.RawString.QQ --import Linear.Matrix --import Linear.V4 diff --git a/src/Shader/Poke.hs b/src/Shader/Poke.hs index 2bc92092c..8f94187da 100644 --- a/src/Shader/Poke.hs +++ b/src/Shader/Poke.hs @@ -10,8 +10,8 @@ import Shader.Data import Shader.Parameters import Picture.Data -import Data.Maybe -import Data.List +--import Data.Maybe +--import Data.List import Foreign import Control.Monad import qualified Control.Foldl as F @@ -35,15 +35,16 @@ pokeVertices -> IO Int pokeVertices toFs ptr stride n rt = foldM (pokeVertex ptr stride) n (toFs rt) -getterPicShad :: VertexType -> Getting a (PicShads a) a -getterPicShad PolyV = psPoly -getterPicShad PolyzV{} = psPolyz -getterPicShad BezV{} = psBez -getterPicShad TextV{} = psText -getterPicShad ArcV{} = psArc -getterPicShad EllV = psEll +getterPicShad :: VertexType -> PicShads a -> a +--{-# INLINE getterPicShad #-} +getterPicShad PolyV = _psPoly +getterPicShad PolyzV{} = _psPolyz +getterPicShad BezV{} = _psBez +getterPicShad TextV{} = _psText +getterPicShad ArcV{} = _psArc +getterPicShad EllV = _psEll ---setterPicShad :: VertexType -> ASetter +setterPicShad :: VertexType -> ASetter (PicShads a) (PicShads a) a a setterPicShad PolyV = psPoly setterPicShad PolyzV{} = psPolyz setterPicShad BezV{} = psBez @@ -55,8 +56,8 @@ pokeVX' :: PicShads VShader -> PicShads Int -> Verx -> IO (PicShads Int) pokeVX' shads count vx = do let f = setterPicShad (_vxType vx) g = getterPicShad (_vxType vx) - vshad = shads ^. g - n = count ^. g + vshad = g shads + n = g count theVBO = _vaoVBO $ _vshaderVAO vshad ptr = _vboPointer theVBO stride = _vboStride theVBO @@ -69,8 +70,8 @@ pokeVX shads laycounts vx = do offset = _vxLayer vx counts = laycounts IM.! offset getF = getterPicShad theType - vshad = shads ^. getF - n = counts ^. getF + vshad = getF shads + n = getF counts theVBO = _vaoVBO $ _vshaderVAO vshad ptr = _vboPointer theVBO stride = _vboStride theVBO