gloss-examples 1.2.0.1 → 1.3.0.1
raw patch · 4 files changed
+62/−31 lines, 4 filesdep +bmpdep +bytestringdep ~glossnew-component:exe:gloss-bitmap
Dependencies added: bmp, bytestring
Dependency ranges changed: gloss
Files
- Bitmap/Main.hs +35/−0
- Clock/Main.hs +1/−16
- Styrene/Contact.hs +1/−1
- gloss-examples.cabal +25/−14
+ Bitmap/Main.hs view
@@ -0,0 +1,35 @@++import Graphics.Gloss+import Codec.BMP+import System.Environment++-- | Displays uncompressed 24/32 bit BMP images.+main+ = do args <- getArgs+ case args of+ [fileName] -> run fileName+ _ -> putStr + $ unlines [ "usage: bitmap <file.bmp>"+ , " file.bmp should be a 24 or 32-bit uncompressed BMP file" ]++run fileName+ = do (bitmap, width, height) <- loadBitmap fileName+ displayInWindow+ fileName+ (width * 3, height * 3)+ (10, 10)+ white+ (Scale 2 2 bitmap)+++loadBitmap :: FilePath -> IO (Picture, Int, Int)+loadBitmap fileName+ = do eImg <- readBMP fileName+ case eImg of+ Left err -> error $ show err+ Right img + -> let (width, height) = bmpDimensions img+ bytestring = unpackBMPToRGBA32 img+ in return ( Bitmap width height bytestring+ , width, height)+
Clock/Main.hs view
@@ -55,7 +55,7 @@ -- circNm1 = Pictures- [ circle' 1 50+ [ circle 1 , Scale (a/2.5) (a/2.5) $ clockFractal (n-1) s , if n > 2 then Color cyan @@ -75,18 +75,3 @@ [ Line [(0, 0), ( 0, a)] , Line [(0, 0), ( 1, -b)] , Line [(0, 0), (-1, -b)] ]----- Make a circle of radius r consisting of n lines.-circle' :: Float -> Float -> Picture-circle' r n- = Scale r r- $ Line (circlePoints n)- ---- A list of n points spaced equally around the unit circle.-circlePoints :: Float -> [(Float, Float)]-circlePoints n- = map (\d -> (cos d, sin d))- [0, 2*pi / n .. 2*pi]-
Styrene/Contact.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE MagicHash #-}+{-# LANGUAGE MagicHash, BangPatterns #-} -- | Find actors in the world that are in contact with each other. module Contact where
gloss-examples.cabal view
@@ -1,5 +1,5 @@ Name: gloss-examples-Version: 1.2.0.1+Version: 1.3.0.1 License: MIT License-file: LICENSE Author: Ben Lippmeier@@ -20,21 +20,21 @@ Executable gloss-easy Build-depends: base == 4.*,- gloss == 1.2.*+ gloss == 1.3.* Main-is: Easy/Main.hs ghc-options: -O2 Executable gloss-clock Build-depends: base == 4.*,- gloss == 1.2.*+ gloss == 1.3.* Main-is: Clock/Main.hs ghc-options: -O2 Executable gloss-eden Build-depends: base == 4.*,- gloss == 1.2.*,+ gloss == 1.3.*, random == 1.0.* Main-is: Main.hs other-modules: Cell Community World@@ -44,21 +44,21 @@ Executable gloss-flake Build-depends: base == 4.*,- gloss == 1.2.*+ gloss == 1.3.* Main-is: Flake/Main.hs ghc-options: -O2 Executable gloss-hello Build-depends: base == 4.*, - gloss == 1.2.*+ gloss == 1.3.* Main-is: Hello/Main.hs ghc-options: -O2 Executable gloss-lifespan Build-depends: base == 4.*, - gloss == 1.2.*, + gloss == 1.3.*, random == 1.0.* Main-is: Main.hs other-modules: Cell Community World@@ -68,7 +68,7 @@ Executable gloss-styrene Build-depends: base == 4.*,- gloss == 1.2.*,+ gloss == 1.3.*, containers >= 0.3 && <= 0.5, ghc-prim == 0.2.* Main-is: Main.hs@@ -79,28 +79,28 @@ Executable gloss-tree Build-depends: base == 4.*, - gloss == 1.2.*+ gloss == 1.3.* Main-is: Tree/Main.hs ghc-options: -O2 Executable gloss-zen Build-depends: base == 4.*, - gloss == 1.2.*+ gloss == 1.3.* Main-is: Zen/Main.hs ghc-options: -O2 Executable gloss-machina Build-depends: base == 4.*, - gloss == 1.2.*+ gloss == 1.3.* Main-is: Machina/Main.hs ghc-options: -O2 Executable gloss-conway Build-depends: base == 4.*,- gloss == 1.2.*,+ gloss == 1.3.*, vector >= 0.5 && < 0.8 Main-is: Main.hs other-modules: Cell World@@ -110,7 +110,7 @@ Executable gloss-occlusion Build-depends: base == 4.*, - gloss == 1.2.*+ gloss == 1.3.* Main-is: Main.hs other-modules: Cell World State Data hs-source-dirs: Occlusion@@ -119,8 +119,19 @@ Executable gloss-visibility Build-depends: base == 4.*, - gloss == 1.2.*+ gloss == 1.3.* Main-is: Main.hs other-modules: Array Draw Interface State World Geometry.Randomish Geometry.Segment hs-source-dirs: Visibility ghc-options: -O2++Executable gloss-bitmap+ Build-depends:+ base == 4.*,+ gloss == 1.3.*,+ bytestring == 0.9.*,+ bmp == 1.1.*+ Main-is: Main.hs+ hs-source-dirs: Bitmap+ ghc-options: -O2+