Created
September 16, 2014 09:18
-
-
Save fumieval/ff255f122c9516c052bc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE Rank2Types #-} | |
import FreeGame | |
import FreeGame.Class | |
import Debug.Trace | |
import FreeGame.Component | |
import FreeGame.Component.Deck | |
meter deck = oneshot $ \(PullGraphic _ cont) -> do | |
let s x = (10 + max (log x / log 10) (-10)) / 10 | |
V2 a b <- fmap (fmap s) $ deck .- RMS 1024 | |
cont $ Picture $ translate (V2 0 240) $ do | |
color black $ do | |
polygonOutline [V2 0 0, V2 40 0, V2 40 (-240), V2 0 (-240)] | |
color red $ do | |
polygonOutline [V2 0 0, V2 16 0, V2 16 (-a * 240), V2 0 (-a * 240)] | |
polygonOutline [V2 24 0, V2 40 0, V2 40 (-b * 240), V2 24 (-b * 240)] | |
main = runGame Windowed (Box (V2 0 0) (V2 240 480)) $ do | |
deck <- invoke emptyDeck | |
connectAudio deck | |
invoke (meter deck) >>= connectGraphic | |
src <- liftIO $ readSound "Monoidal Purity.wav" | |
deck .- Load src | |
deck .- Play | |
stand |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment