more canvas size
This commit is contained in:
parent
0d48565c85
commit
4c7918d9df
3 changed files with 22 additions and 13 deletions
|
@ -108,6 +108,7 @@ draw = do
|
|||
}
|
||||
process (nodeGraph M.! "sink")
|
||||
present (GeglRectangle 0 0 800 600) foreground True
|
||||
render Nothing Nothing
|
||||
|
||||
update :: Double -> Affection UserData ()
|
||||
update dt = do
|
||||
|
|
|
@ -100,6 +100,7 @@ draw = do
|
|||
(G.GeglRectangle 0 0 800 600)
|
||||
foreground
|
||||
True
|
||||
render Nothing Nothing
|
||||
|
||||
update :: Double -> Affection UserData ()
|
||||
update dt = do
|
||||
|
|
|
@ -78,19 +78,24 @@ withAffection AffectionConfig{..} = do
|
|||
renderer
|
||||
SDL.ABGR8888
|
||||
SDL.TextureAccessStreaming
|
||||
(SDL.windowInitialSize windowConfig)
|
||||
(case canvasSize of
|
||||
Just (cw, ch) -> (SDL.V2
|
||||
(CInt $ fromIntegral cw)
|
||||
(CInt $ fromIntegral ch)
|
||||
)
|
||||
Nothing ->
|
||||
SDL.windowInitialSize windowConfig
|
||||
)
|
||||
-- make draw surface
|
||||
surface <- SDL.createRGBSurface
|
||||
(SDL.windowInitialSize windowConfig)
|
||||
SDL.ABGR8888
|
||||
let (SDL.Surface ptr _) = surface
|
||||
pixelFormat <- liftIO $ peek . Raw.surfaceFormat =<< peek ptr
|
||||
SDL.V2 (CInt rw) (CInt rh) <- liftIO $ SDL.surfaceDimensions surface
|
||||
let (w, h) = (fromIntegral rw, fromIntegral rh)
|
||||
stride = fromIntegral (Raw.pixelFormatBytesPerPixel pixelFormat) * w
|
||||
pixels <- SDL.surfacePixels surface
|
||||
let bablFormat = B.PixelFormat B.RGBA B.CFu8
|
||||
-- pixelFormat <- liftIO $ peek . Raw.surfaceFormat =<< peek ptr
|
||||
let SDL.V2 (CInt rw) (CInt rh) = windowInitialSize windowConfig
|
||||
(w, h) = case canvasSize of
|
||||
Just (cw, ch) -> (cw, ch)
|
||||
Nothing -> (fromIntegral rw, fromIntegral rh)
|
||||
-- stride = fromIntegral (Raw.pixelFormatBytesPerPixel pixelFormat) * w
|
||||
bablFormat = B.PixelFormat B.RGBA B.CFu8
|
||||
cpp = B.babl_components_per_pixel bablFormat
|
||||
!stride = cpp * w
|
||||
format <- B.babl_format bablFormat
|
||||
initContainer <- (\x -> AffectionData
|
||||
{ quitEvent = False
|
||||
|
@ -100,8 +105,10 @@ withAffection AffectionConfig{..} = do
|
|||
-- , drawSurface = surface
|
||||
, drawTexture = texture
|
||||
, drawFormat = format
|
||||
, drawPixels = pixels
|
||||
, drawDimensions = (w, h)
|
||||
-- , drawPixels = pixels
|
||||
, drawDimensions = case canvasSize of
|
||||
Just (cw, ch) -> (cw, ch)
|
||||
Nothing -> (w, h)
|
||||
, drawStride = stride
|
||||
, drawCPP = cpp
|
||||
, drawStack = []
|
||||
|
|
Loading…
Reference in a new issue