Skip to content

Commit

Permalink
animation and simulation code can be re-used
Browse files Browse the repository at this point in the history
...once interaction is implemented.
  • Loading branch information
nomeata committed Aug 9, 2016
1 parent 021da99 commit 990be94
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions codeworld-api/src/CodeWorld/Driver.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import Control.Monad.Trans (liftIO)
import CodeWorld.Color
import Data.Monoid
import Data.List (zip4)
import Numeric

#ifdef ghcjs_HOST_OS

Expand All @@ -65,7 +66,6 @@ import GHCJS.Types
import JavaScript.Web.AnimationFrame
import qualified JavaScript.Web.Canvas as Canvas
import qualified JavaScript.Web.Canvas.Internal as Canvas
import Numeric
import System.IO.Unsafe
import System.Random

Expand Down Expand Up @@ -536,6 +536,8 @@ interactionOf initial step event draw = go `catch` reportError

--------------------------------------------------------------------------------

#endif

data Wrapped a = Wrapped {
state :: a,
paused :: Bool,
Expand Down Expand Up @@ -682,7 +684,7 @@ simulationOf simInitial simStep simDraw =
mouseMovedTime = 1000
}

#else
#ifndef ghcjs_HOST_OS

trace :: Text -> a -> a
trace = undefined
Expand Down Expand Up @@ -847,14 +849,6 @@ display pic = Canvas.blankCanvas 3000 $ \context -> do
setupScreenContext rect
drawFrame pic

animationOf :: (Double -> Picture) -> IO ()
animationOf pic = putStrLn "<<animation>>"

simulationOf :: world
-> (Double -> world -> world)
-> (world -> Picture)
-> IO ()
simulationOf _ _ _ = putStrLn "<<simulation>>"

interactionOf :: world
-> (Double -> world -> world)
Expand Down

0 comments on commit 990be94

Please sign in to comment.