minimal window(s)
This commit is contained in:
parent
a5fc7c2dbe
commit
1da8a65028
|
@ -26,6 +26,8 @@ executable ibis
|
||||||
, poppler
|
, poppler
|
||||||
, sdl2
|
, sdl2
|
||||||
, linear
|
, linear
|
||||||
|
, monad-loops
|
||||||
|
, OpenGL
|
||||||
, text
|
, text
|
||||||
hs-source-dirs: src
|
hs-source-dirs: src
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
|
|
@ -26,8 +26,8 @@ let
|
||||||
|
|
||||||
inherit (nixpkgs) pkgs;
|
inherit (nixpkgs) pkgs;
|
||||||
|
|
||||||
f = { mkDerivation, base, linear, optparse-applicative, poppler, stdenv,
|
f = { mkDerivation, base, linear, monad-loops, optparse-applicative, OpenGL,
|
||||||
text
|
poppler, stdenv, text
|
||||||
}:
|
}:
|
||||||
mkDerivation {
|
mkDerivation {
|
||||||
pname = "ibis";
|
pname = "ibis";
|
||||||
|
@ -35,8 +35,8 @@ let
|
||||||
src = ./.;
|
src = ./.;
|
||||||
isLibrary = false;
|
isLibrary = false;
|
||||||
isExecutable = true;
|
isExecutable = true;
|
||||||
executableHaskellDepends = [ base linear sdl2 optparse-applicative
|
executableHaskellDepends = [ base linear sdl2 monad-loops
|
||||||
poppler text ];
|
OpenGL optparse-applicative poppler text ];
|
||||||
description = "A pdf presenter";
|
description = "A pdf presenter";
|
||||||
license = stdenv.lib.licenses.gpl3;
|
license = stdenv.lib.licenses.gpl3;
|
||||||
};
|
};
|
||||||
|
|
13
src/Main.hs
13
src/Main.hs
|
@ -4,11 +4,16 @@ import qualified SDL
|
||||||
import qualified SDL.Raw.Video as SDL (glSetAttribute)
|
import qualified SDL.Raw.Video as SDL (glSetAttribute)
|
||||||
import qualified SDL.Raw.Enum as SDL
|
import qualified SDL.Raw.Enum as SDL
|
||||||
|
|
||||||
|
import qualified Graphics.Rendering.OpenGL as GL (clear, flush, ClearBuffer(..))
|
||||||
|
|
||||||
import Linear
|
import Linear
|
||||||
|
|
||||||
import Options.Applicative
|
import Options.Applicative
|
||||||
|
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
|
import Control.Monad.Loops
|
||||||
|
|
||||||
|
import Control.Concurrent.MVar
|
||||||
|
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
|
|
||||||
|
@ -48,3 +53,11 @@ main = do
|
||||||
void $ SDL.glSetAttribute SDL.SDL_GL_SHARE_WITH_CURRENT_CONTEXT 1
|
void $ SDL.glSetAttribute SDL.SDL_GL_SHARE_WITH_CURRENT_CONTEXT 1
|
||||||
contexts <- zip (map fst wins) <$> mapM (SDL.glCreateContext . snd) wins
|
contexts <- zip (map fst wins) <$> mapM (SDL.glCreateContext . snd) wins
|
||||||
mapM_ (SDL.showWindow . snd) wins
|
mapM_ (SDL.showWindow . snd) wins
|
||||||
|
run <- newMVar True
|
||||||
|
whileM_ (readMVar run) (do
|
||||||
|
GL.clear [GL.ColorBuffer, GL.DepthBuffer, GL.StencilBuffer]
|
||||||
|
GL.flush
|
||||||
|
mapM_ (SDL.glSwapWindow . snd) wins
|
||||||
|
)
|
||||||
|
mapM_ (SDL.glDeleteContext . snd) contexts
|
||||||
|
mapM_ (SDL.destroyWindow . snd) wins
|
||||||
|
|
Loading…
Reference in New Issue