packages feed

gloss 1.5.2.1 → 1.6.0.1

raw patch · 16 files changed

+181/−159 lines, 16 filesdep ~GLFW-bdep ~bmpPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: GLFW-b, bmp

API changes (from Hackage documentation)

- Graphics.Gloss: animateInWindow :: String -> (Int, Int) -> (Int, Int) -> Color -> (Float -> Picture) -> IO ()
- Graphics.Gloss: displayInWindow :: String -> (Int, Int) -> (Int, Int) -> Color -> Picture -> IO ()
- Graphics.Gloss: gameInWindow :: String -> (Int, Int) -> (Int, Int) -> Color -> Int -> world -> (world -> Picture) -> (Event -> world -> world) -> (Float -> world -> world) -> IO ()
- Graphics.Gloss: simulateInWindow :: String -> (Int, Int) -> (Int, Int) -> Color -> Int -> model -> (model -> Picture) -> (ViewPort -> Float -> model -> model) -> IO ()
- Graphics.Gloss.Interface.Animate: animateInWindow :: String -> (Int, Int) -> (Int, Int) -> Color -> (Float -> Picture) -> IO ()
- Graphics.Gloss.Interface.Display: displayInWindow :: String -> (Int, Int) -> (Int, Int) -> Color -> Picture -> IO ()
- Graphics.Gloss.Interface.Game: gameInWindow :: String -> (Int, Int) -> (Int, Int) -> Color -> Int -> world -> (world -> Picture) -> (Event -> world -> world) -> (Float -> world -> world) -> IO ()
- Graphics.Gloss.Interface.Simulate: simulateInWindow :: String -> (Int, Int) -> (Int, Int) -> Color -> Int -> model -> (model -> Picture) -> (ViewPort -> Float -> model -> model) -> IO ()
+ Graphics.Gloss: FullScreen :: (Int, Int) -> Display
+ Graphics.Gloss: InWindow :: String -> (Int, Int) -> (Int, Int) -> Display
+ Graphics.Gloss: animate :: Display -> Color -> (Float -> Picture) -> IO ()
+ Graphics.Gloss: data Display
+ Graphics.Gloss: display :: Display -> Color -> Picture -> IO ()
+ Graphics.Gloss: play :: Display -> Color -> Int -> world -> (world -> Picture) -> (Event -> world -> world) -> (Float -> world -> world) -> IO ()
+ Graphics.Gloss: simulate :: Display -> Color -> Int -> model -> (model -> Picture) -> (ViewPort -> Float -> model -> model) -> IO ()
+ Graphics.Gloss.Data.Color: instance Num Color
+ Graphics.Gloss.Data.Display: FullScreen :: (Int, Int) -> Display
+ Graphics.Gloss.Data.Display: InWindow :: String -> (Int, Int) -> (Int, Int) -> Display
+ Graphics.Gloss.Data.Display: data Display
+ Graphics.Gloss.Data.Display: instance Eq Display
+ Graphics.Gloss.Data.Display: instance Show Display
+ Graphics.Gloss.Interface.Animate: animate :: Display -> Color -> (Float -> Picture) -> IO ()
+ Graphics.Gloss.Interface.Display: display :: Display -> Color -> Picture -> IO ()
+ Graphics.Gloss.Interface.Game: play :: Display -> Color -> Int -> world -> (world -> Picture) -> (Event -> world -> world) -> (Float -> world -> world) -> IO ()
+ Graphics.Gloss.Interface.Simulate: simulate :: Display -> Color -> Int -> model -> (model -> Picture) -> (ViewPort -> Float -> model -> model) -> IO ()

Files

