Skip to content

Commit 8b15f40

Browse files
Merge branch 'release-0.1.6'. Refs #108.
2 parents 4b17935 + e281bb0 commit 8b15f40

30 files changed

+1279
-980
lines changed

.travis.yml

+23-19
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
1+
dist: bionic
2+
13
# The following enables several GHC versions to be tested; often it's enough to
24
# test only against the last release in a major GHC version. Feel free to omit
35
# lines listings versions you don't need/want testing for.
4-
language: c
56
env:
6-
- GHCVER=7.6.3
7-
- GHCVER=7.8.4
8-
- GHCVER=7.10.3
9-
- GHCVER=8.0.1
7+
- CABALVER=2.4 GHCVER=8.2.2
8+
- CABALVER=2.4 GHCVER=8.4.4
9+
- CABALVER=2.4 GHCVER=8.6.5
10+
- CABALVER=2.4 GHCVER=8.8.4
11+
- CABALVER=2.4 GHCVER=8.10.4
12+
# - CABALVER=head GHCVER=head # see section about GHC HEAD snapshots
1013

11-
# Note: the distinction between `before_install` and `install` is not important.
1214
before_install:
13-
- unset CC
15+
- travis_retry sudo add-apt-repository -y ppa:hvr/ghc
16+
- travis_retry sudo apt-get update
17+
- travis_retry sudo apt-get install --yes libsdl1.2-dev libsdl-image1.2-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev
18+
- travis_retry sudo apt-get install --yes cabal-install-$CABALVER ghc-$GHCVER # see note about happy/alex
19+
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
20+
- cabal --version
21+
- ghc --version
22+
- travis_retry cabal update
23+
1424
install:
15-
- travis_retry sudo add-apt-repository -y ppa:hvr/ghc
16-
- travis_retry sudo apt-get update
17-
- travis_retry sudo apt-get install libsdl1.2-dev libsdl-image1.2-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev
18-
- travis_retry sudo apt-get install cabal-install-1.24 ghc-$GHCVER-prof ghc-$GHCVER-dyn alex-3.1.4 happy-1.19.5
19-
- export PATH=$HOME/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/1.24/bin:/opt/alex/3.1.4/bin:/opt/happy/1.19.5/bin:$PATH
20-
- travis_retry cabal update
25+
- travis_retry cabal install -f-wiimote -f-kinect --only-dependencies --enable-tests
2126

2227
script:
23-
- travis_retry cabal install --run-tests -v -j1 -f-wiimote -f-kinect
24-
25-
notifications:
26-
email: true
28+
- travis_retry cabal configure -f-wiimote -f-kinect --enable-tests && cabal build && cabal test
2729

2830
branches:
2931
only:
3032
- master
31-
- develop
33+
- /^develop.*/
34+
- /^hotfix.*/
35+
- /^release.*/
3236

3337
deploy:
3438
provider: hackage
@@ -37,4 +41,4 @@ deploy:
3741
secure: WQp6LHDPxGPlaFsFK1CGZaW5XSFX4+f3hLkglYFKTUzNNfmq0QXmqKJROLWrvwvTmipxguM0qZdsJTYIKJdIeECyD7dR2sZHMVpoaXgle9QkYyvoAs1o9wMbdjc/vYK4QpG9we9TPwHNalXJIkwKtoWA7IDxKQ56ln2sQLx6Qz2K/tDnq8bHNhe4U/7YRGc9K2TdiFkcimPY6BqPG/mRR8AI+q3P3YLg4x4GdDKXKtxwRdWuRQaidpog6H4xbdVAjEIlbCJ/Re1Ofjq1J5ESYN5NM84+b8TiMoVs7qeiqWNuid8YCGKUpuJ4JXPai63+EHP9vr0+DFxFZPEMm94f/Lo6B/2BtUB5KoC1baVItMVte9pqcjr1slf46VoeCtXmfCa3pKBQE4TZQl25pSGISHfYaiRuCZ/zo1Rd6PPOgbdaR9agHOVMugGkO55p8qWwhL7kle/Xu8oEyOiRTc/M1PAKXe5Fa1+Vz46FNtMqTlZo/Sa5ySC3QpBfhexXqbD6fO3032VRX9oNPFXuIwwjXQ0D2lGENHxxVahcqIPC4AZVDmL+9ME7k0JVDSk7zW5gQgGdEWvtCBTLahBBwbgFHoRZxlymGnMJWovcgP9cOyrjlbd/LGjd0Hp9LEaCPmMHE+yM0cgVpVUrFtTNt4O3nl14KLYCKZ+0mwkryqEF/LI=
3842
on:
3943
branch: master
40-
condition: "$GHCVER = 8.0.1"
44+
condition: ${TRAVIS_HASKELL_VERSION}=8.4.4

