hsqml-demo-samples 0.3.4.0 → 0.3.5.0
raw patch · 5 files changed
+34/−32 lines, 5 filesdep ~OpenGLdep ~OpenGLRawdep ~hsqmlnew-uploader
Dependency ranges changed: OpenGL, OpenGLRaw, hsqml, text
Files
- LICENSE +1/−0
- hsqml-demo-samples.cabal +18/−27
- src/Factorial1.hs +9/−3
- src/Factorial2.hs +5/−1
- src/OpenGL1.hs +1/−1
LICENSE view
@@ -1,4 +1,5 @@ Copyright (c)2014-2016, Robin KAY+Copyright (c)2025, Sascha-Oliver Prolic All rights reserved.
hsqml-demo-samples.cabal view
@@ -1,12 +1,12 @@ Name: hsqml-demo-samples-Version: 0.3.4.0+Version: 0.3.5.0 Cabal-version: >= 1.10 Build-type: Simple License: BSD3 License-file: LICENSE-Copyright: (c) 2014-2016 Robin KAY+Copyright: (c) 2014-2016 Robin KAY, (c) 2025 Sascha-Oliver Prolic Author: Robin KAY-Maintainer: komadori@gekkou.co.uk+Maintainer: saschaprolic@googlemail.com Stability: experimental Homepage: http://www.gekkou.co.uk/software/hsqml/ Category: Graphics, GUI@@ -16,12 +16,7 @@ Extra-source-files: CHANGELOG Description:- HsQML sample programs--Flag OpenGL- Description:- Build sample programs which use OpenGL.- Default: True+ HsQML sample programs. Executable hsqml-factorial1 Default-language: Haskell2010@@ -29,7 +24,7 @@ Main-is: Factorial1.hs Build-depends: base == 4.*,- text >= 0.11 && < 1.3,+ text >= 2.0 && < 2.1, hsqml == 0.3.* GHC-options: -threaded @@ -39,7 +34,7 @@ Main-is: Factorial2.hs Build-depends: base == 4.*,- text >= 0.11 && < 1.3,+ text >= 2.0 && < 2.1, hsqml == 0.3.* GHC-options: -threaded @@ -49,8 +44,8 @@ Main-is: Model1.hs Build-depends: base == 4.*,- text >= 0.11 && < 1.3,- hsqml >= 0.3.4 && < 0.4+ text >= 2.0 && < 2.1,+ hsqml >= 0.3.6 && < 0.4 GHC-options: -threaded Executable hsqml-opengl1@@ -59,13 +54,11 @@ Main-is: OpenGL1.hs Build-depends: base == 4.*,- text >= 0.11 && < 1.3,- OpenGL >= 2.10 && < 2.14,- OpenGLRaw >= 2.1 && < 2.6,- hsqml >= 0.3.2 && < 0.4+ text >= 2.0 && < 2.1,+ OpenGL >= 3.0 && < 3.1,+ OpenGLRaw >= 3.3 && < 3.4,+ hsqml >= 0.3.6 && < 0.4 GHC-options: -threaded- if !flag(OpenGL)- Buildable: False Executable hsqml-opengl2 Default-language: Haskell2010@@ -73,14 +66,12 @@ Main-is: OpenGL2.hs Build-depends: base == 4.*,- text >= 0.11 && < 1.3,- OpenGL >= 2.10 && < 2.14,- OpenGLRaw >= 2.1 && < 2.6,- hsqml >= 0.3.3 && < 0.4+ text >= 2.0 && < 2.1,+ OpenGL >= 3.0 && < 3.1,+ OpenGLRaw >= 3.3 && < 3.4,+ hsqml >= 0.3.6 && < 0.4 GHC-options: -threaded- if !flag(OpenGL)- Buildable: False Source-repository head- type: darcs- location: http://hub.darcs.net/komadori/hsqml-demo-samples+ type: git+ location: https://github.com/prolic/hsqml-demo-samples
src/Factorial1.hs view
@@ -3,15 +3,21 @@ import Graphics.QML import Data.Text (Text) import qualified Data.Text as T+import Text.Read (readMaybe) import Paths_hsqml_demo_samples main :: IO () main = do clazz <- newClass [- defMethod' "factorial" (\_ txt ->- let n = read $ T.unpack txt :: Integer- in return . T.pack . show $ product [1..n] :: IO Text)]+ defMethod' "factorial" (\_ txt -> do+ let maybeN = readMaybe (T.unpack txt) :: Maybe Integer+ case maybeN of+ Nothing -> do+ return (T.pack "0")+ Just n -> do+ let result = product [1..n]+ return (T.pack (show result)) :: IO Text)] ctx <- newObject clazz () doc <- getDataFileName "factorial1.qml" runEngineLoop defaultEngineConfig {
src/Factorial2.hs view
@@ -6,6 +6,7 @@ import Data.IORef import Data.Text (Text) import qualified Data.Text as T+import Text.Read (readMaybe) import Paths_hsqml_demo_samples @@ -17,7 +18,10 @@ defPropertySigRO' "result" skey (\_ -> readIORef state), defMethod' "factorial" (\obj txt -> do- let n = read $ T.unpack txt :: Integer+ let maybeN = readMaybe (T.unpack txt) :: Maybe Integer+ n = case maybeN of+ Nothing -> 0+ Just n -> n writeIORef state $ T.pack "Working..." fireSignal skey obj forkIO $ do
src/OpenGL1.hs view
@@ -1,10 +1,10 @@ module Main where +import Graphics.GL.ARB.ShaderObjects (glUniformMatrix4fvARB) import Graphics.QML import Graphics.QML.Canvas import Graphics.Rendering.OpenGL.GL import Graphics.Rendering.OpenGL.GLU.Errors-import Graphics.Rendering.OpenGL.Raw.ARB.ShaderObjects (glUniformMatrix4fvARB) import Data.Text (Text) import qualified Data.Text as T import qualified Data.Text.Encoding as T