From 8820a6095fbfaba72e5b2930025ed54323d29c16 Mon Sep 17 00:00:00 2001 From: nek0 Date: Sun, 11 Dec 2016 20:35:18 +0100 Subject: [PATCH] cleaning --- examples/example02.hs | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/examples/example02.hs b/examples/example02.hs index 4176d35..b3f18ec 100644 --- a/examples/example02.hs +++ b/examples/example02.hs @@ -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