Graphics/Gloss.hs view
@@ -6,7 +6,7 @@ -- --  @ --    import Graphics.Gloss---    main = `displayInWindow` \"My Window\" (200, 200) (10, 10) `white` (`Circle` 80)+--    main = `display` (InWindow \"Nice Window\" (200, 200) (10, 10)) `white` (`Circle` 80) --  @ -- --   Once the window is open you can use the following:@@ -19,17 +19,21 @@ -- --	* Zoom Viewport - mouse wheel, or page up\/down-keys. -----   Animations can be constructed similarly using the `animateInWindow`.+--   Animations can be constructed similarly using the `animate`. -- --   If you want to run a simulation based around finite time steps then try---   `simulateInWindow`.+--   `simulate`. -----   If you want to manage your own key\/mouse events then use `gameInWindow`.+--   If you want to manage your own key\/mouse events then use `play`. -- --   Gloss uses OpenGL under the hood, but you don't have to worry about any of that. -- -- @Release Notes: --+-- For 1.6.0:+--   Thanks to Anthony Cowley+--   * Full screen display mode.+--  -- For 1.5.0: --   * O(1) Conversion of ForeignPtrs to bitmaps. --   * An extra flag on the Bitmap constructor allows bitmaps to be cached@@ -41,36 +45,20 @@ --   * Support for using GLFW as the window library instead of GLUT. --     GLUT is still the default, but to use GLFW install gloss with: --        cabal install gloss --flags=\"GLFW -GLUT\"---    --- For 1.3.0:---   * Various wibbles for GHC 7.1   ---   Thanks to Ben Lambert-Smith:---   * Support for displaying bitmap files.------ For 1.2.0:---   * Cleaned up module hierarchy.---   * Added line-line intersection utils.---   * Enabled -Wall and fixed all warnings.---   * Various wibbles for GHC 7.0---   Thanks to Thomas DuBuisson:---   * Fixed a bug causing motion events to give the wrong position.---   Thanks to Stephan Maka:---   * Fixed a space leak in simulate mode when the window was hidden.------ For 1.1.0:---   * Added game mode.---   * Added QuadTree and Extent structures.---   * Added simple ray casting. -- @ --+-- For more information, check out <http://gloss.ouroborus.net>.+-- module Graphics.Gloss  	( module Graphics.Gloss.Data.Picture 	, module Graphics.Gloss.Data.Color-	, displayInWindow-	, animateInWindow-        , simulateInWindow-	, gameInWindow)+        , Display(..)+	, display+	, animate+        , simulate+	, play) where+import Graphics.Gloss.Data.Display import Graphics.Gloss.Data.Picture import Graphics.Gloss.Data.Color import Graphics.Gloss.Internals.Interface.Display
Graphics/Gloss/Data/Color.hs view
@@ -35,6 +35,33 @@ 	deriving (Show, Eq)  +instance Num Color where+ {-# INLINE (+) #-}+ (+) (RGBA r1 g1 b1 _) (RGBA r2 g2 b2 _)+        = RGBA (r1 + r2) (g1 + g2) (b1 + b2) 1++ {-# INLINE (-) #-}+ (-) (RGBA r1 g1 b1 _) (RGBA r2 g2 b2 _)+        = RGBA (r1 - r2) (g1 - g2) (b1 - b2) 1++ {-# INLINE (*) #-}+ (*) (RGBA r1 g1 b1 _) (RGBA r2 g2 b2 _)+        = RGBA (r1 * r2) (g1 * g2) (b1 * b2) 1++ {-# INLINE abs #-}+ abs (RGBA r1 g1 b1 _)+        = RGBA (abs r1) (abs g1) (abs b1) 1++ {-# INLINE signum #-}+ signum (RGBA r1 g1 b1 _)+        = RGBA (signum r1) (signum g1) (signum b1) 1+        + {-# INLINE fromInteger #-}+ fromInteger i+  = let f = fromInteger i+    in  RGBA f f f 1++ -- | Make a custom color. All components are clamped to the range  [0..1]. makeColor  	:: Float 	-- ^ Red component.
+ Graphics/Gloss/Data/Display.hs view
@@ -0,0 +1,13 @@++module Graphics.Gloss.Data.Display+        (Display(..))+where++-- | Describes how Gloss should display its output.+data Display+        -- | Display in a window with the given name, size and position.+        = InWindow   String (Int, Int) (Int, Int)++        -- | Display full screen with a drawing area of the given size.+        | FullScreen (Int, Int) +        deriving (Eq, Show)
Graphics/Gloss/Interface/Animate.hs view
@@ -1,10 +1,12 @@  -- | Display mode is for drawing a static picture. module Graphics.Gloss.Interface.Animate- 	( module Graphics.Gloss.Data.Picture+ 	( module Graphics.Gloss.Data.Display+        , module Graphics.Gloss.Data.Picture 	, module Graphics.Gloss.Data.Color-	, animateInWindow)+	, animate) where+import Graphics.Gloss.Data.Display import Graphics.Gloss.Data.Picture import Graphics.Gloss.Data.Color import Graphics.Gloss.Internals.Interface.Animate
Graphics/Gloss/Interface/Display.hs view
@@ -1,10 +1,12 @@  -- | Display mode is for drawing a static picture. module Graphics.Gloss.Interface.Display- 	( module Graphics.Gloss.Data.Picture+ 	( module Graphics.Gloss.Data.Display+        , module Graphics.Gloss.Data.Picture 	, module Graphics.Gloss.Data.Color-	, displayInWindow)+	, display) where+import Graphics.Gloss.Data.Display import Graphics.Gloss.Data.Picture import Graphics.Gloss.Data.Color import Graphics.Gloss.Internals.Interface.Display
Graphics/Gloss/Interface/Game.hs view
@@ -5,11 +5,13 @@ -- | This game mode lets you manage your own input. Pressing ESC will still abort the program, --   but you don't get automatic pan and zoom controls like with `displayInWindow`. module Graphics.Gloss.Interface.Game- 	( module Graphics.Gloss.Data.Picture+ 	( module Graphics.Gloss.Data.Display+        , module Graphics.Gloss.Data.Picture 	, module Graphics.Gloss.Data.Color-	, gameInWindow+	, play 	, Event(..), Key(..), SpecialKey(..), MouseButton(..), KeyState(..), Modifiers(..)) where+import Graphics.Gloss.Data.Display import Graphics.Gloss.Data.Picture import Graphics.Gloss.Data.Color import Graphics.Gloss.Internals.Interface.Game
Graphics/Gloss/Interface/Simulate.hs view
@@ -6,11 +6,13 @@ --   changes over finite time steps. The behavior of the model can also depent --   on the current `ViewPort`. module Graphics.Gloss.Interface.Simulate- 	( module Graphics.Gloss.Data.Picture+ 	( module Graphics.Gloss.Data.Display+        , module Graphics.Gloss.Data.Picture 	, module Graphics.Gloss.Data.Color-	, ViewPort(..)-	, simulateInWindow)+	, simulate+        , ViewPort(..)) where+import Graphics.Gloss.Data.Display import Graphics.Gloss.Data.Picture import Graphics.Gloss.Data.Color import Graphics.Gloss.Internals.Interface.ViewPort
Graphics/Gloss/Internals/Interface/Animate.hs view
@@ -1,7 +1,7 @@  module Graphics.Gloss.Internals.Interface.Animate-	( animateInWindow-	, animateInWindowWithBackend)+	( animate+	, animateWithBackend) where	 import Graphics.Gloss.Data.Color import Graphics.Gloss.Data.Picture@@ -27,33 +27,27 @@  -- | Open a new window and display the given animation. -----   Once the window is open you can use the same commands as with @displayInWindow@.+--   Once the window is open you can use the same commands as with @display@. ---animateInWindow-	:: String		-- ^ Name of the window.-	-> (Int, Int)		-- ^ Initial size of the window, in pixels.-	-> (Int, Int)		-- ^ Initial position of the window, in pixels.+animate :: Display              -- ^ Display mode. 	-> Color		-- ^ Background color. 	-> (Float -> Picture)	-- ^ Function to produce the next frame of animation.  				--	It is passed the time in seconds since the program started. 	-> IO () -animateInWindow-        = animateInWindowWithBackend defaultBackendState+animate = animateWithBackend defaultBackendState  -animateInWindowWithBackend+animateWithBackend 	:: Backend a 	=> a			-- ^ Initial State of the backend-	-> String		-- ^ Name of the window.-	-> (Int, Int)		-- ^ Initial size of the window, in pixels.-	-> (Int, Int)		-- ^ Initial position of the window, in pixels.+        -> Display              -- ^ Display mode. 	-> Color		-- ^ Background color. 	-> (Float -> Picture)	-- ^ Function to produce the next frame of animation. 				--	It is passed the time in seconds since the program started. 	-> IO () -animateInWindowWithBackend backend name size pos backColor frameFun+animateWithBackend backend display backColor frameFun  = do	 	viewSR		<- newIORef viewPortInit 	viewControlSR	<- newIORef VPC.stateInit@@ -90,7 +84,7 @@ 		, callback_viewPort_motion   viewSR viewControlSR  		, callback_viewPort_reshape ] -	createWindow backend name size pos backColor callbacks+	createWindow backend display backColor callbacks  getsIORef :: IORef a -> (a -> r) -> IO r getsIORef ref fun
Graphics/Gloss/Internals/Interface/Backend/GLFW.hs view
@@ -8,6 +8,7 @@ import Data.IORef import Data.Char                           (toLower) import Control.Monad+import Graphics.Gloss.Data.Display import Graphics.UI.GLFW                    (WindowValue(..)) import qualified Graphics.UI.GLFW          as GLFW import qualified Graphics.Rendering.OpenGL as GL@@ -119,24 +120,34 @@ -- | Open a new window. openWindowGLFW          :: IORef GLFWState-        -> String-        -> (Int,Int)-        -> (Int,Int)+        -> Display         -> IO () -openWindowGLFW _ windowName (sizeX,sizeY) (posX,posY) +openWindowGLFW _ (InWindow title (sizeX, sizeY) pos)  = do   _ <- GLFW.openWindow                 GLFW.defaultDisplayOptions                  { GLFW.displayOptions_width        = sizeX-                 , GLFW.displayOptions_height       = sizeY }--        GLFW.setWindowPosition           posX posY-        GLFW.setWindowTitle              windowName+                 , GLFW.displayOptions_height       = sizeY+                 , GLFW.displayOptions_displayMode  = GLFW.Window }+        +        uncurry GLFW.setWindowPosition pos+        GLFW.setWindowTitle title          -- Try to enable sync-to-vertical-refresh by setting the number          -- of buffer swaps per vertical refresh to 1.         GLFW.setWindowBufferSwapInterval 1 +openWindowGLFW _ (FullScreen (sizeX, sizeY))+ = do   _ <- GLFW.openWindow+                GLFW.defaultDisplayOptions+                 { GLFW.displayOptions_width        = sizeX+                 , GLFW.displayOptions_height       = sizeY+                 , GLFW.displayOptions_displayMode  = GLFW.Fullscreen }+        +        -- Try to enable sync-to-vertical-refresh by setting the number +        -- of buffer swaps per vertical refresh to 1.+        GLFW.setWindowBufferSwapInterval 1+        GLFW.enableMouseCursor  -- Dump State ----------------------------------------------------------------- -- | Print out the internal GLFW state.
Graphics/Gloss/Internals/Interface/Backend/GLUT.hs view
@@ -91,34 +91,40 @@ -- Open Window ---------------------------------------------------------------- openWindowGLUT         :: IORef GLUTState-        -> String-        -> (Int,Int)-        -> (Int,Int)+        -> Display         -> IO () -openWindowGLUT _ windowName (sizeX, sizeY) (posX, posY) +openWindowGLUT _ display  = do-        -- Setup and create a new window.-        -- Be sure to set initialWindow{Position,Size} before calling-        -- createWindow. If we don't do this we get wierd half-created-        -- windows some of the time.-        GLUT.initialWindowPosition-         $= GL.Position-                (fromIntegral posX)-                (fromIntegral posY)+       -- Setup and create a new window.+       -- Be sure to set initialWindow{Position,Size} before calling+       -- createWindow. If we don't do this we get wierd half-created+       -- windows some of the time.+        case display of+          InWindow windowName (sizeX, sizeY) (posX, posY) -> +            do GLUT.initialWindowSize+                     $= GL.Size+                          (fromIntegral sizeX)+                          (fromIntegral sizeY) -        GLUT.initialWindowSize-         $= GL.Size-                (fromIntegral sizeX)-                (fromIntegral sizeY)+               GLUT.initialWindowPosition+                     $= GL.Position+                          (fromIntegral posX)+                          (fromIntegral posY) -        _ <- GLUT.createWindow windowName+               _ <- GLUT.createWindow windowName -        GLUT.windowSize-         $= GL.Size-                (fromIntegral sizeX)-                (fromIntegral sizeY)+               GLUT.windowSize+                     $= GL.Size+                          (fromIntegral sizeX)+                          (fromIntegral sizeY) +          FullScreen (sizeX, sizeY) -> +            do GLUT.gameModeCapabilities $= +                 [ GLUT.Where' GLUT.GameModeWidth GLUT.IsEqualTo sizeX+                 , GLUT.Where' GLUT.GameModeHeight GLUT.IsEqualTo sizeY ]+               void $ GLUT.enterGameMode+         --  Switch some things.         --  auto repeat interferes with key up / key down checks.         --  BUGS: this doesn't seem to work?@@ -185,7 +191,6 @@         GLUT.swapBuffers         GLUT.reportErrors         return ()-  -- Reshape Callback ----------------------------------------------------------- installReshapeCallbackGLUT
Graphics/Gloss/Internals/Interface/Backend/Types.hs view
@@ -2,9 +2,11 @@ {-# OPTIONS -fspec-constr-count=5 #-} {-# LANGUAGE Rank2Types #-} module Graphics.Gloss.Internals.Interface.Backend.Types-        (module Graphics.Gloss.Internals.Interface.Backend.Types)+        ( module Graphics.Gloss.Internals.Interface.Backend.Types+        , module Graphics.Gloss.Data.Display) where import Data.IORef+import Graphics.Gloss.Data.Display   -- | The functions every backend window managed backend needs to support.@@ -29,8 +31,8 @@         -- | Perform any deinitialization and close the backend.         exitBackend                :: IORef a -> IO () -        -- | Open a window. Arguments: Name of the window, (sizeW, sizeH), (posX,posY)-        openWindow                 :: IORef a -> String -> (Int,Int) -> (Int,Int) -> IO ()+        -- | Open a window with the given display mode.+        openWindow                 :: IORef a -> Display -> IO ()          -- | Dump information about the backend to the terminal.         dumpBackendState           :: IORef a -> IO ()
Graphics/Gloss/Internals/Interface/Display.hs view
@@ -1,7 +1,7 @@  module Graphics.Gloss.Internals.Interface.Display-	( displayInWindow-	, displayInWindowWithBackend)+	( display+	, displayWithBackend) where	 import Graphics.Gloss.Data.Color import Graphics.Gloss.Data.Picture@@ -32,29 +32,23 @@ -- --	* Zoom Viewport - mouse wheel, or page up\/down-keys. ---displayInWindow-	:: String	-- ^ Name of the window.-	-> (Int, Int)	-- ^ Initial size of the window, in pixels.-	-> (Int, Int)	-- ^ Initial position of the window, in pixels.-	-> Color	-- ^ Background color.-	-> Picture	-- ^ The picture to draw.+display :: Display          -- ^ Display mode.+	-> Color            -- ^ Background color.+	-> Picture          -- ^ The picture to draw. 	-> IO () -displayInWindow-        = displayInWindowWithBackend defaultBackendState+display = displayWithBackend defaultBackendState  -displayInWindowWithBackend+displayWithBackend 	:: Backend a-	=> a		-- ^ Initial state of the backend.-	-> String	-- ^ Name of the window.-	-> (Int, Int)	-- ^ Initial size of the window, in pixels.-	-> (Int, Int)	-- ^ Initial position of the window, in pixels.-	-> Color	-- ^ Background color.-	-> Picture	-- ^ The picture to draw.+	=> a                -- ^ Initial state of the backend.+        -> Display          -- ^ Display config.+	-> Color            -- ^ Background color.+	-> Picture          -- ^ The picture to draw. 	-> IO () -displayInWindowWithBackend backend name size pos background picture+displayWithBackend backend displayMode background picture  =  do	viewSR		<- newIORef viewPortInit 	viewControlSR	<- newIORef VPC.stateInit @@ -84,4 +78,4 @@ 		, callback_viewPort_motion   viewSR viewControlSR  		, callback_viewPort_reshape ] -	createWindow backend name size pos background callbacks+	createWindow backend displayMode background callbacks
Graphics/Gloss/Internals/Interface/Game.hs view
@@ -1,8 +1,8 @@ {-# LANGUAGE RankNTypes #-}  module Graphics.Gloss.Internals.Interface.Game-	( gameInWindow-	, gameInWindowWithBackend+	( play+	, playWithBackend 	, Event(..)) where import Graphics.Gloss.Data.Color@@ -29,13 +29,10 @@ 	| EventMotion (Float, Float) 	deriving (Eq, Show) --- | Run a game in a window. -gameInWindow -	:: forall world-	.  String			-- ^ Name of the window.-	-> (Int, Int)			-- ^ Initial size of the window, in pixels.-	-> (Int, Int)			-- ^ Initial position of the window, in pixels.-	-> Color			-- ^ Background color.+-- | Play a game in a window. +play    :: forall world+        .  Display                      -- ^ Display mode.+        -> Color                        -- ^ Background color. 	-> Int				-- ^ Number of simulation steps to take for each second of real time. 	-> world 			-- ^ The initial world. 	-> (world -> Picture)	 	-- ^ A function to convert the world a picture.@@ -44,16 +41,13 @@ 					--   It is passed the period of time (in seconds) needing to be advanced. 	-> IO () -gameInWindow-        = gameInWindowWithBackend defaultBackendState+play    = playWithBackend defaultBackendState -gameInWindowWithBackend+playWithBackend 	:: forall world a 	.  Backend a 	=> a				-- ^ Initial state of the backend-	-> String			-- ^ Name of the window.-	-> (Int, Int)			-- ^ Initial size of the window, in pixels.-	-> (Int, Int)			-- ^ Initial position of the window, in pixels.+        -> Display                      -- ^ Display mode. 	-> Color			-- ^ Background color. 	-> Int				-- ^ Number of simulation steps to take for each second of real time. 	-> world 			-- ^ The initial world.@@ -63,11 +57,9 @@ 					--   It is passed the period of time (in seconds) needing to be advanced. 	-> IO () -gameInWindowWithBackend+playWithBackend 	backend-	windowName-	windowSize-	windowPos+        display 	backgroundColor 	simResolution 	worldStart@@ -121,7 +113,7 @@ 		, callback_motion   worldSR worldHandleEvent 		, callback_viewPort_reshape ] -	createWindow backend windowName windowSize windowPos backgroundColor callbacks+	createWindow backend display backgroundColor callbacks   -- | Callback for KeyMouse events.
Graphics/Gloss/Internals/Interface/Simulate.hs view
@@ -1,9 +1,10 @@ {-# LANGUAGE RankNTypes #-}  module Graphics.Gloss.Internals.Interface.Simulate-	( simulateInWindow-	, simulateInWindowWithBackend)+	( simulate+	, simulateWithBackend) where+import Graphics.Gloss.Data.Display import Graphics.Gloss.Data.Color import Graphics.Gloss.Data.Picture import Graphics.Gloss.Internals.Render.Picture@@ -29,13 +30,10 @@ --	how to convert the model to a picture, and how to advance the model for each unit of time.  --	This function does the rest. -----   Once the window is open you can use the same commands as with @displayInWindow@.+--   Once the window is open you can use the same commands as with @display@. ---simulateInWindow -	:: forall model-	.  String			-- ^ Name of the window.-	-> (Int, Int)			-- ^ Initial size of the window, in pixels.-	-> (Int, Int)			-- ^ Initial position of the window, in pixels.+simulate :: forall model+        .  Display                      -- ^ Display mode. 	-> Color			-- ^ Background color. 	-> Int				-- ^ Number of simulation steps to take for each second of real time. 	-> model 			-- ^ The initial model.@@ -45,16 +43,13 @@ 						 --     step (in seconds). 	-> IO () -simulateInWindow-        = simulateInWindowWithBackend defaultBackendState+simulate = simulateWithBackend defaultBackendState -simulateInWindowWithBackend+simulateWithBackend 	:: forall model a 	.  Backend a 	=> a				-- ^ Initial state of the backend-	-> String			-- ^ Name of the window.-	-> (Int, Int)			-- ^ Initial size of the window, in pixels.-	-> (Int, Int)			-- ^ Initial position of the window, in pixels.+        -> Display                      -- ^ Display mode. 	-> Color			-- ^ Background color. 	-> Int				-- ^ Number of simulation steps to take for each second of real time. 	-> model 			-- ^ The initial model.@@ -64,11 +59,9 @@ 						 --     step (in seconds). 	-> IO () -simulateInWindowWithBackend+simulateWithBackend 	backend-	windowName-	windowSize-	windowPos+        display 	backgroundColor 	simResolution 	worldStart@@ -122,4 +115,4 @@ 		, callback_viewPort_motion   viewSR viewControlSR  		, callback_viewPort_reshape ] -	createWindow backend windowName windowSize windowPos backgroundColor callbacks+	createWindow backend display backgroundColor callbacks
Graphics/Gloss/Internals/Interface/Window.hs view
@@ -11,26 +11,20 @@ import Graphics.Rendering.OpenGL			(($=)) import qualified Graphics.Rendering.OpenGL.GL		as GL import Data.IORef (newIORef)- import Control.Monad  -- | Open a window and use the supplied callbacks to handle window events. createWindow 	:: Backend a 	=> a-	-> String 		-- ^ Name of the window.-	-> (Int, Int) 		-- ^ Initial size of the window, in pixels.-	-> (Int, Int)		-- ^ Initial position of the window, in pixels relative to-				--	the top left corner of the screen.+        -> Display 	-> Color		-- ^ Color to use when clearing. 	-> [Callback]		-- ^ Callbacks to use 	-> IO ()  createWindow 	backend-	windowName-	(sizeX, sizeY)-	(posX,  posY)+        display 	clearColor 	callbacks  = do@@ -48,10 +42,10 @@  	-- Here we go! 	when debug-	 $ do	putStr	$ "* creating window\n\n"+	 $ do	putStr	$ "* c window\n\n"  	-- Open window-	openWindow backendStateRef windowName (sizeX, sizeY) (posX, posY)+	openWindow backendStateRef display  	-- Setup callbacks 	installDisplayCallback     backendStateRef callbacks
gloss.cabal view
@@ -1,12 +1,12 @@ Name:                gloss-Version:             1.5.2.1+Version:             1.6.0.1 License:             MIT License-file:        LICENSE Author:              Ben Lippmeier Maintainer:          benl@ouroborus.net Build-Type:          Simple Cabal-Version:       >=1.6-Stability:           provisional+Stability:           stable Category:            Graphics Homepage:            http://gloss.ouroborus.net Bug-reports:         gloss@ouroborus.net@@ -18,7 +18,7 @@ Synopsis:         Painless 2D vector graphics, animations and simulations. -Tested-with: GHC == 6.12.1, GHC == 7.0.1+Tested-with: GHC == 7.2.1  Flag GLUT   Description: Enable the GLUT backend@@ -29,7 +29,7 @@   Default:     False  Flag ExplicitBackend-  Description: Expose versions of displayInWindow and friends that allow+  Description: Expose versions of 'display' and friends that allow                you to choose what window manager backend to use.   Default:     False @@ -41,7 +41,7 @@         bytestring == 0.9.*,         OpenGL     == 2.4.*,         GLUT       == 2.2.*,-        bmp        == 1.1.*+        bmp        == 1.2.*    ghc-options:      -O2 -Wall @@ -50,6 +50,7 @@         Graphics.Gloss.Geometry         Graphics.Gloss.Geometry.Angle         Graphics.Gloss.Geometry.Line+        Graphics.Gloss.Data.Display         Graphics.Gloss.Data.Point         Graphics.Gloss.Data.Vector         Graphics.Gloss.Data.Quad@@ -100,7 +101,7 @@    If flag(GLFW)     Build-Depends:-        GLFW-b == 0.0.2.*+        GLFW-b >= 0.1.0.1 && < 0.2     CPP-Options: -DWITHGLFW     Other-modules:         Graphics.Gloss.Internals.Interface.Backend.GLFW