fwgl-glfw 0.1.1.0 → 0.1.1.1
raw patch · 4 files changed
+27/−14 lines, 4 filesdep ~fwglPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: fwgl
API changes (from Hackage documentation)
Files
- FWGL/Backend/GLFW/Common.hs +18/−11
- FWGL/Backend/OpenGL/GL20.hs +6/−0
- LICENSE +1/−1
- fwgl-glfw.cabal +2/−2
FWGL/Backend/GLFW/Common.hs view
@@ -105,37 +105,42 @@ return (Canvas win eventsRef resizeRef refreshRef bufferSem, w, h) - where keyCallback events key _ keyState _ = modifyIORef' events $+ where keyCallback events key _ keyState _ =+ do Just t <- GLFW.getTime+ modifyIORef' events $ case keyState of- KeyState'Pressed -> insertEvent KeyDown keyData- KeyState'Released -> insertEvent KeyUp keyData+ KeyState'Pressed -> insertEvent t KeyDown keyData+ KeyState'Released -> insertEvent t KeyUp keyData _ -> id where keyData = emptyEventData { dataKey = Just $ toKey key } mouseCallback events win mb mbState _ = do+ Just t <- GLFW.getTime pos <- fmap convertCursorPos $ getCursorPos win modifyIORef' events $ case mbState of MouseButtonState'Pressed ->- insertEvent MouseDown $ keyData pos+ insertEvent t MouseDown $ keyData pos MouseButtonState'Released ->- insertEvent MouseUp $ keyData pos+ insertEvent t MouseUp $ keyData pos where keyData p = emptyEventData { dataButton = Just $ toMouseButton mb, dataPointer = Just p } - cursorCallback events x y = modifyIORef' events $- insertEvent MouseMove $ emptyEventData {+ cursorCallback events x y = GLFW.getTime >>= \(Just t) ->+ modifyIORef' events $+ insertEvent t MouseMove $ emptyEventData { dataPointer = Just $ convertCursorPos (x, y) } resizeCallback events resizeRef x y =- do callback <- readIORef resizeRef+ do Just t <- GLFW.getTime+ callback <- readIORef resizeRef modifyIORef' events $- insertEvent Resize $ emptyEventData {+ insertEvent t Resize $ emptyEventData { dataFramebufferSize = Just $ (x, y) } callback x y@@ -147,13 +152,15 @@ convertCursorPos (x, y) = (floor x, floor y) - insertEvent e = H.insertWith (flip (++)) e . return+ insertEvent t e = H.insertWith (++) e . (: []) . setTime t+ where setTime t ed = ed { dataTime = t } emptyEventData = EventData { dataFramebufferSize = Nothing, dataPointer = Nothing, dataButton = Nothing,- dataKey = Nothing }+ dataKey = Nothing,+ dataTime = 0 } setCanvasSize :: Int -> Int -> Canvas -> BackendState -> IO () setCanvasSize w h (Canvas win _ _ _ _) _ = setWindowSize win w h
FWGL/Backend/OpenGL/GL20.hs view
@@ -68,10 +68,16 @@ encodeVec2s = mkArray encodeVec3s = mkArray encodeVec4s = mkArray+ encodeInts = mkArray+ encodeIVec2s = mkArray+ encodeIVec3s = mkArray+ encodeIVec4s = mkArray encodeUShorts = mkArray encodeColors = mkArray newByteArray = mkArrayLen+ fromFloat32Array (size, fptr) = (size, castForeignPtr fptr)+ fromInt32Array (size, fptr) = (size, castForeignPtr fptr) decodeBytes = arrayToList glActiveTexture = const GL.glActiveTexture
LICENSE view
@@ -13,7 +13,7 @@ disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Luca "ZioCrocifisso" Prezzavento nor the names of other+ * Neither the name of Luca Prezzavento nor the names of other contributors may be used to endorse or promote products derived from this software without specific prior written permission.
fwgl-glfw.cabal view
@@ -1,5 +1,5 @@ name: fwgl-glfw-version: 0.1.1.0+version: 0.1.1.1 synopsis: FWGL GLFW backend description: FWGL GLFW backend. homepage: https://github.com/ziocroc/FWGL@@ -16,6 +16,6 @@ exposed-modules: FWGL.Backend.GLFW.GL20 other-modules: FWGL.Backend.OpenGL.Common, FWGL.Backend.GLFW.Common, FWGL.Backend.OpenGL.GL20 other-extensions: NullaryTypeClasses, TypeFamilies, MultiParamTypeClasses- build-depends: fwgl > 0.1.3 && <0.1.4, base >=4.7 && <4.9, hashable >=1.2 && <1.3, unordered-containers >=0.2 && <0.3, vector >=0.10 && <0.12, transformers, gl >=0.6, JuicyPixels >=3.2 && <3.3, GLFW-b >=1.4 && <1.5, vect+ build-depends: fwgl >= 0.1.4 && <0.1.5, base >=4.7 && <4.9, hashable >=1.2 && <1.3, unordered-containers >=0.2 && <0.3, vector >=0.10 && <0.12, transformers, gl >=0.6, JuicyPixels >=3.2 && <3.3, GLFW-b >=1.4 && <1.5, vect hs-source-dirs: . default-language: Haskell2010