works now

This commit is contained in:
nek0 2020-02-08 00:15:53 +01:00
parent 0d7f79ba99
commit 610c239f6d
14 changed files with 236 additions and 204 deletions

View file

@ -59,13 +59,6 @@ in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
description = "This package contains Affection, a simple game engine\nwritten in Haskell using SDL.\nThis Engine is still work in progress and even minor\nversion bumps may contain breaking api changes."; description = "This package contains Affection, a simple game engine\nwritten in Haskell using SDL.\nThis Engine is still work in progress and even minor\nversion bumps may contain breaking api changes.";
buildType = "Simple"; buildType = "Simple";
isLocal = true; isLocal = true;
detailLevel = "FullDetails";
licenseFiles = [ "LICENSE" ];
dataDir = "";
dataFiles = [];
extraSrcFiles = [ "ChangeLog.md" ];
extraTmpFiles = [];
extraDocFiles = [];
}; };
components = { components = {
"library" = { "library" = {
@ -87,28 +80,6 @@ in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
(hsPkgs."vector" or (buildDepError "vector")) (hsPkgs."vector" or (buildDepError "vector"))
]; ];
buildable = true; buildable = true;
modules = [
"Affection"
"Affection/Logging"
"Affection/Types"
"Affection/StateMachine"
"Affection/Util"
"Affection/MessageBus"
"Affection/MessageBus/Class"
"Affection/MessageBus/Message"
"Affection/MessageBus/Message/Class"
"Affection/MessageBus/Message/WindowMessage"
"Affection/MessageBus/Message/KeyboardMessage"
"Affection/MessageBus/Message/MouseMessage"
"Affection/MessageBus/Message/JoystickMessage"
"Affection/Subsystems"
"Affection/Subsystems/Class"
"Affection/Subsystems/AffectionWindow"
"Affection/Subsystems/AffectionKeyboard"
"Affection/Subsystems/AffectionMouse"
"Affection/Subsystems/AffectionJoystick"
];
hsSourceDirs = [ "src" ];
}; };
exes = { exes = {
"example00" = { "example00" = {
@ -119,8 +90,6 @@ in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
(hsPkgs."stm" or (buildDepError "stm")) (hsPkgs."stm" or (buildDepError "stm"))
]; ];
buildable = if flags.examples then true else false; buildable = if flags.examples then true else false;
hsSourceDirs = [ "examples/example00" ];
mainPath = [ "Main.hs" ] ++ [ "" ];
}; };
"example01" = { "example01" = {
depends = (pkgs.lib).optionals (flags.examples) [ depends = (pkgs.lib).optionals (flags.examples) [
@ -137,9 +106,6 @@ in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
(hsPkgs."deepseq" or (buildDepError "deepseq")) (hsPkgs."deepseq" or (buildDepError "deepseq"))
]; ];
buildable = if flags.examples then true else false; buildable = if flags.examples then true else false;
modules = [ "Types" ];
hsSourceDirs = [ "examples/example01" ];
mainPath = [ "Main.hs" ] ++ [ "" ];
}; };
"example02" = { "example02" = {
depends = (pkgs.lib).optionals (flags.examples) [ depends = (pkgs.lib).optionals (flags.examples) [
@ -156,9 +122,6 @@ in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
(hsPkgs."deepseq" or (buildDepError "deepseq")) (hsPkgs."deepseq" or (buildDepError "deepseq"))
]; ];
buildable = if flags.examples then true else false; buildable = if flags.examples then true else false;
modules = [ "Types" ];
hsSourceDirs = [ "examples/example02" ];
mainPath = [ "Main.hs" ] ++ [ "" ];
}; };
}; };
}; };

View file

@ -53,13 +53,6 @@ in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
description = ""; description = "";
buildType = "Simple"; buildType = "Simple";
isLocal = true; isLocal = true;
detailLevel = "FullDetails";
licenseFiles = [ "LICENSE" ];
dataDir = "";
dataFiles = [];
extraSrcFiles = [ "CHANGELOG.md" ];
extraTmpFiles = [];
extraDocFiles = [];
}; };
components = { components = {
exes = { exes = {
@ -69,12 +62,15 @@ in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
(hsPkgs."affection" or (buildDepError "affection")) (hsPkgs."affection" or (buildDepError "affection"))
(hsPkgs."sdl2" or (buildDepError "sdl2")) (hsPkgs."sdl2" or (buildDepError "sdl2"))
(hsPkgs."OpenGL" or (buildDepError "OpenGL")) (hsPkgs."OpenGL" or (buildDepError "OpenGL"))
(hsPkgs."GLUtil" or (buildDepError "GLUtil"))
(hsPkgs."JuicyPixels" or (buildDepError "JuicyPixels")) (hsPkgs."JuicyPixels" or (buildDepError "JuicyPixels"))
(hsPkgs."JuicyPixels-extra" or (buildDepError "JuicyPixels-extra")) (hsPkgs."JuicyPixels-extra" or (buildDepError "JuicyPixels-extra"))
(hsPkgs."stm" or (buildDepError "stm"))
(hsPkgs."containers" or (buildDepError "containers"))
(hsPkgs."linear" or (buildDepError "linear"))
(hsPkgs."bytestring" or (buildDepError "bytestring"))
]; ];
buildable = true; buildable = true;
hsSourceDirs = [ "app" ];
mainPath = [ "Main.hs" ];
}; };
}; };
}; };

