This commit is contained in:
nek0 2016-12-11 20:35:18 +01:00
parent cb158f1b2b
commit 8820a6095f
1 changed files with 1 additions and 23 deletions

View File

@ -7,7 +7,6 @@ import qualified GEGL as G
import qualified BABL as B
import qualified Data.Map.Strict as M
import Foreign.Ptr (castPtr)
import Foreign.Storable (peek)
import Foreign.C.Types
@ -40,7 +39,7 @@ data Particle = Particle
}
load :: SDL.Surface -> IO UserData
load surface = do
load _ = do
traceM "loading"
root <- G.gegl_node_new
traceM "new root node"
@ -49,9 +48,6 @@ load surface = do
, G.Property "color2" $ G.PropertyColor $ G.RGBA 0.6 0.6 0.6 1
]
traceM "checkerboard"
let SDL.Surface rawSurfacePtr _ = surface
-- display <- G.gegl_node_new_child root $ G.Operation "dodo:sdl-surface" $
-- [ G.Property "surface" $ G.PropertyPointer $ castPtr rawSurfacePtr ]
over <- G.gegl_node_new_child root G.defaultOverOperation
traceM "over"
buffer <- G.gegl_buffer_new (G.GeglRectangle 0 0 800 600) =<<
@ -66,11 +62,9 @@ load surface = do
myMap <- return $ M.fromList
[ ("root" , root)
, ("over" , over)
-- , ("display" , display)
, ("background" , checkerboard)
, ("foreground" , bufsrc)
]
let roi = G.GeglRectangle 0 0 20 20
traceM "loading complete"
return $ UserData
{ nodeGraph = myMap
@ -89,12 +83,7 @@ draw = do
traceM "drawing"
AffectionData{..} <- get
let UserData{..} = userState
-- liftIO $ SDL.lockSurface drawSurface
-- pixels <- liftIO $ SDL.surfacePixels drawSurface
let SDL.Surface rawSurfacePtr _ = drawSurface
rawSurface <- liftIO $ peek rawSurfacePtr
pixelFormat <- liftIO $ peek $ Raw.surfaceFormat rawSurface
format <- liftIO $ (B.babl_format $ B.PixelFormat B.RGBA B.CFu8)
SDL.V2 (CInt rw) (CInt rh) <- SDL.surfaceDimensions drawSurface
let (w, h) = (fromIntegral rw, fromIntegral rh)
liftIO $ clearArea foreground (GeglRectangle 0 0 w h)
@ -106,17 +95,6 @@ draw = do
(Line 7)
(G.GeglRectangle (x - 10) (y - 10) 20 20)
) coordinates
-- liftIO $ G.gegl_node_process $ nodeGraph M.! "display"
-- liftIO $ G.gegl_node_blit
-- (nodeGraph M.! "over" :: G.GeglNode)
-- 1
-- (G.GeglRectangle 0 0 w h)
-- format
-- pixels
-- (fromIntegral (Raw.pixelFormatBytesPerPixel pixelFormat) * w)
-- [G.GeglBlitDefault]
-- liftIO $ SDL.unlockSurface drawSurface
-- liftIO $ SDL.updateWindowSurface drawWindow
update :: Double -> AffectionState (AffectionData UserData) IO ()
update sec = do