fumieval / free-game Goto Github PK
View Code? Open in Web Editor NEWThe free game engine
Home Page: http://hackage.haskell.org/package/free-game
License: BSD 3-Clause "New" or "Revised" License
The free game engine
Home Page: http://hackage.haskell.org/package/free-game
License: BSD 3-Clause "New" or "Revised" License
building path(s) ‘/nix/store/if63i3c6nrkwv62g2zs79n36yzjw4ajp-haskell-free-game-1.1.80’
setupCompilerEnvironmentPhase
Building with /nix/store/g95aa9gcy3g1ml3c8pw6769ifbl20l3c-ghc-7.8.4.
unpacking sources
unpacking source archive /nix/store/3nx2kb552brjvvh9i2hq38yjx9rx0vn2-free-game-1.1.80.tar.gz
source root is free-game-1.1.80
patching sources
jailbreakPhase
Running jailbreak-cabal to lift version restrictions on build inputs.
compileBuildDriverPhase
setupCompileFlags: -package-db=/tmp/nix-build-haskell-free-game-1.1.80.drv-0/package.conf.d -j1
[1 of 1] Compiling Main ( Setup.hs, /tmp/nix-build-haskell-free-game-1.1.80.drv-0/Main.o )
Linking Setup ...
configuring
configureFlags: --verbose --prefix=/nix/store/if63i3c6nrkwv62g2zs79n36yzjw4ajp-haskell-free-game-1.1.80 --libdir=$prefix/lib/$compiler --libsubdir=$pkgid --with-gcc=gcc --package-db=/tmp/nix-build-haskell-free-game-1.1.80.drv-0/package.conf.d --ghc-option=-optl=-Wl,-rpath=/nix/store/if63i3c6nrkwv62g2zs79n36yzjw4ajp-haskell-free-game-1.1.80/lib/ghc-7.8.4/free-game-1.1.80 --enable-split-objs --disable-library-profiling --enable-shared --enable-library-vanilla --enable-executable-dynamic --enable-tests
Configuring free-game-1.1.80...
Dependency GLFW-b -any: using GLFW-b-1.4.6
Dependency JuicyPixels -any: using JuicyPixels-3.2.2
Dependency JuicyPixels-util -any: using JuicyPixels-util-0.2
Dependency OpenGL -any: using OpenGL-2.9.2.0
Dependency OpenGLRaw -any: using OpenGLRaw-1.5.0.1
Dependency array -any: using array-0.5.0.0
Dependency base -any: using base-4.7.0.2
Dependency boundingboxes -any: using boundingboxes-0.2.2
Dependency colors -any: using colors-0.3
Dependency containers -any: using containers-0.5.5.1
Dependency control-bool -any: using control-bool-0.2.1
Dependency directory -any: using directory-1.2.1.0
Dependency filepath -any: using filepath-1.3.0.2
Dependency free -any: using free-4.10.0.1
Dependency freetype2 -any: using freetype2-0.1.1
Dependency hashable -any: using hashable-1.2.3.1
Dependency lens -any: using lens-4.7
Dependency linear -any: using linear-1.16.2
Dependency mtl -any: using mtl-2.1.3.1
Dependency random -any: using random-1.1
Dependency reflection -any: using reflection-1.5.1.1
Dependency template-haskell -any: using template-haskell-2.9.0.0
Dependency transformers -any: using transformers-0.3.0.0
Dependency vector -any: using vector-0.10.12.2
Dependency void -any: using void-0.7
/nix/store/g95aa9gcy3g1ml3c8pw6769ifbl20l3c-ghc-7.8.4/bin/ghc --info
Using Cabal-1.18.1.5 compiled by ghc-7.8
Using compiler: ghc-7.8.4
Using install prefix:
/nix/store/if63i3c6nrkwv62g2zs79n36yzjw4ajp-haskell-free-game-1.1.80
Binaries installed in:
/nix/store/if63i3c6nrkwv62g2zs79n36yzjw4ajp-haskell-free-game-1.1.80/bin
Libraries installed in:
/nix/store/if63i3c6nrkwv62g2zs79n36yzjw4ajp-haskell-free-game-1.1.80/lib/ghc-7.8.4/free-game-1.1.80
Private binaries installed in:
/nix/store/if63i3c6nrkwv62g2zs79n36yzjw4ajp-haskell-free-game-1.1.80/libexec
Data files installed in:
/nix/store/if63i3c6nrkwv62g2zs79n36yzjw4ajp-haskell-free-game-1.1.80/share/x86_64-linux-ghc-7.8.4/free-game-1.1.80
Documentation installed in:
/nix/store/if63i3c6nrkwv62g2zs79n36yzjw4ajp-haskell-free-game-1.1.80/share/doc/x86_64-linux-ghc-7.8.4/free-game-1.1.80
Configuration files installed in:
/nix/store/if63i3c6nrkwv62g2zs79n36yzjw4ajp-haskell-free-game-1.1.80/etc
No alex found
Using ar found on system at:
/nix/store/bwfp72pan98zd5jl8fa50y3649rdvrv7-binutils-2.23.1/bin/ar
No c2hs found
No cpphs found
No ffihugs found
Using gcc version 4.8.4 given by user at:
/nix/store/vyasynvcp9jpgbysifya5b4cjknqllb2-gcc-wrapper-4.8.4/bin/gcc
Using ghc version 7.8.4 found on system at:
/nix/store/g95aa9gcy3g1ml3c8pw6769ifbl20l3c-ghc-7.8.4/bin/ghc
Using ghc-pkg version 7.8.4 found on system at:
/nix/store/g95aa9gcy3g1ml3c8pw6769ifbl20l3c-ghc-7.8.4/bin/ghc-pkg
No greencard found
Using haddock version 2.14.3 found on system at:
/nix/store/g95aa9gcy3g1ml3c8pw6769ifbl20l3c-ghc-7.8.4/bin/haddock
No happy found
No hmake found
Using hpc version 0.67 found on system at:
/nix/store/g95aa9gcy3g1ml3c8pw6769ifbl20l3c-ghc-7.8.4/bin/hpc
Using hsc2hs version 0.67 found on system at:
/nix/store/g95aa9gcy3g1ml3c8pw6769ifbl20l3c-ghc-7.8.4/bin/hsc2hs
Using hscolour version 1.20 found on system at:
/nix/store/m85nzw70alrxzs25sxirb79a6m43ddil-hscolour-1.20.3/bin/HsColour
No hugs found
No jhc found
Using ld found on system at:
/nix/store/vyasynvcp9jpgbysifya5b4cjknqllb2-gcc-wrapper-4.8.4/bin/ld
No lhc found
No lhc-pkg found
No nhc98 found
No pkg-config found
Using ranlib found on system at:
/nix/store/bwfp72pan98zd5jl8fa50y3649rdvrv7-binutils-2.23.1/bin/ranlib
Using strip found on system at:
/nix/store/bwfp72pan98zd5jl8fa50y3649rdvrv7-binutils-2.23.1/bin/strip
Using tar found on system at:
/nix/store/w4hplfffmf4yjflr5fxv8af56wmc9czd-gnutar-1.27.1/bin/tar
No uhc found
building
Building free-game-1.1.80...
Preprocessing library free-game-1.1.80...
[ 1 of 12] Compiling FreeGame.Internal.Finalizer ( FreeGame/Internal/Finalizer.hs, dist/build/FreeGame/Internal/Finalizer.o )
[ 2 of 12] Compiling FreeGame.Data.Bitmap ( FreeGame/Data/Bitmap.hs, dist/build/FreeGame/Data/Bitmap.o )
[ 3 of 12] Compiling FreeGame.Types ( FreeGame/Types.hs, dist/build/FreeGame/Types.o )
[ 4 of 12] Compiling FreeGame.Class ( FreeGame/Class.hs, dist/build/FreeGame/Class.o )
FreeGame/Class.hs:57:14:
Expecting one more argument to ‘Color’
Expected a type, but ‘Color’ has kind ‘* -> *’
In the type ‘Color -> p a -> p a’
In the class declaration for ‘Picture2D’
builder for ‘/nix/store/8pb8rd14my67k9p0598akjxs7419s5ik-haskell-free-game-1.1.80.drv’ failed with exit code 1
cannot build derivation ‘/nix/store/a0nixhkrwaqqv5mln0vdhvcdl3acc1ah-ghc-7.8.4.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/a0nixhkrwaqqv5mln0vdhvcdl3acc1ah-ghc-7.8.4.drv’ failed
/run/current-system/sw/bin/nix-shell: failed to build all dependencies
free now gives IterT a MonadIO instance, which is causing an overlapping instance for MonadIO Game
We can split bitmaps with cropBitmap
but there is no way to stitch bitmaps back together. For example if we want to stitch up some text from few bitmaps, we have to do logic to make sure all bitmaps are rendered at right offsets: it would be much easier to join up the bitmaps into one and render it at single point.
Considering
cropBitmap :: Bitmap -> (Int, Int) -> (Int, Int) -> Bitmap
then maybe the type signature could be something like
stitchBitmap ∷ Bitmap -- ^ Original bitmap
→ Bitmap -- ^ bitmap to stitch
→ (Int, Int) -- ^ Point at which to stitch
→ Bitmap
could work. Everywhere that bitmaps don't overlay would simply be 0 opacity. Same if the point to stitch at is outside the original bitmap size. If we take the point to be the center of where the new bitmap would be spliced in, we could join two bitmaps by sides like this:
-- Stitch two bitmaps together side by side.
sideBySide ∷ Bitmap → Bitmap → Bitmap
sideBySide o n =
let (w, h) = bitmapSize n & both %~ (round . (/ (2 ∷ Double)) . fromIntegral)
(ow, _oh) = bitmapSize o
in stitchBitmap o n (w + ow, h)
which should result in new bitmap with size (w + ow * 2, max (h * 2) _oh)
.
Would such a function be possible? You can pick whatever implementation you want of course, the above is just an example.
The plan:
https://twitter.com/MitsutakaTakeda/status/287576613812592643
Don't know if my setup is just weird or something, but this is what I got after trying to cabal install it:
[ 9 of 11] Compiling Graphics.FreeGame.Backends.GLFW ( Graphics/FreeGame/Backends/GLFW.hs, dist/build/Graphics/FreeGame/Backends/GLFW.o )
Graphics/FreeGame/Backends/GLFW.hs:152:1:
Non type-variable argument
in the constraint: MonadFree GameAction m
(Use -XFlexibleContexts to permit this)
In the type signature for runGame':
runGame' :: GameParam
-> (forall m. MonadFree GameAction m => m a) -> IO (Maybe a)
cabal: Error: some packages failed to install:
free-game-0.3.2.2 failed during the building phase. The exception was:
ExitFailure 1
Compiling with GHC-7.4.2, cabal 1.14.0.
Although I checked that containers was part of the .cabal file, I get the error:
Preprocessing library free-game-1.0.4...
FreeGame/Backend/GLFW.hs:29:18:
Could not find module `Data.Map.Strict'
It is a member of the hidden package `containers-0.5.3.1'.
Perhaps you need to add `containers' to the build-depends in your .cabal file.
It is a member of the hidden package `containers-0.5.5.1'.
Perhaps you need to add `containers' to the build-depends in your .cabal file.
I don't see any means of detecting mouse-wheel events, notably scrolling up and down. Am I missing something or is the functionality just missing?
I hesitate to add something like OpenAL as its dependency, due to the difficulty of installation.
FreeGame.Internal.GLFW uses deprecated APIs which may disappear soon.
We have to replace them with bufferData
then it will be more efficient.
The package builds fine with 1.5
but is restricted by a bound to 1.4
. It'd be great if you could make a small release on top of 1.1.78 just bumping the version.
Same environments should yield same results.
Can be added demo with state?
I wrote a demo based on the article http://fumieval.hatenablog.com/entry/2013/01/10/201945
Perhaps now it is better to use another method.
-- demo_stateful.hs
import FreeGame
data StateData = StateData { _counter :: Int
, _font :: Font
}
loop :: StateData -> Game ()
loop state = do
let fnt = _font state
cnt = 1 + _counter state
state' = state{_counter = cnt}
translate (V2 100 240) . color green . text fnt 15 $ show cnt
translate (V2 340 240) . rotateD (fromIntegral cnt) . color red $ text fnt 70 "Test"
key <- keyPress KeyEscape
unless key $ tick >> loop state'
main = runGame Windowed (Box (V2 0 0) (V2 640 480)) $ do
font <- loadFont "VL-PGothic-Regular.ttf"
clearColor black
let state = StateData{_counter = 0, _font = font}
loop state
Something like:
setResizable :: FreeGame m => Bool -> m ()
getResizable :: FreeGame m => m Bool
getSIze :: FreeGame m => m Vec2
setSIze :: FreeGame m => Vec2 -> m Bool
https://twitter.com/kazu_yamamoto/status/297251940272844800
Monaris: https://github.com/fumieval/Monaris
Although it works fine on my environment (Win, Linux).
OpenGL-2.8.0.0 removes the StateVar dependency, providing its own StateVar implementation in Graphics.Rendering.OpenGL.GL.StateVar instead of Data.StateVar, which causes Backends.GLFW to fail to build.
I'd like to change the opacity of my rendered bitmap. Something like
color (Color 0 0 0 x) $ …
does not do what I want because it also changes the colour of the whole thing while I'm only after the opacity. Currently it would seem that we'd have to manually generate new bitmaps. I think that free-game sits on top of Juicy-Pixels so I think this should be fairly easy to expose. Maybe free-game could expose the underlying pixel array so that users can use Juicy-Pixels themselves if they want? There seems to be no way to go convert between now.
It is very unreasonable to put input events and window refreshing and an audio output into the tick-based timeline.
I like to make it possible to implement rhythm games, or digital audio workstations.
at master 0a0db84
% cabal install
...
Installed free-4.4
Installed linear-1.4
Installed OpenGL-2.9.1.0
Configuring free-game-1.0...
Building free-game-1.0...
Failed to install free-game-1.0
Last 10 lines of the build log ( ...):
FreeGame/Util.hs:68:9:
Not in scope: data constructor `Iter'
Perhaps you meant `IterT' (imported from Control.Monad.Trans.Iter)
FreeGame/Util.hs:74:9: Not in scope: data constructor `Pure'
FreeGame/Util.hs:75:9:
Not in scope: data constructor `Iter'
Perhaps you meant `IterT' (imported from Control.Monad.Trans.Iter)
cabal: Error: some packages failed to install:
free-game-1.0 failed during the building phase. The exception was:
ExitFailure 1
data Input x where
Not :: Input Bool -> Input Bool
Previous :: Input a -> Input a
(:&:) :: Input Bool -> Input Bool -> Input Bool
KeyChar :: Char -> Input Bool
down k = k :&: Not (Previous k))
gameMain = do
z <- input (down (KeyChar 'Z'))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.