packages feed

gemstone 0.3 → 0.3.0.1

raw patch · 3 files changed

+15/−2 lines, 3 files

Files

Gemstone/Particles.hs view
@@ -22,6 +22,9 @@  makeLenses ''Particles +particleSprites :: Simple Traversal (Particles a) (Sprite a)+particleSprites = pParticles . traverse . _1 . aSprite+ makeParticles :: Num a => Particles a makeParticles = Particles (mkStdGen 0) (0, 0) black 0 [] 
Gemstone/Sprite.hs view
@@ -2,6 +2,7 @@ module Gemstone.Sprite where  import Control.Lens+import Graphics.Rendering.FTGL import Graphics.Rendering.OpenGL  import Gemstone.Box@@ -9,6 +10,7 @@  data Material = Colored RGB (Maybe GLubyte)               | Textured TextureObject+              | Text Font String RGB     deriving (Show)  data Sprite a = Sprite { _sMaterial :: Material@@ -20,7 +22,8 @@ addAlpha :: c -> Color3 c -> Color4 c addAlpha a (Color3 r g b) = Color4 r g b a -drawSprite :: (Ord c, VertexComponent c) => Sprite c -> IO ()+drawSprite :: (Fractional c, MatrixComponent c, Ord c, VertexComponent c)+           => Sprite c -> IO () drawSprite (Sprite material b) = case material of     Colored c malpha -> do         case malpha of@@ -47,12 +50,19 @@             texCoord (TexCoord2 r s')             vertex (Vertex2 x y')         texture Texture2D $= Disabled+    Text font string c -> do+        color c+        preservingMatrix $ do+            translate $ Vector3 x y 0+            scale h h 1+            renderFont font string All     where     rbox = remit box     x = b ^. rbox . bLeft     y = b ^. rbox . bBot     x' = b ^. rbox . bRight     y' = b ^. rbox . bTop+    h = b ^. rbox . bH . to (/ 2)     r = 0 :: GLfloat     s = 0 :: GLfloat     r' = 1
gemstone.cabal view
@@ -7,7 +7,7 @@ -- The package version. See the Haskell package versioning policy -- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for -- standards guiding when and how versions should be incremented.-Version:             0.3+Version:             0.3.0.1  -- A short (one-line) description of the package. Synopsis:            A simple library of helpers for SDL+GL games.