View file

@ -2,13 +2,28 @@
{-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE AllowAmbiguousTypes #-}
module Classes.Renderable where module Classes.Renderable where
import qualified Graphics.Rendering.OpenGL as GL
import Linear
class Renderable a where class Renderable a where
type VertexObjects a :: * type VertexObjects a :: *
type ShaderObjects a :: * type ShaderObjects a :: *
init :: VertexObjects a -> ShaderObjects a -> a -> IO () init
:: VertexObjects a
-> ShaderObjects a
-> GL.TextureObject
-> a
-> IO ()
draw :: VertexObjects a -> ShaderObjects a -> a -> IO () draw
:: VertexObjects a
-> ShaderObjects a
-> a
-> IO ()
clean :: a -> IO () clean
:: a
-> IO ()

View file

@ -7,6 +7,7 @@ import SDL (($=))
import qualified SDL import qualified SDL
import qualified Graphics.Rendering.OpenGL as GL import qualified Graphics.Rendering.OpenGL as GL
import qualified Graphics.GLUtil as GLU
import Codec.Picture import Codec.Picture
@ -34,13 +35,13 @@ main =
, SDL.defaultWindow , SDL.defaultWindow
{ SDL.windowInitialSize = SDL.V2 1600 900 { SDL.windowInitialSize = SDL.V2 1600 900
, SDL.windowGraphicsContext = SDL.OpenGLContext SDL.defaultOpenGL , SDL.windowGraphicsContext = SDL.OpenGLContext SDL.defaultOpenGL
{ SDL.glProfile = SDL.Core SDL.Normal 3 3 { SDL.glProfile = SDL.Core SDL.Debug 3 3
} }
} }
) )
] ]
, initScreenMode = SDL.FullscreenDesktop , initScreenMode = SDL.FullscreenDesktop
, preLoop = return () , preLoop = preLoopImpl
, eventLoop = mapM_ handle , eventLoop = mapM_ handle
, updateLoop = updateLoopImpl , updateLoop = updateLoopImpl
, drawLoop = drawLoopImpl , drawLoop = drawLoopImpl
@ -49,10 +50,18 @@ main =
, canvasSize = Nothing , canvasSize = Nothing
} }
preLoopImpl :: Affection UserData ()
preLoopImpl = liftIO $ do
void $ SDL.setMouseLocationMode SDL.RelativeLocation
-- GL.depthFunc $= Just GL.Less
GL.textureFilter GL.Texture2D $= ((GL.Nearest, Nothing), GL.Nearest)
GLU.texture2DWrap $= (GL.Repeated, GL.ClampToEdge)
GL.texture GL.Texture2D $= GL.Enabled
-- GL.frontFace $= GL.CW
GL.viewport $= (GL.Position 0 0, GL.Size 1920 1080)
loadStateImpl :: IO UserData loadStateImpl :: IO UserData
loadStateImpl = do loadStateImpl = do
void $ SDL.setMouseLocationMode SDL.RelativeLocation
GL.depthFunc $= Just GL.Less
subs <- Subsystems subs <- Subsystems
<$> (SubWindow <$> newTVarIO []) <$> (SubWindow <$> newTVarIO [])
@ -73,11 +82,22 @@ updateLoopImpl dt = return ()
drawLoopImpl = do drawLoopImpl = do
ud@(UserData subs rassets) <- getAffection ud@(UserData subs rassets) <- getAffection
let (RenderAssets sDetails@(AssetDetails svo sso sdo)) = rassets let (RenderAssets sDetails@(AssetDetails svo sso sto sdo)) = rassets
liftIO $ do liftIO $ do
CR.init mapM_
(svo :: VertexObjects Sprite) (\ident -> do
(sso :: ShaderObjects Sprite) CR.init
(head $ M.elems sdo) (svo :: VertexObjects Sprite)
mapM_ (draw (svo :: VertexObjects Sprite) (sso :: ShaderObjects Sprite)) (M.elems sdo) (sso :: ShaderObjects Sprite)
clean (head $ M.elems sdo) (sto M.! ident)
(head (sdo M.! ident))
mapM_
(draw
(svo :: VertexObjects Sprite)
(sso :: ShaderObjects Sprite)
)
(sdo M.! ident)
clean
(head (sdo M.! ident))
)
(M.keys sdo)

View file

