packages feed

gloss-examples 1.5.0.1 → 1.6.0.1

raw patch · 18 files changed

+179/−201 lines, 18 filesdep ~bmpdep ~gloss

Dependency ranges changed: bmp, gloss

Files

Bitmap/Main.hs view
@@ -16,9 +16,12 @@  = do	picture@(Bitmap width height _ _)                 <- loadBMP fileName -	displayInWindow-		fileName-		(width, height)-      		(10,  10)-      		white-      		picture+	animate (InWindow fileName (width, height) (10,  10))+                black (frame width height picture)++frame :: Int -> Int -> Picture -> Float -> Picture+frame width height picture t+        = Color (greyN (abs $ sin (t * 2)))+        $ Pictures +                [rectangleSolid (fromIntegral width) (fromIntegral height)+                , picture]
Boids/Main.hs view
@@ -13,6 +13,7 @@ import Graphics.Gloss.Data.Picture import Graphics.Gloss.Interface.Simulate + -- Parameters ----------------------------------------------------------------- cParam  = 0.0075 @@ -68,15 +69,8 @@         let bs  = initialize 500 10.0 0.5         let t   = foldl (\t b -> kdtAddPoint t (position b) b) newKDTree bs -        simulateInWindow-                "Boids"-                (pixWidth w, pixHeight w)-                (10,10)-                (greyN 0.1)-                30 -                t-                (renderboids w)-                iterationkd+        simulate (InWindow "Boids" (pixWidth w, pixHeight w) (10,10))+                (greyN 0.1) 30 t (renderboids w) iterationkd   -- Coordinate Conversion ------------------------------------------------------@@ -242,6 +236,7 @@                 , dbgC          = c                 , dbgS          = s                 , dbgA          = a }+  -- | Neighbor finding code --
Clock/Main.hs view
@@ -4,12 +4,8 @@ import Graphics.Gloss  main- =	animateInWindow- 		"Clock"-		(600, 600)-		(20, 20)-		black-		frame+ =	animate (InWindow "Clock" (600, 600) (20, 20))+		black frame   -- Build the fractal, scale it so it fits in the window
Conway/Main.hs view
@@ -13,15 +13,9 @@ 	let height	= 100 	world	<- randomWorld (width, height) 	-	simulateInWindow -		"John Conway's Game of Life" -		(windowSizeOfWorld world)-		(5, 5) -		white-		10 -		world-		drawWorld-		simulateWorld+	simulate (InWindow "John Conway's Game of Life" +           	           (windowSizeOfWorld world) (5, 5))+		white 10 world drawWorld simulateWorld 	  -- | Convert a world to a picture.
Draw/Main.hs view
@@ -6,24 +6,20 @@ import Data.Maybe (maybe) import Debug.Trace + main   = do   let state = State Nothing []-        gameInWindow-                "Draw"-                (600, 600)-                (0,0)-                white-                100-                state-                makePicture-                handleEvent -                stepWorld+        play    (InWindow "Draw" (600, 600) (0,0))+                white 100 state+                makePicture handleEvent stepWorld + -- | The game state. data State               = State (Maybe Path)    -- The current line being drawn.                 [Picture]       -- All the lines drawn previously. + -- | A Line Segment type Segment    = ((Float, Float), (Float, Float)) @@ -52,7 +48,7 @@         | EventKey (MouseButton LeftButton) Up _ pt@(x,y)      <- event         , State (Just ps) ss    <- state         = State Nothing-                ((Translate x y $ Scale 0.1 0.1 $ Text "up")   : Line (pt:ps) : ss)+                ((Translate x y $ Scale 0.1 0.1 $ Text "up") : Line (pt:ps) : ss)          | otherwise         = state@@ -60,3 +56,4 @@  stepWorld :: Float -> State -> State stepWorld _ = id+
Easy/Main.hs view
@@ -1,3 +1,3 @@  import Graphics.Gloss-main = displayInWindow "My Window" (200, 200) (10, 10) white (Circle 80)+main = display (InWindow "My Window" (200, 200) (10, 10)) white (Circle 80)
Eden/Main.hs view
@@ -9,14 +9,11 @@ -- varying prng sequence main   = do 	gen <- getStdGen-	simulateInWindow-		"Eden"          -- window name-		(800, 600)      -- window size-		(10, 10)	-- window position-		(greyN 0.1)	-- background color-		2               -- number of steps per second-		(genesis' gen)  -- initial world-		render          -- function to convert world to a Picture-		evolve          -- function to step the world one iteration+	simulate (InWindow "Eden" (800, 600) (10, 10))+ 		 (greyN 0.1)	 -- background color+		 2               -- number of steps per second+		 (genesis' gen)  -- initial world+		 render          -- function to convert world to a Picture+		 evolve          -- function to step the world one iteration  
Flake/Main.hs view
@@ -4,12 +4,8 @@ -- import Graphics.Gloss -main =	displayInWindow-       		"Snowflake"-       		(500, 500)-       		(20,  20)-		black-       		(picture 3)+main = display (InWindow "Snowflake" (500, 500) (20,  20))+	       black (picture 3)   -- Fix a starting edge length of 360
GameEvent/Main.hs view
@@ -3,10 +3,7 @@  -- | Display the last event received as text. main- = gameInWindow-        "GameEvent"-        (700, 100)-        (10, 10)+ = play (InWindow "GameEvent" (700, 100) (10, 10))         white         100         ""
Hello/Main.hs view
@@ -3,14 +3,16 @@ -- import Graphics.Gloss -main 	= displayInWindow -		"Hello World" 		-- window title-		(400, 150) 		-- window size-		(10, 10) 		-- window position-		white			-- background color-		picture			-- picture to display+main 	+ = display +        (InWindow+	       "Hello World" 	 -- window title+		(400, 150) 	 -- window size+		(10, 10)) 	 -- window position+	white			 -- background color+	picture			 -- picture to display  picture	-	= Translate (-170) (-20) 	-- shift the text to the middle of the window-	$ Scale 0.5 0.5			-- display it half the original size-	$ Text "Hello World"		-- text to display+	= Translate (-170) (-20) -- shift the text to the middle of the window+	$ Scale 0.5 0.5		 -- display it half the original size+	$ Text "Hello World"	 -- text to display
Lifespan/Main.hs view
@@ -9,15 +9,12 @@ -- varying prng sequence main   = do 	gen <- getStdGen-	simulateInWindow-		"Lifespan"          -- window name-		(800, 600)      -- window size-		(10, 10)	-- window position-		(greyN 0.1)	-- background color-		2               -- number of steps per second-		(genesis' gen)  -- initial world-		render          -- function to convert world to a Picture-		evolve          -- function to step the world one iteration+	simulate (InWindow "Lifespan" (800, 600) (10, 10))+		 (greyN 0.1) 	 -- background color+		 2               -- number of steps per second+		 (genesis' gen)  -- initial world+		 render          -- function to convert world to a Picture+		 evolve          -- function to step the world one iteration   
Machina/Main.hs view
@@ -1,7 +1,8 @@  import Graphics.Gloss -main 	= animateInWindow "deus ex machina" (800, 600) (10, 10) black frame+main 	= animate (InWindow "machina" (800, 600) (10, 10))+                  black frame  frame time 	= Scale 0.8 0.8
Occlusion/Main.hs view
@@ -25,24 +25,20 @@ 	 	 mainWithWorld world- = do	let gameState	= initState world-	gameInWindow -		"Occlusion"-		(windowSizeOfWorld world)-		(10, 10)-		black -		10-		gameState-		drawState-		(handleInput world)-		(\_ -> id)+ = play (InWindow "Occlusion"+		 (windowSizeOfWorld world) (10, 10))+	black +	10+	(initState world)+	drawState+	(handleInput world)+	(\_ -> id) 				 				 -- | Convert the state to a picture. drawState :: State -> Picture drawState state- = let	-	world		= stateWorld state+ = let	world		= stateWorld state  	-- The ray cast by the user. 	p1		= stateLineStart state@@ -59,9 +55,10 @@ 	picCellsAll	= Pictures $ map (uncurry (drawCell False world)) cellsAll  	-- The cells visible from the designated point.-	cellsVisible	= [ (coord, cell)-				| (coord, cell)	<- flattenQuadTree (worldExtent world) (worldTree world)-				, cellAtCoordIsVisibleFromPoint world p1 coord ]+	cellsVisible	+          = [ (coord, cell)+		| (coord, cell)	<- flattenQuadTree (worldExtent world) (worldTree world)+		, cellAtCoordIsVisibleFromPoint world p1 coord ]  	picCellsVisible	= Pictures $ map (uncurry (drawCell True world)) cellsVisible 
Styrene/Main.hs view
@@ -16,17 +16,17 @@ import Data.Map			(Map)  main -  = simulateInWindow -	"Polystyrene - right-click-drag rotates"-	(600, 600)	-- x and y size of window (in pixels).-	(10, 10)	-- position of window-	black		-- background color-	simResolution	-- simulation resolution  -			-- (number of steps to take for each second of time)-	worldInit	-- the initial world.-	drawWorld	-- a function to convert the world to a Picture.-	advanceWorld	-- a function to advance the world to-			--	the next simulation step.+  = simulate +        (InWindow  "Polystyrene - right-click-drag rotates"+                   (600, 600)	-- x and y size of window (in pixels).+	           (10, 10))	-- position of window+	black		        -- background color+	simResolution	        -- simulation resolution  +			        --    (number of steps to take for each second of time)+	worldInit	        -- the initial world.+	drawWorld	        -- a function to convert the world to a Picture.+	advanceWorld	        -- a function to advance the world to+			        --    the next simulation step.  -- Draw -------------------------------------------------------------------------------------------- 
Tree/Main.hs view
@@ -4,12 +4,8 @@ --	 import Graphics.Gloss -main =  animateInWindow-		"Tree"-		(500, 650) -		(20,  20)-		black-		(picture 4)+main =  animate (InWindow "Tree" (500, 650) (20,  20))+		black (picture 4)   -- The picture is a tree fractal, graded from brown to green
Visibility/Main.hs view
@@ -22,13 +22,6 @@  = do	world		<- initialWorld 	let state	=  initialState world 	-	gameInWindow-		"Visibility"-		(800, 800)-		(10,  10)-		black-		100-		state-		drawState-		handleInput-		stepState+	play   (InWindow "Visibility" (800, 800) (10,  10))+	       black 100 state+               drawState handleInput stepState
Zen/Main.hs view
@@ -5,11 +5,8 @@  main :: IO () main - = 	animateInWindow -		"Zen" -		(800, 600) -		(5, 5)-		(greyN 0.2)+ = 	animate (InWindow "Zen" (800, 600) (5, 5))+                (greyN 0.2) 		frame	  
gloss-examples.cabal view
@@ -1,5 +1,5 @@ Name:                gloss-examples-Version:             1.5.0.1+Version:             1.6.0.1 License:             MIT License-file:        LICENSE Author:              Ben Lippmeier@@ -17,146 +17,166 @@ Synopsis:         Examples using the gloss library -Executable gloss-easy++Executable gloss-bitmap   Build-depends:-        base            == 4.*,-        gloss           == 1.5.*-  Main-is: Easy/Main.hs+        base           == 4.*,+        gloss          == 1.6.*,+        bytestring     == 0.9.*,+        bmp            == 1.2.*+  Main-is: Main.hs+  hs-source-dirs: Bitmap   ghc-options: -O2 ++Executable gloss-boids+  Build-depends:+        base           == 4.*,+        gloss          == 1.6.*+  Main-is: Main.hs+  other-modules: KDTree2d Vec2+  hs-source-dirs: Boids+  ghc-options: -O2++ Executable gloss-clock   Build-depends:          base            == 4.*,-        gloss           == 1.5.*+        gloss           == 1.6.*   Main-is: Clock/Main.hs   ghc-options: -O2 ++Executable gloss-conway+  Build-depends: +        base            == 4.*,+        gloss           == 1.6.*,+        vector          >= 0.7 && < 1.0+  Main-is: Main.hs+  other-modules: Cell World+  hs-source-dirs: Conway+  ghc-options: -O2+++Executable gloss-draw+  Build-depends:+        base           == 4.*,+        gloss          == 1.6.*+  Main-is: Main.hs+  hs-source-dirs: Draw+  ghc-options: -O2+++Executable gloss-easy+  Build-depends:+        base            == 4.*,+        gloss           == 1.6.*+  Main-is: Easy/Main.hs+  ghc-options: -O2++ Executable gloss-eden   Build-depends:          base            == 4.*,-        gloss           == 1.5.*,+        gloss           == 1.6.*,         random          == 1.0.*   Main-is: Main.hs   other-modules: Cell Community World   hs-source-dirs: Eden   ghc-options: -O2 + Executable gloss-flake   Build-depends:         base            == 4.*,-        gloss           == 1.5.*+        gloss           == 1.6.*   Main-is: Flake/Main.hs   ghc-options: -O2 ++Executable gloss-gameevent+  Build-depends: +        base            == 4.*,+        gloss           == 1.6.*+  Main-is: Main.hs+  hs-source-dirs: GameEvent+  ghc-options: -O2++ Executable gloss-hello   Build-depends:          base            == 4.*, -        gloss           == 1.5.*+        gloss           == 1.6.*   Main-is: Hello/Main.hs   ghc-options: -O2 + Executable gloss-lifespan   Build-depends:          base            == 4.*, -        gloss           == 1.5.*, +        gloss           == 1.6.*,          random          == 1.0.*   Main-is: Main.hs   other-modules: Cell Community World   hs-source-dirs: Lifespan   ghc-options: -O2 -Executable gloss-styrene-  Build-depends: -        base            == 4.*,-        gloss           == 1.5.*,-        containers      >= 0.3 && <= 0.5,-        ghc-prim        == 0.2.*-  Main-is: Main.hs-  other-modules: Actor Advance Collide Config Contact QuadTree World-  hs-source-dirs: Styrene-  ghc-options: -O2 -Executable gloss-tree-  Build-depends: -        base            == 4.*, -        gloss           == 1.5.*-  Main-is: Tree/Main.hs-  ghc-options: -O2--Executable gloss-zen-  Build-depends: -        base            == 4.*, -        gloss           == 1.5.*-  Main-is: Zen/Main.hs-  ghc-options: -O2- Executable gloss-machina   Build-depends:          base            == 4.*, -        gloss           == 1.5.*+        gloss           == 1.6.*   Main-is: Machina/Main.hs   ghc-options: -O2 -Executable gloss-conway++Executable gloss-occlusion   Build-depends: -        base            == 4.*,-        gloss           == 1.5.*,-        vector          >= 0.7 && < 1.0+        base            == 4.*, +        gloss           == 1.6.*   Main-is: Main.hs-  other-modules: Cell World-  hs-source-dirs: Conway+  other-modules: Cell World State Data+  hs-source-dirs: Occlusion   ghc-options: -O2 -Executable gloss-gameevent++Executable gloss-styrene   Build-depends:          base            == 4.*,-        gloss           == 1.5.*+        gloss           == 1.6.*,+        containers      >= 0.3 && <= 0.5,+        ghc-prim        == 0.2.*   Main-is: Main.hs-  hs-source-dirs: GameEvent+  other-modules: Actor Advance Collide Config Contact QuadTree World+  hs-source-dirs: Styrene   ghc-options: -O2 -Executable gloss-occlusion++Executable gloss-tree   Build-depends:          base            == 4.*, -        gloss           == 1.5.*-  Main-is: Main.hs-  other-modules: Cell World State Data-  hs-source-dirs: Occlusion+        gloss           == 1.6.*+  Main-is: Tree/Main.hs   ghc-options: -O2 + Executable gloss-visibility   Build-depends:          base            == 4.*, -        gloss           == 1.5.*,+        gloss           == 1.6.*,         vector          >= 0.7 && < 1.0   Main-is: Main.hs   other-modules: Draw Interface State World Geometry.Randomish Geometry.Segment   hs-source-dirs: Visibility    ghc-options: -O2 -Executable gloss-bitmap-  Build-depends:-        base           == 4.*,-        gloss          == 1.5.*,-        bytestring     == 0.9.*,-        bmp            == 1.1.*-  Main-is: Main.hs-  hs-source-dirs: Bitmap-  ghc-options: -O2 -Executable gloss-boids-  Build-depends:-        base           == 4.*,-        gloss          == 1.5.*-  Main-is: Main.hs-  other-modules: KDTree2d Vec2-  hs-source-dirs: Boids+Executable gloss-zen+  Build-depends: +        base            == 4.*, +        gloss           == 1.6.*+  Main-is: Zen/Main.hs   ghc-options: -O2 -Executable gloss-draw-  Build-depends:-        base           == 4.*,-        gloss          == 1.5.*-  Main-is: Main.hs-  hs-source-dirs: Draw-  ghc-options: -O2++