Add depth clear/check to fixed layer pictures

This commit is contained in:
2024-11-17 20:01:17 +00:00
parent d5be125a3b
commit afddcae6d1
7 changed files with 185 additions and 207 deletions
+3 -2
View File
@@ -367,15 +367,16 @@ doDrawing' win pdata u = do
-- draw the overlay
--glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboOverlay ._1 . unFBO)
glDepthFunc GL_ALWAYS
--glDepthFunc GL_GEQUAL
glDepthMask GL_FALSE
--glDepthMask GL_TRUE
glEnable GL_BLEND
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
renderLayer DebugLayer shadV pokeCounts
glBindBufferBase GL_UNIFORM_BUFFER 0 (pdata ^. matUBO)
withArray (scaleMatrix (2 / windowXFloat cfig) (2 / windowYFloat cfig))
$ \ptr -> glNamedBufferSubData (pdata ^. matUBO) 0 64 ptr
glDepthFunc GL_GEQUAL
glDepthMask GL_TRUE
with (-1) $ \ptr -> glClearNamedFramebufferfv 0 GL_DEPTH 0 ptr
renderLayer FixedCoordLayer shadV pokeCounts
SDL.glSwapWindow win
-2
View File
@@ -2,8 +2,6 @@
module Dodge.Render.HUD (
drawHUD,
selNumPos, -- this shoud probably be pushed back here
selNumPosCardinal, -- this shoud probably be pushed back here
) where
import Control.Applicative
+18 -13
View File
@@ -1,4 +1,5 @@
{-# LANGUAGE LambdaCase #-}
module Dodge.Render.List (
renderListAt,
drawList,
@@ -17,13 +18,13 @@ module Dodge.Render.List (
drawCursorAt,
) where
import Dodge.ListDisplayParams
import qualified Data.IntMap.Strict as IM
import Data.Maybe
import Dodge.Base.Window
import Dodge.Data.CardinalPoint
import Dodge.Data.Config
import Dodge.Data.SelectionList
import Dodge.ListDisplayParams
import Dodge.ScreenPos
import Dodge.SelectionSections
import Geometry
@@ -39,22 +40,24 @@ drawSelectionList ldps cfig sl =
(ldps ^. ldpScale)
0
(makeSelectionListPictures sl)
-- <> drawCursorAt
-- (sl ^. slSelPos)
-- (sl ^. slItems)
-- ldps
-- (BoundaryCursor [North, South])
drawTitleBackground :: Configuration -> Picture
drawTitleBackground cfig =
translateScreenPos cfig (fromTopLeft (V2 (subInvX - 5) 75))
. polygon . reverse $ rectNSWE 70 0 0 560
. polygon
. reverse
$ rectNSWE 70 0 0 560
drawSelectionListBackground :: ListDisplayParams -> Configuration ->
Int -- list length
-> Picture
drawSelectionListBackground ldp cfig l = translateScreenPos cfig (ldp ^. ldpPos) .
polygon . reverse $ rectNSWE 5 s (-5) e
drawSelectionListBackground ::
ListDisplayParams ->
Configuration ->
Int -> -- list length
Picture
drawSelectionListBackground ldp cfig l =
translateScreenPos cfig (ldp ^. ldpPos)
. polygon
. reverse
$ rectNSWE 5 s (-5) e
where
s = - (5 + fromIntegral l * (20 * ldp ^. ldpScale + ldp ^. ldpVerticalGap))
e = 555 -- HACK isOverTerminalScreen
@@ -191,7 +194,9 @@ drawListElement ygap s xint yint =
. scale (s * 0.1) (s * 0.1)
renderListAt :: Float -> Float -> [(String, Color)] -> Picture
renderListAt tx ty = translate tx (- ty) . drawList . map (\(str, col) -> color col $ text str)
renderListAt tx ty = translate tx (- ty)
. drawList
. map (\(str, col) -> color col $ text str)
--inverseText :: String -> Color -> Picture
--inverseText str col =
+1
View File
@@ -74,6 +74,7 @@ drawMouseCursor :: Universe -> Picture
drawMouseCursor u =
uncurryV translate (u ^. uvWorld . input . mousePos)
. color white
. setDepth 1
$ mouseCursorType u
mouseCursorType :: Universe -> Picture
+1 -19
View File
@@ -37,14 +37,13 @@ doInputScreenInput s u =
| ispressed ScancodeEscape = uvScreenLayers %~ tail
| otherwise = id
-- note mouse over handled by updateMouseContext
optionScreenUpdate :: Universe -> Universe
optionScreenUpdate u =
(uvScreenLayers . ix 0 . scDisplayTime +~ 1)
. refreshOptionsSelectionList
-- . mouseOverSelectionList
. optionScreenDefaultEffect
. mouseClickOptionsList
-- . menuWheelEvents
. over (uvScreenLayers . _head) (setSelectionListRestriction (u ^. uvConfig))
$ u
@@ -71,23 +70,6 @@ mouseClickOptionsList u = fromMaybe u $ do
return $ f u
_ -> u
--mouseOverSelectionList :: Universe -> Universe
--mouseOverSelectionList u = fromMaybe u $ do
-- screen <- u ^? uvScreenLayers . ix 0
-- ldps <- screen ^? scListDisplayParams
-- let ymax = maybe 0 length $ screen ^? scSelectionList . slItems
-- yi <- ldpVerticalSelection (u ^. uvConfig) ldps (u ^. uvWorld . input . mousePos)
-- guard $ mmoving || (_scDisplayTime screen <= 1)
-- let myi = do
-- guard (yi >= 0 && yi < ymax && isselectable yi)
-- return yi
-- return $ u & uvScreenLayers . _head . scSelectionList . slSelPos .~ myi
-- where
-- isselectable yi =
-- fromMaybe False $
-- u ^? uvScreenLayers . _head . scSelectionList . slItems . ix yi . siIsSelectable
-- mmoving = u ^. uvWorld . input . mouseMoving
ldpVerticalSelection :: Configuration -> ListDisplayParams -> Point2 -> Maybe Int
ldpVerticalSelection cfig ldp (V2 _ y)
| yupper == ylower = Just yupper