@ -1,3 +1,4 @@
{-# LANGUAGE OverloadedStrings #-}
module Renderer where module Renderer where
import SDL (($=)) import SDL (($=))
@ -40,21 +41,21 @@ initSpriteRenderObjects = do
, GL.VertexArrayDescriptor 4 GL.Float 0 (plusPtr nullPtr 0) , GL.VertexArrayDescriptor 4 GL.Float 0 (plusPtr nullPtr 0)
) )
GL.bindBuffer GL.ArrayBuffer $= Nothing -- GL.bindBuffer GL.ArrayBuffer $= Nothing
GL.bindVertexArrayObject $= Nothing GL.bindVertexArrayObject $= Nothing
return (SpriteRenderObjects quadVAO quadVBO) return (SpriteRenderObjects quadVAO quadVBO)
where
rawVertices :: [Float]
rawVertices =
[ 0, 1, 0, 0
, 1, 0, 1, 0
, 0, 0, 0, 0
, 0, 1, 0, 1 rawVertices :: [Float]
, 1, 1, 1, 1 rawVertices =
, 1, 0, 1, 0 [ 0, 1, 0, 1
] , 1, 0, 1, 0
, 0, 0, 0, 0
, 0, 1, 0, 1
, 1, 1, 1, 1
, 1, 0, 1, 0
]
initSpriteShaderObjects = do initSpriteShaderObjects = do
vertexShaderSrc <- BS.readFile "shader/vertex.sl" vertexShaderSrc <- BS.readFile "shader/vertex.sl"
@ -64,18 +65,59 @@ initSpriteShaderObjects = do
return (SpriteShaderObjects shaderProgram) return (SpriteShaderObjects shaderProgram)
initSpriteTextureObjects
:: [(String, FilePath)]
-> IO (M.Map AssetId (GL.TextureObject, V2 Int))
initSpriteTextureObjects lookupList = do
M.fromList <$> mapM
(\(name, fp) -> do
-- texture <- Gl.genObjectName
-- GL.bindBuffer GL.ArrayBuffer $= Just texture
-- withArray rawVertices $ \ptr ->
-- GL.bufferData GL.ArrayBuffer $=
-- ( fromIntegral $ length rawVertices * sizeof (0 :: Float)
-- , ptr
-- , GL.StaticDraw
-- )
-- GL.vertexAttribPointer (GL.AttribLocation 1) $=
-- ( GL.ToFloat
-- , GL.VertexArrayDescriptor 2 GL.Float 0 (plusPtr nullPtr 0)
-- )
ts <- loadTex fp
return (name, ts)
)
lookupList
loadTex :: FilePath -> IO (GL.TextureObject, V2 Int)
loadTex fp = do
t <- either error id <$> GLU.readTexture fp
img <- convertRGBA8 <$> either error id <$> readImage fp
let size = V2 (imageWidth img) (imageHeight img)
return (t, size)
loadSprites :: IO (AssetDetails SpriteRenderObjects SpriteShaderObjects Sprite) loadSprites :: IO (AssetDetails SpriteRenderObjects SpriteShaderObjects Sprite)
loadSprites = do loadSprites = do
rawImg <- readImage "assets/img/lynx.jpg" let lookups =
let img = case rawImg of [ ("lynx", "assets/img/lynx.png")
Left err -> error err ]
Right dynImg -> convertRGBA8 dynImg positions =
[ (V2 0 0)
]
vertObj <- initSpriteRenderObjects vertObj <- initSpriteRenderObjects
shadObj <- initSpriteShaderObjects shadObj <- initSpriteShaderObjects
textObj <- initSpriteTextureObjects lookups
return AssetDetails return AssetDetails
{ adVertObj = vertObj { adVertObj = vertObj
, adShadObj = shadObj , adShadObj = shadObj
, adDataObj = M.singleton "lynx" (Sprite (V2 0 0) img) , adTextObj = M.fromList $ map (\(k, v) -> (k, fst v)) (M.assocs textObj)
, adDataObj = M.fromList $
map
(\(k, v) ->
( k
, map (\pos -> Sprite pos (snd v)) positions
)
)
(M.assocs textObj)
} }

View file

@ -25,7 +25,7 @@ data SpriteShaderObjects = SpriteShaderObjects
data Sprite = Sprite data Sprite = Sprite
{ spritePosition :: V2 Int { spritePosition :: V2 Int
, spriteImage :: Image PixelRGBA8 , spriteSize :: V2 Int
} }
instance Renderable Sprite where instance Renderable Sprite where
@ -33,20 +33,34 @@ instance Renderable Sprite where
type ShaderObjects Sprite = SpriteShaderObjects type ShaderObjects Sprite = SpriteShaderObjects
init (SpriteRenderObjects vao vbo) (SpriteShaderObjects prog) _ = do init
GL.currentProgram $= Just (GLU.program prog) (SpriteRenderObjects vao vbo)
GL.bindVertexArrayObject $= Just vao (SpriteShaderObjects prog)
texture
_ = do
GL.currentProgram $= Just (GLU.program prog)
GL.bindVertexArrayObject $= Just vao
GL.activeTexture $= GL.TextureUnit 0
GL.textureBinding GL.Texture2D $= Just texture
GL.clearColor $= GL.Color4 1 1 1 1
draw draw
(SpriteRenderObjects vao vbo) (SpriteRenderObjects vao vbo)
(SpriteShaderObjects prog) (SpriteShaderObjects prog)
(Sprite pos@(V2 px py) img) = do (Sprite pos@(V2 px py) size) = do
let model = mkTransformation let (V2 sx sy) = fmap fromIntegral size
(Quaternion 1 (V3 0 0 0) :: Quaternion Float) model = fmap (fmap fromIntegral) $ V4
(fmap fromIntegral $ V3 px py 0 :: V3 Float) (V4 sx 0 0 px)
GLU.setUniform prog "model" model (V4 0 sy 0 py)
(V4 0 0 1 0)
(V4 0 0 0 1)
:: M44 Float
projection = ortho (-1920) 1920 (-1080) 1080 (-1) 1
putStrLn $ show model
GLU.setUniform prog "pm" (projection !*! model)
GL.drawArrays GL.Triangles 0 6 GL.drawArrays GL.Triangles 0 6
clean _ = do clean _ = do
GL.currentProgram $= (Nothing :: Maybe GL.Program) GL.currentProgram $= (Nothing :: Maybe GL.Program)
GL.bindVertexArrayObject $= (Nothing :: Maybe GL.VertexArrayObject) GL.bindVertexArrayObject $= (Nothing :: Maybe GL.VertexArrayObject)
GL.texture GL.Texture2D $= GL.Disabled

