diff --git a/gloss-examples/gloss-examples.cabal b/gloss-examples/gloss-examples.cabal index d603c4a..185c2de 100644 --- a/gloss-examples/gloss-examples.cabal +++ b/gloss-examples/gloss-examples.cabal @@ -1,5 +1,5 @@ Name: gloss-examples -Version: 1.8.2.1 +Version: 1.9.1.1 License: MIT License-file: LICENSE Author: Ben Lippmeier @@ -26,7 +26,7 @@ Executable gloss-bitmap base == 4.7.*, bytestring == 0.10.*, bmp == 1.2.*, - gloss == 1.8.2.* + gloss == 1.9.1.* Main-is: Main.hs hs-source-dirs: picture/Bitmap ghc-options: -threaded -O2 @@ -35,7 +35,7 @@ Executable gloss-bitmap Executable gloss-boids Build-depends: base == 4.7.*, - gloss == 1.8.2.* + gloss == 1.9.1.* Main-is: Main.hs other-modules: KDTree2d Vec2 hs-source-dirs: picture/Boids @@ -45,7 +45,7 @@ Executable gloss-boids Executable gloss-clock Build-depends: base == 4.7.*, - gloss == 1.8.2.* + gloss == 1.9.1.* Main-is: Main.hs hs-source-dirs: picture/Clock ghc-options: -threaded -O2 @@ -55,7 +55,7 @@ Executable gloss-conway Build-depends: base == 4.7.*, vector == 0.10.*, - gloss == 1.8.2.* + gloss == 1.9.1.* Main-is: Main.hs other-modules: Cell World hs-source-dirs: picture/Conway @@ -64,8 +64,8 @@ Executable gloss-conway Executable gloss-draw Build-depends: - base == 4.7.*, - gloss == 1.8.2.* + base == 4.7.*, + gloss == 1.9.1.* Main-is: Main.hs hs-source-dirs: picture/Draw ghc-options: -threaded -O2 @@ -74,7 +74,7 @@ Executable gloss-draw Executable gloss-easy Build-depends: base == 4.7.*, - gloss == 1.8.2.* + gloss == 1.9.1.* Main-is: Main.hs hs-source-dirs: picture/Easy ghc-options: -threaded -O2 @@ -83,8 +83,8 @@ Executable gloss-easy Executable gloss-eden Build-depends: base == 4.7.*, - random == 1.0.*, - gloss == 1.8.2.* + random == 1.1.*, + gloss == 1.9.1.* Main-is: Main.hs other-modules: Cell Community World hs-source-dirs: picture/Eden @@ -94,7 +94,7 @@ Executable gloss-eden Executable gloss-flake Build-depends: base == 4.7.*, - gloss == 1.8.2.* + gloss == 1.9.1.* Main-is: Main.hs hs-source-dirs: picture/Flake ghc-options: -threaded -O2 @@ -103,7 +103,7 @@ Executable gloss-flake Executable gloss-gameevent Build-depends: base == 4.7.*, - gloss == 1.8.2.* + gloss == 1.9.1.* Main-is: Main.hs hs-source-dirs: picture/GameEvent ghc-options: -threaded -O2 @@ -112,7 +112,7 @@ Executable gloss-gameevent Executable gloss-hello Build-depends: base == 4.7.*, - gloss == 1.8.2.* + gloss == 1.9.1.* Main-is: Main.hs hs-source-dirs: picture/Hello ghc-options: -threaded -O2 @@ -121,8 +121,8 @@ Executable gloss-hello Executable gloss-lifespan Build-depends: base == 4.7.*, - gloss == 1.8.2.*, - random == 1.0.* + gloss == 1.9.1.*, + random == 1.1.* Main-is: Main.hs other-modules: Cell Community World hs-source-dirs: picture/Lifespan @@ -132,7 +132,7 @@ Executable gloss-lifespan Executable gloss-machina Build-depends: base == 4.7.*, - gloss == 1.8.2.* + gloss == 1.9.1.* Main-is: Main.hs hs-source-dirs: picture/Machina ghc-options: -threaded -O2 @@ -141,8 +141,8 @@ Executable gloss-machina Executable gloss-occlusion Build-depends: base == 4.7.*, - gloss == 1.8.2.*, - gloss-rendering + gloss == 1.9.1.*, + gloss-rendering == 1.9.1.* Main-is: Main.hs other-modules: Cell World State Data hs-source-dirs: picture/Occlusion @@ -154,7 +154,7 @@ Executable gloss-styrene base == 4.7.*, ghc-prim == 0.3.*, containers == 0.5.*, - gloss == 1.8.2.* + gloss == 1.9.1.* Main-is: Main.hs other-modules: Actor Advance Collide Config Contact QuadTree World hs-source-dirs: picture/Styrene @@ -164,7 +164,7 @@ Executable gloss-styrene Executable gloss-tree Build-depends: base == 4.7.*, - gloss == 1.8.2.* + gloss == 1.9.1.* Main-is: Main.hs hs-source-dirs: picture/Tree ghc-options: -threaded -O2 @@ -174,7 +174,7 @@ Executable gloss-visibility Build-depends: base == 4.7.*, vector == 0.10.*, - gloss == 1.8.2.* + gloss == 1.9.1.* Main-is: Main.hs other-modules: Draw Interface State World Geometry.Randomish Geometry.Segment hs-source-dirs: picture/Visibility @@ -184,7 +184,7 @@ Executable gloss-visibility Executable gloss-zen Build-depends: base == 4.7.*, - gloss == 1.8.2.* + gloss == 1.9.1.* Main-is: Main.hs hs-source-dirs: picture/Zen ghc-options: -threaded -O2 @@ -192,9 +192,9 @@ Executable gloss-zen Executable gloss-crystal Build-depends: - base == 4.7.*, - gloss == 1.8.2.*, - gloss-raster == 1.8.2.* + base == 4.7.*, + gloss == 1.9.1.*, + gloss-raster == 1.9.1.* Main-is: Main.hs hs-source-dirs: raster/Crystal ghc-options: @@ -211,8 +211,8 @@ Executable gloss-crystal Executable gloss-ray Build-depends: base == 4.7.*, - gloss == 1.8.2.*, - gloss-raster == 1.8.2.* + gloss == 1.9.1.*, + gloss-raster == 1.9.1.* Main-is: Main.hs other-modules: Light Object Trace Vec3 World hs-source-dirs: raster/Ray @@ -227,8 +227,8 @@ Executable gloss-ray Executable gloss-pulse Build-depends: base == 4.7.*, - gloss == 1.8.2.*, - gloss-raster == 1.8.2.* + gloss == 1.9.1.*, + gloss-raster == 1.9.1.* Main-is: Main.hs hs-source-dirs: raster/Pulse ghc-options: @@ -244,8 +244,8 @@ Executable gloss-wave base == 4.7.*, ghc-prim == 0.3.*, vector == 0.10.*, - gloss == 1.8.2.*, - gloss-raster == 1.8.2.* + gloss == 1.9.1.*, + gloss-raster == 1.9.1.* Main-is: Main.hs hs-source-dirs: raster/Wave ghc-options: @@ -260,10 +260,10 @@ Executable gloss-fluid base == 4.7.*, ghc-prim == 0.3.*, vector == 0.10.*, - repa == 3.2.*, - repa-io == 3.2.*, - repa-algorithms == 3.2.*, - gloss == 1.8.2.* + repa == 3.3.*, + repa-io == 3.3.*, + repa-algorithms == 3.3.*, + gloss == 1.9.1.* Main-is: Main.hs other-modules: Args Config FieldElt Model UserEvent @@ -284,8 +284,8 @@ Executable gloss-fluid Executable gloss-snow Build-depends: base == 4.7.*, - repa == 3.2.*, - gloss == 1.8.2.* + repa == 3.3.*, + gloss == 1.9.1.* Main-is: Main.hs hs-source-dirs: raster/Snow ghc-options: @@ -299,8 +299,8 @@ Executable gloss-snow Executable gloss-mandel Build-depends: base == 4.7.*, - repa == 3.2.*, - gloss == 1.8.2.* + repa == 3.3.*, + gloss == 1.9.1.* Main-is: Main.hs other-modules: Solver hs-source-dirs: raster/Mandel @@ -318,7 +318,7 @@ Executable gloss-graph Build-depends: base == 4.7.*, containers == 0.5.*, - gloss == 1.8.2.* + gloss == 1.9.1.* Main-is: Main.hs hs-source-dirs: picture/Graph ghc-options: @@ -328,9 +328,10 @@ Executable gloss-render Build-depends: base == 4.7.*, containers == 0.5.*, - GLFW-b, - gloss + gloss == 1.9.1.*, + GLFW-b Main-is: Main.hs hs-source-dirs: picture/Render ghc-options: -Wall -O2 + diff --git a/gloss-examples/picture/Render/Main.hs b/gloss-examples/picture/Render/Main.hs index 9549393..51f0df4 100644 --- a/gloss-examples/picture/Render/Main.hs +++ b/gloss-examples/picture/Render/Main.hs @@ -2,22 +2,29 @@ import "GLFW-b" Graphics.UI.GLFW as GLFW import Control.Concurrent (threadDelay) import Control.Monad (when, unless) - +import Graphics.Gloss.Render import Graphics.Gloss + main :: IO () main = do let width = 200 height = 200 + + state <- stateInit + withWindow width height "Render" $ \win -> do - loop win (width, height) - where loop window (w, h) = do + loop state win (width, height) + + + where loop state window (w, h) = do threadDelay 20000 pollEvents - render (w, h) white (Circle 80) + render state (w, h) white (Circle 80) swapBuffers window k <- keyIsPressed window Key'Escape - unless k $ loop window (w, h) + unless k $ loop state window (w, h) + withWindow :: Int -> Int -> String -> (GLFW.Window -> IO ()) -> IO () withWindow width height title f = do @@ -37,9 +44,11 @@ withWindow width height title f = do simpleErrorCallback e s = putStrLn $ unwords [show e, show s] + keyIsPressed :: Window -> Key -> IO Bool keyIsPressed win key = isPress `fmap` GLFW.getKey win key + isPress :: KeyState -> Bool isPress KeyState'Pressed = True isPress KeyState'Repeating = True diff --git a/gloss-raster/gloss-raster.cabal b/gloss-raster/gloss-raster.cabal index 84d9606..240d3c8 100644 --- a/gloss-raster/gloss-raster.cabal +++ b/gloss-raster/gloss-raster.cabal @@ -1,5 +1,5 @@ Name: gloss-raster -Version: 1.8.2.1 +Version: 1.9.1.1 License: MIT License-file: LICENSE Author: Ben Lippmeier @@ -25,9 +25,9 @@ Library base == 4.7.*, ghc-prim == 0.3.*, containers == 0.5.*, - repa == 3.2.*, - gloss == 1.8.2.*, - gloss-rendering + repa == 3.3.*, + gloss == 1.9.1.*, + gloss-rendering == 1.9.1.* ghc-options: -Odph -fno-liberate-case diff --git a/gloss/Graphics/Gloss.hs b/gloss/Graphics/Gloss.hs index 00f7226..ccb5e17 100644 --- a/gloss/Graphics/Gloss.hs +++ b/gloss/Graphics/Gloss.hs @@ -72,13 +72,11 @@ module Graphics.Gloss , display , animate , simulate - , play - , render) + , play) where import Graphics.Gloss.Data.Display import Graphics.Gloss.Data.Picture import Graphics.Gloss.Data.Color -import Graphics.Gloss.Render import Graphics.Gloss.Interface.Pure.Display import Graphics.Gloss.Interface.Pure.Animate import Graphics.Gloss.Interface.Pure.Simulate