Auxiliary Gtk+ 2 and Gtk+ 3 operations
Instructions on how to run a game:
git clone https://github.com/keera-studios/gtk-helpers.git
Creating a sandbox (or contained environment for haskell stuff) inside the directory gtk-helpers/gtk2.
cabal sandbox init
Installing the package gtk-helpers in that directory (cabal install finds the only .cabal file in that dir).
Note: Some MacOS users may experience a problem upon executing the above command for which the discussion can be found here.
In that case, you need to first execute
cabal install gtk -fhave-quartz-gtk and then
If the problem isn't resolved even after executing
cabal install gtk -fhave-quartz-gtk command, you may want to refer this for additional information.
For e.g., if you want to play lights-off game,
We move into examples/lights-off, and tell cabal to use the sandbox in gtk-helpers/gtk2 for anything we run in this directory.
cabal sandbox --sandbox=../../.cabal-sandbox/ init
Note: Only for lights-off game, an additional package
IfElse needs to be installed.
This can be done by running
cabal install IfElsecommand after Step 6 and before Step 7.
Finally, we compile BoardMain.hs. We use cabal exec to help GHC find the sandbox where all the packages have been installed.
cabal exec -- ghc --make BoardMain.hs
The logic, math and implementation of these games can be read here.
All the credit for the above goes to Ivan Perez.