View file

@ -4,12 +4,16 @@ module Types.UserData where
import Affection import Affection
import qualified Graphics.Rendering.OpenGL as GL
import Control.Concurrent.STM import Control.Concurrent.STM
import qualified SDL import qualified SDL
import qualified Data.Map.Strict as M import qualified Data.Map.Strict as M
import Linear
import Codec.Picture import Codec.Picture
-- internal imports -- internal imports
@ -30,7 +34,8 @@ data RenderAssets = RenderAssets
data Renderable dat => AssetDetails vo so dat = AssetDetails data Renderable dat => AssetDetails vo so dat = AssetDetails
{ adVertObj :: vo { adVertObj :: vo
, adShadObj :: so , adShadObj :: so
, adDataObj :: M.Map AssetId dat , adTextObj :: M.Map AssetId GL.TextureObject
, adDataObj :: M.Map AssetId [dat]
} }
type AssetId = String type AssetId = String

BIN
assets/img/lynx.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 838 KiB

BIN
assets/img/lynx.tga Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

View file

@ -25,6 +25,7 @@ executable canvas
Classes.Renderable Classes.Renderable
Renderer Renderer
-- other-extensions: -- other-extensions:
ghc-options: -Wall
build-depends: base ^>=4.12.0.0 build-depends: base ^>=4.12.0.0
, affection , affection
, sdl2 ^>=2.5.0.0 , sdl2 ^>=2.5.0.0

View file

