cleaning
This commit is contained in:
parent
cb158f1b2b
commit
8820a6095f
1 changed files with 1 additions and 23 deletions
|
@ -7,7 +7,6 @@ import qualified GEGL as G
|
||||||
import qualified BABL as B
|
import qualified BABL as B
|
||||||
import qualified Data.Map.Strict as M
|
import qualified Data.Map.Strict as M
|
||||||
|
|
||||||
import Foreign.Ptr (castPtr)
|
|
||||||
import Foreign.Storable (peek)
|
import Foreign.Storable (peek)
|
||||||
import Foreign.C.Types
|
import Foreign.C.Types
|
||||||
|
|
||||||
|
@ -40,7 +39,7 @@ data Particle = Particle
|
||||||
}
|
}
|
||||||
|
|
||||||
load :: SDL.Surface -> IO UserData
|
load :: SDL.Surface -> IO UserData
|
||||||
load surface = do
|
load _ = do
|
||||||
traceM "loading"
|
traceM "loading"
|
||||||
root <- G.gegl_node_new
|
root <- G.gegl_node_new
|
||||||
traceM "new root node"
|
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
|
, G.Property "color2" $ G.PropertyColor $ G.RGBA 0.6 0.6 0.6 1
|
||||||
]
|
]
|
||||||
traceM "checkerboard"
|
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
|
over <- G.gegl_node_new_child root G.defaultOverOperation
|
||||||
traceM "over"
|
traceM "over"
|
||||||
buffer <- G.gegl_buffer_new (G.GeglRectangle 0 0 800 600) =<<
|
buffer <- G.gegl_buffer_new (G.GeglRectangle 0 0 800 600) =<<
|
||||||
|
@ -66,11 +62,9 @@ load surface = do
|
||||||
myMap <- return $ M.fromList
|
myMap <- return $ M.fromList
|
||||||
[ ("root" , root)
|
[ ("root" , root)
|
||||||
, ("over" , over)
|
, ("over" , over)
|
||||||
-- , ("display" , display)
|
|
||||||
, ("background" , checkerboard)
|
, ("background" , checkerboard)
|
||||||
, ("foreground" , bufsrc)
|
, ("foreground" , bufsrc)
|
||||||
]
|
]
|
||||||
let roi = G.GeglRectangle 0 0 20 20
|
|
||||||
traceM "loading complete"
|
traceM "loading complete"
|
||||||
return $ UserData
|
return $ UserData
|
||||||
{ nodeGraph = myMap
|
{ nodeGraph = myMap
|
||||||
|
@ -89,12 +83,7 @@ draw = do
|
||||||
traceM "drawing"
|
traceM "drawing"
|
||||||
AffectionData{..} <- get
|
AffectionData{..} <- get
|
||||||
let UserData{..} = userState
|
let UserData{..} = userState
|
||||||
-- liftIO $ SDL.lockSurface drawSurface
|
|
||||||
-- pixels <- liftIO $ SDL.surfacePixels drawSurface
|
|
||||||
let SDL.Surface rawSurfacePtr _ = 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
|
SDL.V2 (CInt rw) (CInt rh) <- SDL.surfaceDimensions drawSurface
|
||||||
let (w, h) = (fromIntegral rw, fromIntegral rh)
|
let (w, h) = (fromIntegral rw, fromIntegral rh)
|
||||||
liftIO $ clearArea foreground (GeglRectangle 0 0 w h)
|
liftIO $ clearArea foreground (GeglRectangle 0 0 w h)
|
||||||
|
@ -106,17 +95,6 @@ draw = do
|
||||||
(Line 7)
|
(Line 7)
|
||||||
(G.GeglRectangle (x - 10) (y - 10) 20 20)
|
(G.GeglRectangle (x - 10) (y - 10) 20 20)
|
||||||
) coordinates
|
) 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 :: Double -> AffectionState (AffectionData UserData) IO ()
|
||||||
update sec = do
|
update sec = do
|
||||||
|
|
Loading…
Reference in a new issue