post-presentation cleanup

This commit is contained in:
nek0 2018-09-25 00:13:09 +02:00
parent 48b8aaf379
commit b6e4bd543f
4 changed files with 80 additions and 116 deletions

2
cabal.project Normal file
View file

@ -0,0 +1,2 @@
packages: ./
../affection/

165
shell.nix
View file

@ -4,130 +4,87 @@ let
inherit (nixpkgs) pkgs;
sdl2Nek0 = with haskellPackages; callPackage (
{ mkDerivation, base, bytestring, exceptions, linear, SDL2
, StateVar, stdenv, text, transformers, vector
provideOldHaskellAttributeNames = true;
aff = with haskellPackages; callPackage(
{ mkDerivation, base, bytestring, clock, containers, fetchgit, glib
, linear, monad-loops, monad-parallel, mtl, OpenGL, stdenv
, stm, text, uuid, vector
}:
mkDerivation {
pname = "affection";
version = "0.0.0.9";
src = fetchgit {
url = "https://github.com/nek0/affection";
sha256 = "16s1i0aa5xzrxliynfs1c0s7pb9pmmpyan8v6968hyx4h377b1p6";
rev = "a6c314f3ac1b5fd9ccc2fbe8fe54b153b27c84c9";
fetchSubmodules = true;
};
configureFlags = [ "-fdebug" ];
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [
base bytestring clock containers glib linear monad-loops
monad-parallel mtl OpenGL sdl stm text uuid vector
];
homepage = "https://github.com/nek0/affection#readme";
description = "A simple Game Engine using SDL";
license = stdenv.lib.licenses.lgpl3;
}) {};
sdl = with haskellPackages; callPackage(
{ mkDerivation, base, bytestring, deepseq, exceptions, linear
, StateVar, stdenv, text, transformers, vector, weigh, pkgconfig
}:
mkDerivation {
pname = "sdl2";
version = "2.4.0.1";
sha256 = "9a898d0acd6d7a4f341b3127d2c44e64b577e1128bc0b4d93a17ac510cb5644d";
version = "2.4.1.0";
sha256 = "21a569c0c19f8ff2bbe1cf1d3eb32f65e8143806de353cedd240df5e9d088b5c";
isLibrary = true;
isExecutable = true;
enableSeparateDataOutput = true;
libraryHaskellDepends = [
base bytestring exceptions linear StateVar text transformers vector
];
buildDepends = [ pkgconfig ];
librarySystemDepends = [ nixpkgs.SDL2 pkgconfig ];
libraryPkgconfigDepends = [ nixpkgs.SDL2 pkgconfig ];
testHaskellDepends = [ base deepseq linear vector weigh ];
doCheck = false;
librarySystemDepends = [ SDL2 ];
libraryPkgconfigDepends = [ SDL2 ];
description = "Both high- and low-level bindings to the SDL library (version 2.0.4+).";
license = stdenv.lib.licenses.bsd3;
}) {};
nanovgNeko = with haskellPackages; callPackage ({
mkDerivation, base, bytestring, c2hs, containers, glew, hspec,
inline-c, libGL, libGLU, QuickCheck, text, vector, pkgconfig }:
nano = with haskellPackages; callPackage(
{ mkDerivation, base, bytestring, c2hs, containers, fetchgit
, glew, hspec, inline-c, libGL, libGLU, QuickCheck, stdenv, text
, vector
}:
mkDerivation {
pname = "nanovg";
version = "0.6.0.0";
sha256 = "e35a2772f2a2e71916013cab70eeb8eedd6f66b5490ddf7ce237c8c76895d496";
editedCabalFile = "1lhfsq50r9bdby7mfscw8ih3wsz2m19lr2a2z9b6diaf5kz76vij";
revision = "1";
src = fetchgit {
url = "https://github.com/nek0/nanovg-hs.git";
sha256 = "1lh7y7n97md585y7wic4sn240ifpdmcgfrvyvmmdngaz4s8zy47f";
rev = "09b613ab382e73e401ed8c2bbf936b39a92a17e1";
fetchSubmodules = true;
};
isLibrary = true;
isExecutable = true;
doCheck = false;
libraryHaskellDepends = [ base bytestring containers text vector ];
librarySystemDepends = [ glew libGL libGLU pkgconfig ];
librarySystemDepends = [ glew libGL libGLU ];
libraryPkgconfigDepends = [ glew ];
libraryToolDepends = [ c2hs ];
testHaskellDepends = [ base containers hspec inline-c QuickCheck ];
homepage = "https://github.com/cocreature/nanovg-hs";
description = "Haskell bindings for nanovg";
license = pkgs.stdenv.lib.licenses.isc;
license = stdenv.lib.licenses.isc;
}) {};
agNek0 = with haskellPackages; callPackage (
{ mkDerivation, array, base, base-orphans, containers
, criterion, deepseq, extra, QuickCheck, stdenv
}:
mkDerivation {
pname = "algebraic-graphs";
version = "0.1.1.1";
sha256 = "8747a7d6f7a328b6073c1904883087a6a8e9a02d3bd8a5e35174c5f1c1cd1231";
libraryHaskellDepends = [
array base base-compat containers deepseq
];
testHaskellDepends = [
base bcNek0 base-orphans containers extra QuickCheck
];
benchmarkHaskellDepends = [
base base-compat containers criterion
];
homepage = "https://github.com/snowleopard/alga";
doCheck = false;
description = "A library for algebraic graph construction and transformation";
license = stdenv.lib.licenses.mit;
}) {};
bcNek0 = with haskellPackages; callpackage (
{ mkDerivation, base, stdenv, unix }:
mkDerivation {
pname = "base-compat";
version = "0.9.3";
libraryHaskellDepends = [ base unix ];
description = "A compatibility layer for base";
doCheck = false;
license = stdenv.lib.licenses.mit;
}) {};
affectionNeko = with haskellPackages; callPackage ({ mkDerivation
, base, bytestring, clock, containers, glib, linear, monad-loops, monad-parallel
, mtl, OpenGL, stdenv, stm, text, uuid, vector }:
mkDerivation {
pname = "affection";
version = "0.0.0.9";
#src = pkgs.fetchFromGitHub {
# owner = "nek0";
# repo = "affection";
# rev = "33c99b8888328e4ed17f5c65ac49f5eab2645549";
# sha256 = "0psqxqj1a8l5fia49ay2pb72kjnw5i54m6dcmrpz5hi1654aznll";
#};
src = ../affection;
configureFlags = [ "-fdebug" ];
revision = "1";
isLibrary = true;
libraryHaskellDepends = [
base bytestring clock containers glib linear monad-loops
monad-parallel mtl OpenGL sdl2Nek0 stm text uuid vector
];
librarySystemDepends = [ ];
libraryToolDepends = [ ];
testHaskellDepends = [ ];
homepage = "https://github.com/nek0/affection";
description = "A simple Game Engine in Haskell using SDL";
license = pkgs.stdenv.lib.licenses.gpl3;
hydraPlatforms = pkgs.stdenv.lib.platforms.none;
}) { };
ecstasyNeko = with haskellPackages; callPackage ({
mkDerivation, base, containers, kan-extensions, mtl, stdenv
, transformers
}:
mkDerivation {
pname = "ecstasy";
version = "0.2.1.0";
sha256 = "915942d3b8c3d61b98e5b2e825387d48cf3c2d17acdb2d377cb516c26c0fcbc3";
libraryHaskellDepends = [
base containers kan-extensions mtl transformers
];
homepage = "http://github.com/isovector/ecstasy/";
description = "A GHC.Generics based entity component system.";
license = stdenv.lib.licenses.bsd3;
}) {};
f = { mkDerivation, astar, base, containers, linear
, matrix, OpenGL, random, stdenv, stm, text, unordered-containers
, vector, JuicyPixels, JuicyPixels-extra, bytestring, mtl
f = { mkDerivation, algebraic-graphs, astar, base
, bytestring, containers, ecstasy, JuicyPixels, JuicyPixels-extra
, linear, matrix, mtl, OpenGL, random, stdenv, stm
, text, unordered-containers, vector, pkgconfig
}:
mkDerivation {
pname = "tracer-game";
@ -135,18 +92,16 @@ let
src = ./.;
isLibrary = false;
isExecutable = true;
enableExecutableProfiling = true;
executableHaskellDepends = [
affectionNeko astar base containers ecstasyNeko linear matrix nanovgNeko
OpenGL random sdl2Nek0 stm text unordered-containers vector JuicyPixels
JuicyPixels-extra bytestring agNek0 mtl
aff algebraic-graphs astar base bytestring containers ecstasy
JuicyPixels JuicyPixels-extra linear matrix mtl nano OpenGL
random sdl stm text unordered-containers vector pkgconfig
];
enableExecutableProfiling = true;
license = stdenv.lib.licenses.gpl3;
};
haskellPackages = if compiler == "default"
then pkgs.haskellPackages
else pkgs.haskell.packages.${compiler};
haskellPackages = pkgs.haskellPackages;
variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id;

View file

@ -15,6 +15,8 @@ import Foreign.C.Types (CInt(..))
import Data.Maybe (fromJust)
import Control.Monad (when)
-- internal imports
import Types hiding (draw)
@ -68,9 +70,11 @@ pre = do
quitGame :: KeyboardMessage -> Affection UserData ()
quitGame (MsgKeyboardEvent _ _ SDL.Pressed False sym)
| SDL.keysymKeycode sym == SDL.KeycodeEscape = do
| SDL.keysymKeycode sym == SDL.KeycodeEscape = quit
| SDL.keysymKeycode sym == SDL.KeycodeF5 = do
ad <- A.get
ud <- getAffection
when (state ud == Main WorldMap || state ud == Main MindMap) $ do
let Subsystems w m k = subsystems ud
mapM_ (partUnSubscribe w) (uuid ud)
mapM_ (partUnSubscribe m) (uuid ud)
@ -79,6 +83,7 @@ quitGame (MsgKeyboardEvent _ _ SDL.Pressed False sym)
(ws, _) <- yieldSystemT (0, defStorage) (return ())
putAffection ud
{ worldState = ws
, state = Load
}
smLoad Load
| otherwise = return ()

View file

@ -45,10 +45,12 @@ data UserData = UserData
data State
= Load
| Main SubMain
deriving (Eq)
data SubMain
= WorldMap
| MindMap
deriving (Eq)
data Subsystems = Subsystems
{ subWindow :: Window