more pixelize
This commit is contained in:
parent
910a0ab4f8
commit
ea1ef7fbe3
1 changed files with 16 additions and 0 deletions
16
src/Main.hs
16
src/Main.hs
|
@ -130,6 +130,7 @@ load _ = do
|
||||||
, shots = ParticleSystem (ParticleStorage Nothing []) pnop buffer
|
, shots = ParticleSystem (ParticleStorage Nothing []) pnop buffer
|
||||||
, haskelloids = hs
|
, haskelloids = hs
|
||||||
, wonlost = False
|
, wonlost = False
|
||||||
|
, pixelSize = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
data UserData = UserData
|
data UserData = UserData
|
||||||
|
@ -140,6 +141,7 @@ data UserData = UserData
|
||||||
, shots :: ParticleSystem
|
, shots :: ParticleSystem
|
||||||
-- , debris :: ParticleSystem
|
-- , debris :: ParticleSystem
|
||||||
, wonlost :: Bool
|
, wonlost :: Bool
|
||||||
|
, pixelSize :: Int
|
||||||
}
|
}
|
||||||
|
|
||||||
data Ship = Ship
|
data Ship = Ship
|
||||||
|
@ -181,6 +183,15 @@ update sec = do
|
||||||
ad <- get
|
ad <- get
|
||||||
evs <- SDL.pollEvents
|
evs <- SDL.pollEvents
|
||||||
wd <- getAffection
|
wd <- getAffection
|
||||||
|
when (((floor $ elapsedTime ad) * 100) `mod` 10 < 2 && pixelSize wd > 3) $ do
|
||||||
|
liftIO $ gegl_node_set (nodeGraph wd M.! KeyPixelize) $ Operation "gegl:pixelize"
|
||||||
|
[ Property "size-x" $ PropertyInt $ pixelSize wd - 1
|
||||||
|
, Property "size-y" $ PropertyInt $ pixelSize wd - 1
|
||||||
|
]
|
||||||
|
pd <- getAffection
|
||||||
|
putAffection pd
|
||||||
|
{ pixelSize = pixelSize wd -1
|
||||||
|
}
|
||||||
mapM_ (\e ->
|
mapM_ (\e ->
|
||||||
case SDL.eventPayload e of
|
case SDL.eventPayload e of
|
||||||
SDL.KeyboardEvent dat ->
|
SDL.KeyboardEvent dat ->
|
||||||
|
@ -215,6 +226,10 @@ update sec = do
|
||||||
SDL.KeycodeSpace ->
|
SDL.KeycodeSpace ->
|
||||||
when (SDL.keyboardEventKeyMotion dat == SDL.Pressed && not (wonlost wd)) $ do
|
when (SDL.keyboardEventKeyMotion dat == SDL.Pressed && not (wonlost wd)) $ do
|
||||||
ud <- getAffection
|
ud <- getAffection
|
||||||
|
liftIO $ gegl_node_set (nodeGraph ud M.! KeyPixelize) $ Operation "gegl:pixelize"
|
||||||
|
[ Property "size-x" $ PropertyInt 8
|
||||||
|
, Property "size-y" $ PropertyInt 8
|
||||||
|
]
|
||||||
-- ad <- get
|
-- ad <- get
|
||||||
let posX = (fst $ sPos $ ship ud) + 23 - 30 * sin (toR $ sRot $ ship ud)
|
let posX = (fst $ sPos $ ship ud) + 23 - 30 * sin (toR $ sRot $ ship ud)
|
||||||
posY = (snd $ sPos $ ship ud) + 23 - 30 * cos (toR $ sRot $ ship ud)
|
posY = (snd $ sPos $ ship ud) + 23 - 30 * cos (toR $ sRot $ ship ud)
|
||||||
|
@ -252,6 +267,7 @@ update sec = do
|
||||||
}
|
}
|
||||||
putAffection $ ud
|
putAffection $ ud
|
||||||
{ shots = ips
|
{ shots = ips
|
||||||
|
, pixelSize = 8
|
||||||
}
|
}
|
||||||
_ -> return ()
|
_ -> return ()
|
||||||
SDL.WindowClosedEvent _ -> do
|
SDL.WindowClosedEvent _ -> do
|
||||||
|
|
Loading…
Reference in a new issue