@ -17,13 +17,35 @@ let
pkgs = pkgs1 // pkgs2; pkgs = pkgs1 // pkgs2;
cabal-doctest = (hackage: {
cabal-doctest = hackage.cabal-doctest."1.0.8".revisions.default;
});
gtk2hs-buildtools = (hackage: {
gtk2hs-buildtools = hackage.gtk2hs-buildtools."0.13.8.0".revisions.default;
});
hashtables = (hackage: {
hashtables = hackage.hashtables."1.2.3.4".revisions.default;
});
alex = (hackage: {
alex = hackage.alex."3.2.5".revisions.default;
});
happy = (hackage: {
happy = hackage.happy."1.19.12".revisions.default;
});
# Import the file you will create in the stack-to-nix or cabal-to-nix step. # Import the file you will create in the stack-to-nix or cabal-to-nix step.
my-pkgs = import ./pkgs.nix; my-pkgs = import ./pkgs.nix;
# Cabal projects use this: # Cabal projects use this:
pkgSet = pkgs.haskell-nix.mkCabalProjectPkgSet { pkgSet = pkgs.haskell-nix.mkCabalProjectPkgSet {
plan-pkgs = my-pkgs; plan-pkgs = my-pkgs;
pkg-def-extras = []; pkg-def-extras = [
cabal-doctest
gtk2hs-buildtools
hashtables
alex
happy
];
modules = [ modules = [
# specific package overrides would go here # specific package overrides would go here
# example: # example:

175
pkgs.nix
View file

@ -3,181 +3,79 @@
{ {
packages = { packages = {
"void".revision = (((hackage."void")."0.7.3").revisions).default; "void".revision = (((hackage."void")."0.7.3").revisions).default;
"void".flags.safe = false;
"semigroupoids".revision = (((hackage."semigroupoids")."5.3.4").revisions).default; "semigroupoids".revision = (((hackage."semigroupoids")."5.3.4").revisions).default;
"semigroupoids".flags.comonad = true;
"semigroupoids".flags.doctests = true;
"semigroupoids".flags.unordered-containers = true;
"semigroupoids".flags.distributive = true;
"semigroupoids".flags.tagged = true;
"semigroupoids".flags.containers = true;
"semigroupoids".flags.contravariant = true;
"free".revision = (((hackage."free")."5.1.3").revisions).default; "free".revision = (((hackage."free")."5.1.3").revisions).default;
"cereal".revision = (((hackage."cereal")."0.5.8.1").revisions).default; "cereal".revision = (((hackage."cereal")."0.5.8.1").revisions).default;
"cereal".flags.bytestring-builder = false;
"exceptions".revision = (((hackage."exceptions")."0.10.4").revisions).default; "exceptions".revision = (((hackage."exceptions")."0.10.4").revisions).default;
"exceptions".flags.transformers-0-4 = true;
"hashtables".revision = (((hackage."hashtables")."1.2.3.4").revisions).default;
"hashtables".flags.portable = false;
"hashtables".flags.detailed-profiling = false;
"hashtables".flags.sse42 = false;
"hashtables".flags.debug = false;
"hashtables".flags.bounds-checking = false;
"hashtables".flags.unsafe-tricks = true;
"binary".revision = (((hackage."binary")."0.8.6.0").revisions).default; "binary".revision = (((hackage."binary")."0.8.6.0").revisions).default;
"monad-parallel".revision = (((hackage."monad-parallel")."0.7.2.3").revisions).default; "monad-parallel".revision = (((hackage."monad-parallel")."0.7.2.3").revisions).default;
"ghc-prim".revision = (((hackage."ghc-prim")."0.5.3").revisions).default; "ghc-prim".revision = (((hackage."ghc-prim")."0.5.3").revisions).default;
"utf8-string".revision = (((hackage."utf8-string")."1.0.1.1").revisions).default; "utf8-string".revision = (((hackage."utf8-string")."1.0.1.1").revisions).default;
"bifunctors".revision = (((hackage."bifunctors")."5.5.7").revisions).default; "bifunctors".revision = (((hackage."bifunctors")."5.5.7").revisions).default;
"bifunctors".flags.semigroups = true;
"bifunctors".flags.tagged = true;
"ObjectName".revision = (((hackage."ObjectName")."1.1.0.1").revisions).default; "ObjectName".revision = (((hackage."ObjectName")."1.1.0.1").revisions).default;
"stm".revision = (((hackage."stm")."2.5.0.0").revisions).default; "stm".revision = (((hackage."stm")."2.5.0.0").revisions).default;
"unix".revision = (((hackage."unix")."2.7.2.2").revisions).default; "unix".revision = (((hackage."unix")."2.7.2.2").revisions).default;
"mtl".revision = (((hackage."mtl")."2.2.2").revisions).default; "mtl".revision = (((hackage."mtl")."2.2.2").revisions).default;
"linear".revision = (((hackage."linear")."1.20.9").revisions).default; "linear".revision = (((hackage."linear")."1.21").revisions).default;
"linear".flags.template-haskell = true;
"linear".flags.herbie = false;
"network-info".revision = (((hackage."network-info")."0.2.0.10").revisions).default; "network-info".revision = (((hackage."network-info")."0.2.0.10").revisions).default;
"zlib".revision = (((hackage."zlib")."0.6.2.1").revisions).default; "zlib".revision = (((hackage."zlib")."0.6.2.1").revisions).default;
"zlib".flags.non-blocking-ffi = false;
"zlib".flags.pkg-config = false;
"rts".revision = (((hackage."rts")."1.0").revisions).default; "rts".revision = (((hackage."rts")."1.0").revisions).default;
"alex".revision = (((hackage."alex")."3.2.5").revisions).default;
"alex".flags.small_base = true;
"clock".revision = (((hackage."clock")."0.8").revisions).default; "clock".revision = (((hackage."clock")."0.8").revisions).default;
"clock".flags.llvm = false;
"adjunctions".revision = (((hackage."adjunctions")."4.4").revisions).default; "adjunctions".revision = (((hackage."adjunctions")."4.4").revisions).default;
"cryptohash-md5".revision = (((hackage."cryptohash-md5")."0.11.100.1").revisions).default; "cryptohash-md5".revision = (((hackage."cryptohash-md5")."0.11.100.1").revisions).default;
"invariant".revision = (((hackage."invariant")."0.5.3").revisions).default; "invariant".revision = (((hackage."invariant")."0.5.3").revisions).default;
"glib".revision = (((hackage."glib")."0.13.8.0").revisions).default; "glib".revision = (((hackage."glib")."0.13.8.0").revisions).default;
"glib".flags.closure_signals = true;
"distributive".revision = (((hackage."distributive")."0.6.1").revisions).default; "distributive".revision = (((hackage."distributive")."0.6.1").revisions).default;
"distributive".flags.semigroups = true;
"distributive".flags.tagged = true;
"binary-orphans".revision = (((hackage."binary-orphans")."1.0.1").revisions).default; "binary-orphans".revision = (((hackage."binary-orphans")."1.0.1").revisions).default;
"OpenGLRaw".revision = (((hackage."OpenGLRaw")."3.3.4.0").revisions).default; "OpenGLRaw".revision = (((hackage."OpenGLRaw")."3.3.4.0").revisions).default;
"OpenGLRaw".flags.osandroid = false;
"OpenGLRaw".flags.usenativewindowslibraries = true;
"OpenGLRaw".flags.usegles2 = true;
"OpenGLRaw".flags.useglxgetprocaddress = true;
"scientific".revision = (((hackage."scientific")."0.3.6.2").revisions).default; "scientific".revision = (((hackage."scientific")."0.3.6.2").revisions).default;
"scientific".flags.integer-simple = false;
"scientific".flags.bytestring-builder = false;
"half".revision = (((hackage."half")."0.3").revisions).default; "half".revision = (((hackage."half")."0.3").revisions).default;
"parallel".revision = (((hackage."parallel")."3.2.2.0").revisions).default; "parallel".revision = (((hackage."parallel")."3.2.2.0").revisions).default;
"deepseq".revision = (((hackage."deepseq")."1.4.4.0").revisions).default; "deepseq".revision = (((hackage."deepseq")."1.4.4.0").revisions).default;
"random".revision = (((hackage."random")."1.1").revisions).default; "random".revision = (((hackage."random")."1.1").revisions).default;
"uuid-types".revision = (((hackage."uuid-types")."1.0.3").revisions).default; "uuid-types".revision = (((hackage."uuid-types")."1.0.3").revisions).default;
"semigroups".revision = (((hackage."semigroups")."0.19.1").revisions).default; "semigroups".revision = (((hackage."semigroups")."0.19.1").revisions).default;
"semigroups".flags.bytestring = true;
"semigroups".flags.unordered-containers = true;
"semigroups".flags.text = true;
"semigroups".flags.tagged = true;
"semigroups".flags.containers = true;
"semigroups".flags.binary = true;
"semigroups".flags.hashable = true;
"semigroups".flags.transformers = true;
"semigroups".flags.deepseq = true;
"semigroups".flags.bytestring-builder = false;
"semigroups".flags.template-haskell = true;
"parsec".revision = (((hackage."parsec")."3.1.13.0").revisions).default;
"directory".revision = (((hackage."directory")."1.3.3.0").revisions).default; "directory".revision = (((hackage."directory")."1.3.3.0").revisions).default;
"transformers-compat".revision = (((hackage."transformers-compat")."0.6.5").revisions).default; "transformers-compat".revision = (((hackage."transformers-compat")."0.6.5").revisions).default;
"transformers-compat".flags.five = false;
"transformers-compat".flags.generic-deriving = true;
"transformers-compat".flags.two = false;
"transformers-compat".flags.five-three = true;
"transformers-compat".flags.mtl = true;
"transformers-compat".flags.four = false;
"transformers-compat".flags.three = false;
"template-haskell".revision = (((hackage."template-haskell")."2.14.0.0").revisions).default; "template-haskell".revision = (((hackage."template-haskell")."2.14.0.0").revisions).default;
"bytes".revision = (((hackage."bytes")."0.16").revisions).default; "bytes".revision = (((hackage."bytes")."0.16").revisions).default;
"bytes".flags.test-doctests = true; "vector".revision = (((hackage."vector")."0.12.1.2").revisions).default;
"vector".revision = (((hackage."vector")."0.12.1.1").revisions).default;
"vector".flags.unsafechecks = false;
"vector".flags.internalchecks = false;
"vector".flags.wall = false;
"vector".flags.boundschecks = true;
"call-stack".revision = (((hackage."call-stack")."0.2.0").revisions).default; "call-stack".revision = (((hackage."call-stack")."0.2.0").revisions).default;
"primitive".revision = (((hackage."primitive")."0.7.0.0").revisions).default; "primitive".revision = (((hackage."primitive")."0.7.0.0").revisions).default;
"gtk2hs-buildtools".revision = (((hackage."gtk2hs-buildtools")."0.13.8.0").revisions).default;
"gtk2hs-buildtools".flags.closuresignals = true;
"profunctors".revision = (((hackage."profunctors")."5.5.1").revisions).default; "profunctors".revision = (((hackage."profunctors")."5.5.1").revisions).default;
"tagged".revision = (((hackage."tagged")."0.8.6").revisions).default; "tagged".revision = (((hackage."tagged")."0.8.6").revisions).default;
"tagged".flags.transformers = true; "lens".revision = (((hackage."lens")."4.19").revisions).default;
"tagged".flags.deepseq = true;
"lens".revision = (((hackage."lens")."4.18.1").revisions).default;
"lens".flags.j = false;
"lens".flags.test-properties = true;
"lens".flags.old-inline-pragmas = false;
"lens".flags.test-templates = true;
"lens".flags.trustworthy = true;
"lens".flags.test-doctests = true;
"lens".flags.benchmark-uniplate = false;
"lens".flags.inlining = true;
"lens".flags.dump-splices = false;
"lens".flags.test-hunit = true;
"lens".flags.safe = false;
"containers".revision = (((hackage."containers")."0.6.0.1").revisions).default; "containers".revision = (((hackage."containers")."0.6.0.1").revisions).default;
"integer-logarithms".revision = (((hackage."integer-logarithms")."1.0.3").revisions).default; "integer-logarithms".revision = (((hackage."integer-logarithms")."1.0.3").revisions).default;
"integer-logarithms".flags.check-bounds = false;
"integer-logarithms".flags.integer-gmp = true;
"reflection".revision = (((hackage."reflection")."2.1.5").revisions).default; "reflection".revision = (((hackage."reflection")."2.1.5").revisions).default;
"reflection".flags.slow = false;
"reflection".flags.template-haskell = true;
"OpenGL".revision = (((hackage."OpenGL")."3.0.3.0").revisions).default; "OpenGL".revision = (((hackage."OpenGL")."3.0.3.0").revisions).default;
"bytestring".revision = (((hackage."bytestring")."0.10.8.2").revisions).default; "bytestring".revision = (((hackage."bytestring")."0.10.8.2").revisions).default;
"GLUtil".revision = (((hackage."GLUtil")."0.10.3").revisions).default;
"JuicyPixels".revision = (((hackage."JuicyPixels")."3.3.4").revisions).default; "JuicyPixels".revision = (((hackage."JuicyPixels")."3.3.4").revisions).default;
"JuicyPixels".flags.mmap = false;
"cryptohash-sha1".revision = (((hackage."cryptohash-sha1")."0.11.100.1").revisions).default; "cryptohash-sha1".revision = (((hackage."cryptohash-sha1")."0.11.100.1").revisions).default;
"StateVar".revision = (((hackage."StateVar")."1.2").revisions).default; "StateVar".revision = (((hackage."StateVar")."1.2").revisions).default;
"contravariant".revision = (((hackage."contravariant")."1.5.2").revisions).default; "contravariant".revision = (((hackage."contravariant")."1.5.2").revisions).default;
"contravariant".flags.semigroups = true;
"contravariant".flags.tagged = true;
"contravariant".flags.statevar = true;
"GLURaw".revision = (((hackage."GLURaw")."2.0.0.4").revisions).default; "GLURaw".revision = (((hackage."GLURaw")."2.0.0.4").revisions).default;
"GLURaw".flags.usenativewindowslibraries = true;
"type-equality".revision = (((hackage."type-equality")."1").revisions).default;
"uuid".revision = (((hackage."uuid")."1.3.13").revisions).default; "uuid".revision = (((hackage."uuid")."1.3.13").revisions).default;
"text".revision = (((hackage."text")."1.2.3.1").revisions).default; "text".revision = (((hackage."text")."1.2.3.1").revisions).default;
"Cabal".revision = (((hackage."Cabal")."2.4.0.1").revisions).default;
"unordered-containers".revision = (((hackage."unordered-containers")."0.2.10.0").revisions).default; "unordered-containers".revision = (((hackage."unordered-containers")."0.2.10.0").revisions).default;
"unordered-containers".flags.debug = false;
"base".revision = (((hackage."base")."4.12.0.0").revisions).default; "base".revision = (((hackage."base")."4.12.0.0").revisions).default;
"comonad".revision = (((hackage."comonad")."5.0.6").revisions).default; "comonad".revision = (((hackage."comonad")."5.0.6").revisions).default;
"comonad".flags.distributive = true;
"comonad".flags.test-doctests = true;
"comonad".flags.containers = true;
"time".revision = (((hackage."time")."1.8.0.2").revisions).default; "time".revision = (((hackage."time")."1.8.0.2").revisions).default;
"transformers".revision = (((hackage."transformers")."0.5.6.2").revisions).default; "transformers".revision = (((hackage."transformers")."0.5.6.2").revisions).default;
"hashable".revision = (((hackage."hashable")."1.3.0.0").revisions).default; "hashable".revision = (((hackage."hashable")."1.3.0.0").revisions).default;
"hashable".flags.sse2 = true;
"hashable".flags.integer-gmp = true;
"hashable".flags.sse41 = false;
"hashable".flags.examples = false;
"JuicyPixels-extra".revision = (((hackage."JuicyPixels-extra")."0.4.1").revisions).default; "JuicyPixels-extra".revision = (((hackage."JuicyPixels-extra")."0.4.1").revisions).default;
"JuicyPixels-extra".flags.dev = false;
"transformers-base".revision = (((hackage."transformers-base")."0.4.5.2").revisions).default; "transformers-base".revision = (((hackage."transformers-base")."0.4.5.2").revisions).default;
"transformers-base".flags.orphaninstances = true; "hpp".revision = (((hackage."hpp")."0.6.1").revisions).default;
"happy".revision = (((hackage."happy")."1.19.12").revisions).default;
"happy".flags.small_base = true;
"entropy".revision = (((hackage."entropy")."0.4.1.5").revisions).default; "entropy".revision = (((hackage."entropy")."0.4.1.5").revisions).default;
"entropy".flags.halvm = false;
"filepath".revision = (((hackage."filepath")."1.4.2.1").revisions).default; "filepath".revision = (((hackage."filepath")."1.4.2.1").revisions).default;
"monad-loops".revision = (((hackage."monad-loops")."0.4.3").revisions).default; "monad-loops".revision = (((hackage."monad-loops")."0.4.3").revisions).default;
"monad-loops".flags.base4 = true;
"process".revision = (((hackage."process")."1.6.5.0").revisions).default;
"kan-extensions".revision = (((hackage."kan-extensions")."5.2").revisions).default; "kan-extensions".revision = (((hackage."kan-extensions")."5.2").revisions).default;
"fixed".revision = (((hackage."fixed")."0.3").revisions).default; "fixed".revision = (((hackage."fixed")."0.3").revisions).default;
"pretty".revision = (((hackage."pretty")."1.1.3.6").revisions).default; "pretty".revision = (((hackage."pretty")."1.1.3.6").revisions).default;
"cabal-doctest".revision = (((hackage."cabal-doctest")."1.0.8").revisions).default;
"ghc-boot-th".revision = (((hackage."ghc-boot-th")."8.6.5").revisions).default; "ghc-boot-th".revision = (((hackage."ghc-boot-th")."8.6.5").revisions).default;
"base-orphans".revision = (((hackage."base-orphans")."0.8.2").revisions).default; "base-orphans".revision = (((hackage."base-orphans")."0.8.2").revisions).default;
"sdl2".revision = (((hackage."sdl2")."2.5.0.0").revisions).default; "sdl2".revision = (((hackage."sdl2")."2.5.1.0").revisions).default;
"sdl2".flags.no-linear = false;
"sdl2".flags.opengl-example = false;
"sdl2".flags.examples = false;
"th-abstraction".revision = (((hackage."th-abstraction")."0.3.1.0").revisions).default; "th-abstraction".revision = (((hackage."th-abstraction")."0.3.1.0").revisions).default;
"array".revision = (((hackage."array")."0.5.3.0").revisions).default; "array".revision = (((hackage."array")."0.5.3.0").revisions).default;
"integer-gmp".revision = (((hackage."integer-gmp")."1.0.2.0").revisions).default; "integer-gmp".revision = (((hackage."integer-gmp")."1.0.2.0").revisions).default;
@ -186,26 +84,81 @@
version = "8.6.5"; version = "8.6.5";
nix-name = "ghc865"; nix-name = "ghc865";
packages = { packages = {
"void" = "0.7.3";
"semigroupoids" = "5.3.4";
"free" = "5.1.3";
"cereal" = "0.5.8.1";
"exceptions" = "0.10.4";
"binary" = "0.8.6.0"; "binary" = "0.8.6.0";
"monad-parallel" = "0.7.2.3";
"ghc-prim" = "0.5.3"; "ghc-prim" = "0.5.3";
"utf8-string" = "1.0.1.1";
"bifunctors" = "5.5.7";
"ObjectName" = "1.1.0.1";
"stm" = "2.5.0.0";
"unix" = "2.7.2.2"; "unix" = "2.7.2.2";
"mtl" = "2.2.2"; "mtl" = "2.2.2";
"linear" = "1.21";
"network-info" = "0.2.0.10";
"zlib" = "0.6.2.1";
"rts" = "1.0"; "rts" = "1.0";
"clock" = "0.8";
"adjunctions" = "4.4";
"cryptohash-md5" = "0.11.100.1";
"invariant" = "0.5.3";
"glib" = "0.13.8.0";
"distributive" = "0.6.1";
"binary-orphans" = "1.0.1";
"OpenGLRaw" = "3.3.4.0";
"scientific" = "0.3.6.2";
"half" = "0.3";
"parallel" = "3.2.2.0";
"deepseq" = "1.4.4.0"; "deepseq" = "1.4.4.0";
"parsec" = "3.1.13.0"; "random" = "1.1";
"uuid-types" = "1.0.3";
"semigroups" = "0.19.1";
"directory" = "1.3.3.0"; "directory" = "1.3.3.0";
"transformers-compat" = "0.6.5";
"template-haskell" = "2.14.0.0"; "template-haskell" = "2.14.0.0";
"bytes" = "0.16";
"vector" = "0.12.1.2";
"call-stack" = "0.2.0";
"primitive" = "0.7.0.0";
"profunctors" = "5.5.1";
"tagged" = "0.8.6";
"lens" = "4.19";
"containers" = "0.6.0.1"; "containers" = "0.6.0.1";
"integer-logarithms" = "1.0.3";
"reflection" = "2.1.5";
"OpenGL" = "3.0.3.0";
"bytestring" = "0.10.8.2"; "bytestring" = "0.10.8.2";
"GLUtil" = "0.10.3";
"JuicyPixels" = "3.3.4";
"cryptohash-sha1" = "0.11.100.1";
"StateVar" = "1.2";
"contravariant" = "1.5.2";
"GLURaw" = "2.0.0.4";
"uuid" = "1.3.13";
"text" = "1.2.3.1"; "text" = "1.2.3.1";
"Cabal" = "2.4.0.1"; "unordered-containers" = "0.2.10.0";
"base" = "4.12.0.0"; "base" = "4.12.0.0";
"comonad" = "5.0.6";
"time" = "1.8.0.2"; "time" = "1.8.0.2";
"transformers" = "0.5.6.2"; "transformers" = "0.5.6.2";
"hashable" = "1.3.0.0";
"JuicyPixels-extra" = "0.4.1";
"transformers-base" = "0.4.5.2";
"hpp" = "0.6.1";
"entropy" = "0.4.1.5";
"filepath" = "1.4.2.1"; "filepath" = "1.4.2.1";
"process" = "1.6.5.0"; "monad-loops" = "0.4.3";
"kan-extensions" = "5.2";
"fixed" = "0.3";
"pretty" = "1.1.3.6"; "pretty" = "1.1.3.6";
"ghc-boot-th" = "8.6.5"; "ghc-boot-th" = "8.6.5";
"base-orphans" = "0.8.2";
"sdl2" = "2.5.1.0";
"th-abstraction" = "0.3.1.0";
"array" = "0.5.3.0"; "array" = "0.5.3.0";
"integer-gmp" = "1.0.2.0"; "integer-gmp" = "1.0.2.0";
}; };

View file

@ -7,6 +7,6 @@ uniform sampler2D image;
void main() void main()
{ {
//color = vec4(spriteColor, 1.0) * texture(image, TexCoords); //color = vec4(0.0, 0.0, 0.0, 1.0) * texture2D(image, TexCoords);
color = texture(image, TexCoords); color = texture2D(image, vec2(TexCoords.x, 1.0 - TexCoords.y));
} }

View file

@ -3,11 +3,12 @@ layout (location = 0) in vec4 vertex; // <vec2 position, vec2 texCoords>
out vec2 TexCoords; out vec2 TexCoords;
uniform mat4 model; uniform mat4 pm;
uniform mat4 projection; //uniform mat4 projection;
void main() void main()
{ {
TexCoords = vertex.zw; TexCoords = vertex.zw;
gl_Position = projection * model * vec4(vertex.xy, 0.0, 1.0); //gl_Position = projection * model * vec4(vertex.xy, 0.0, 1.0);
gl_Position = pm * vec4(vertex.xy, 0.0, 1.0);
} }