CHANGELOG

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
2023-04-08 Ivan Perez <[email protected]>:
2+
* Version bump (0.1.6) (#108).
3+
* Simplify travis file (#58).
4+
* Update GHC versions, condition, publication in travis (#77).
5+
* Update to support Yampa 0.13 (#82).
6+
* Update pointer to hands-on file (#85).
7+
* Add support for bearriver (#95).
8+
* Support stopping the game with letter q (#99).
9+
* Update installation instructions (#102).
10+
* Bump version bounds of Yampa/bearriver (#104).
11+
* Update dist in travis config file to Bionic (#105).
12+
* Update GHC versions in travis config file (#106).
13+
* Enable CI builds of branches used by our development process (#107).
14+
* Conform to style guide (#103).
15+
116
2017-11-02 Ivan Perez <[email protected]>:
217
* Version bump (0.1.5.4).
318
* Adds new levels.

README.md

+12-7
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ The game is available on [hackage](https://hackage.haskell.org/package/SpaceInva
4444

4545
```
4646
$ cabal update
47-
$ cabal sandbox init
4847
$ cabal install haskanoid
49-
$ ./.cabal-sandbox/bin/haskanoid
48+
$ $HOME/.cabal/bin/haskanoid
5049
```
5150

5251
If you want to explore the code and possibly make changes, do the following:
@@ -55,9 +54,8 @@ If you want to explore the code and possibly make changes, do the following:
5554
$ cabal update
5655
$ cabal unpack haskanoid # or git clone http://github.com/ivanperez-keera/haskanoid
5756
$ cd haskanoid-* # Game resources are here
58-
$ cabal sandbox init
5957
$ cabal install
60-
$ ./dist/build/haskanoid/haskanoid
58+
$ $HOME/.cabal/bin/haskanoid
6159
```
6260

6361
To play it with the wiimote, you need to run the program with the special
@@ -102,16 +100,23 @@ those with:
102100
```
103101
$ cabal unpack haskanoid ## Or git clone this-repo
104102
$ cd haskanoid-*
105-
$ cabal sandbox init
106103
$ cabal install --only-dependencies
107-
$ cabal configure && cabal haddock --executables --internal
104+
$ cabal haddock --haddock-executables --haddock-internal
108105
```
109106

107+
You may also want to add the flags `-f-wiimote` and `-f-kinect` to the cabal
108+
commands above to install without wiimote and kinect support.
109+
110110
# Related projects
111111

112112
* Yampa (http://github.com/ivanperez-keera/Yampa), the Arrowized Functional
113113
Reactive Programming implementation created by Antony Courtney and Henrik Nilsson.
114114

115+
* Dunai (http://github.com/ivanperez-keera/dunai), an extremely powerful
116+
reactive programming implementation capable of doing Classic and Arrowized
117+
Functional Reactive Programming, Reactive Programming, Stream Programming, and
118+
others. It contains a Yampa replacement that is capable of running Haskanoid.
119+
115120
* hcwiid (http://github.com/ivanperez-keera/hcwiid), a wrapper around
116121
the cwiid library to communicate with Wiimotes.
117122

@@ -129,7 +134,7 @@ Play](https://play.google.com/store/apps/details?id=uk.co.keera.games.magiccooki
129134

130135
# Hands-on
131136

132-
In the [hands-on file](https://github.com/ivanperez-keera/haskanoid/blob/master/hands-on.md)
137+
In the [hands-on file](https://github.com/ivanperez-keera/haskanoid/blob/develop/docs/hands-on.md)
133138
you find ideas to improve haskanoid while focussing on (game)
134139
programming related areas that you might want to dive in deeper. The areas are:
135140
functional (reactive) programming, performance, human-computer interaction and
File renamed without changes.
File renamed without changes.

haskanoid.cabal

+21-11
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44
-- The name of the package.
55
name: haskanoid
66

7-
-- The package version. See the Haskell package versioning policy (PVP)
8-
-- for standards guiding when and how versions should be incremented.
9-
-- http://www.haskell.org/haskellwiki/Package_versioning_policy
7+
-- The package version. We follow semantic versioning.
108
-- PVP summary: +-+------- breaking API changes
11-
-- | | +----- non-breaking API additions
12-
-- | | | +--- code changes with no API change
13-
version: 0.1.5.4
9+
-- | | +----- non-breaking changes
10+
-- | | |
11+
version: 0.1.6
1412

1513
-- A short (one-line) description of the package.
1614
synopsis: A breakout game written in Yampa using SDL
@@ -45,7 +43,7 @@ category: Game, Reactivity, FRP
4543
build-type: Simple
4644

4745
-- Constraint on the version of Cabal needed to build this package.
48-
cabal-version: >=1.8
46+
cabal-version: >=1.10
4947

5048
data-files: data/*.png data/*.wav data/*.mp3 data/*.ttf
5149

@@ -57,6 +55,10 @@ Flag kinect
5755
Description: Enable Kinect support (with freenect)
5856
Default: True
5957

58+
Flag bearriver
59+
Description: Compile with bearriver instead of Yampa
60+
Default: False
61+
6062
executable haskanoid
6163
-- .hs or .lhs file containing the Main module.
6264
main-is: Main.hs
@@ -99,12 +101,20 @@ executable haskanoid
99101

100102
-- Other library packages from which modules are imported.
101103
build-depends: base >= 4.6 && < 5,
102-
transformers >= 0.3 && < 0.6,
103-
mtl,
104+
IfElse,
104105
MissingH,
105-
Yampa >= 0.9.6 && < 0.12,
106+
mtl,
106107
SDL, SDL-image, SDL-mixer, SDL-ttf,
107-
IfElse
108+
simple-affine-space,
109+
transformers >= 0.3 && < 0.6
110+
111+
default-language:
112+
Haskell2010
113+
114+
if flag(bearriver)
115+
build-depends: bearriver >= 0.9.6 && < 0.15
116+
else
117+
build-depends: Yampa >= 0.13 && < 0.15
108118

109119
if flag(wiimote)
110120
build-depends: hcwiid

src/Audio.hs

+27-20
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,38 @@
1-
-- | A layer of abstraction on top of SDL audio.
1+
-- |
2+
-- Copyright : (c) Keera Studios, 2010-2014.
3+
-- License : See LICENSE file.
4+
-- Maintainer : Ivan Perez <[email protected]>
5+
--
6+
-- A layer of abstraction on top of SDL audio.
27
--
38
-- It plays audio soundfx asynchronously (in a new thread), which means that
49
-- programs must be compiled with the threaded Runtime System (ghc flag is
510
-- -threaded).
6-
--
7-
-- This module is 2010-2014 (c) Keera Studios, redistributed with permission.
811
module Audio
9-
(Music(..),
10-
Audio(..),
11-
initAudio,
12-
loadAudio,
13-
loadMusic,
14-
playMusic,
15-
playFile,
16-
stopMusic,
17-
musicPlaying) where
12+
( Music(..)
13+
, Audio(..)
14+
, initAudio
15+
, loadAudio
16+
, loadMusic
17+
, playMusic
18+
, playFile
19+
, stopMusic
20+
, musicPlaying
21+
)
22+
where
1823

19-
import Control.Applicative ((<$>))
20-
import Control.Monad
21-
import Control.Concurrent
22-
import qualified Graphics.UI.SDL.Mixer.General as SDL.Mixer
24+
-- External imports
25+
import Control.Applicative ((<$>))
26+
import Control.Concurrent
27+
import Control.Monad
2328
import qualified Graphics.UI.SDL.Mixer.Channels as SDL.Mixer.Channels
24-
import qualified Graphics.UI.SDL.Mixer.Music as SDL.Mixer.Music
25-
import qualified Graphics.UI.SDL.Mixer.Types as SDL.Mixer.Types
26-
import qualified Graphics.UI.SDL.Mixer.Samples as SDL.Mixer.Samples
29+
import qualified Graphics.UI.SDL.Mixer.General as SDL.Mixer
30+
import qualified Graphics.UI.SDL.Mixer.Music as SDL.Mixer.Music
31+
import qualified Graphics.UI.SDL.Mixer.Samples as SDL.Mixer.Samples
32+
import qualified Graphics.UI.SDL.Mixer.Types as SDL.Mixer.Types
2733

2834
data Music = Music { musicName :: String, unMusic :: SDL.Mixer.Types.Music }
35+
2936
data Audio = Audio { audioName :: String, unAudio :: SDL.Mixer.Types.Chunk }
3037

3138
-- | Initialize the audio subsystem.
@@ -63,6 +70,6 @@ loadAudio fp = fmap (Audio fp) <$> SDL.Mixer.Samples.tryLoadWAV fp
6370
-- This function spawns a new OS thread. Remember to compile your program
6471
-- with the threaded RTS.
6572
playFile :: Audio -> Int -> IO ()
66-
playFile wav t = void $ forkOS $ do
73+
playFile wav t = void $ forkOS $ do
6774
_v <- SDL.Mixer.Channels.playChannel (-1) (unAudio wav) 0
6875
threadDelay (t * 1000)

src/Constants.hs

+29-17
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
1+
-- |
2+
-- Copyright : (c) Ivan Perez & Henrik Nilsson, 2014.
3+
-- License : See LICENSE file.
4+
-- Maintainer : Ivan Perez <[email protected]>
5+
--
6+
-- Game constants.
17
module Constants where
28

9+
-- External imports
310
import FRP.Yampa
11+
12+
-- Internal imports
413
import Physics.TwoDimensions.Dimensions
514

615
width :: Double
7-
width = 640
16+
width = 640
17+
818
height :: Double
919
height = 600
1020

11-
gameTop :: Double
12-
gameTop = 100
13-
gameLeft :: Double
14-
gameLeft = 0
21+
gameTop :: Double
22+
gameTop = 100
23+
24+
gameLeft :: Double
25+
gameLeft = 0
1526

1627
gameWidth :: Double
1728
gameWidth = width
29+
1830
gameHeight :: Double
1931
gameHeight = height - gameTop
2032

@@ -24,20 +36,27 @@ loadingDelay = 2 -- seconds
2436
paddleWidth, paddleHeight :: Double
2537
paddleWidth = 104
2638
paddleHeight = 24
39+
2740
paddleMargin :: Double
2841
paddleMargin = 50
42+
2943
ballWidth, ballHeight :: Double
30-
ballWidth = 10
31-
ballHeight = 10
44+
ballWidth = 10
45+
ballHeight = 10
46+
3247
ballMargin :: Double
33-
ballMargin = 30
48+
ballMargin = 30
49+
3450
blockWidth, blockHeight :: Double
35-
blockWidth = 64
36-
blockHeight = 32
51+
blockWidth = 64
52+
blockHeight = 32
53+
3754
blockSeparation :: Double
3855
blockSeparation = 10
56+
3957
maxBlockLife :: Int
4058
maxBlockLife = 3
59+
4160
minBlockLife :: Int
4261
minBlockLife = 1
4362

@@ -57,13 +76,6 @@ velTrans = 0.2
5776
-- Max speed
5877
maxVNorm :: Double
5978
maxVNorm = 300
60-
61-
-- Delays
62-
-- restartDelay :: Time
63-
-- restartDelay = 3
64-
--
65-
-- wonDelay :: Time
66-
-- wonDelay = 3
6779

6880
-- * Debugging
6981

src/Control/Extra/Monad.hs

+19-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
1+
-- |
2+
-- Copyright : (c) Ivan Perez & Henrik Nilsson, 2014.
3+
-- License : See LICENSE file.
4+
-- Maintainer : Ivan Perez <[email protected]>
5+
--
6+
-- Auxiliary functions related to Control.Monad.
17
module Control.Extra.Monad where
28

9+
-- External imports
310
import Control.Monad
411

512
whileLoopM :: Monad m => m a -> (a -> Bool) -> (a -> m ()) -> m ()
613
whileLoopM val cond act = r'
7-
where r' = do v <- val
8-
when (cond v) $ do
9-
act v
10-
whileLoopM val cond act
14+
where
15+
r' = do v <- val
16+
when (cond v) $ do
17+
act v
18+
whileLoopM val cond act
1119

1220
foldLoopM :: Monad m => a -> m b -> (b -> Bool) -> (a -> b -> m a) -> m a
1321
foldLoopM val sense cond act = r'
14-
where r' = do s <- sense
15-
if cond s
16-
then do
17-
val' <- act val s
18-
foldLoopM val' sense cond act
19-
else return val
22+
where
23+
r' = do s <- sense
24+
if cond s
25+
then do
26+
val' <- act val s
27+
foldLoopM val' sense cond act
28+
else return val

0 commit comments

Comments
 (0)