1+ -- Build me with: cabal build TP6.hs
2+ -- Execute me with: cabal run -v0 TP6.hs
3+ --
4+ -- This lab exercice uses the following library:
5+ --
6+ -- - 'gloss' for rendering simple graphics. See its documentation here:
7+ -- https://hackage.haskell.org/package/gloss-1.13.2.2/docs/Graphics-Gloss.html
8+ --
9+ -- Goals:
10+ --
11+ -- 1. Write an OpenGL Pong game using the gloss library. The two players
12+ -- play on the same keyboard.
13+ -- 2. Make the game work over the network: one player is the server, the second
14+ -- one connects to the server and then the game begins.
15+ --
16+ -- -----------------------------------
17+ -- WARNING YOU NEED TO DO SOMETHING! -
18+ -- -----------------------------------
19+ --
20+ -- To avoid requiring installation OpenGL drivers during the first TPs,
21+ -- this one is not active by default. So you MUST:
22+ --
23+ -- 1. Uncomment the lines concerning TP6.hs at the end of the file tn-tp-course.cabal at the repository root.(<=)
24+ -- 2. You need to install OpenGL libraries on your machine:
25+ --
26+ -- sudo apt install libgl1-mesa-dev freeglut3 freeglut3-dev
27+ -- 3. Then you can run 'cabal build TP6.hs' at the repository root and it should work.
28+ --
29+ -- -----------
30+ -- END WARNING
31+ -- -----------
32+
33+ module Main where
34+
35+ import Graphics.Gloss
36+ import Graphics.Gloss.Interface.Pure.Game
37+
38+ -- Data carried out all along the game
39+ data PongGame = PongGame
40+ { {- Your fields here -}
41+ } deriving Show
42+
43+ initialState :: PongGame
44+ initialState = undefined
45+
46+ main :: IO ()
47+ main = play
48+ undefined
49+ undefined
50+ 60 -- Frames per second
51+ initialState
52+ render
53+ undefined
54+ undefined
55+
56+ -- Render the game state
57+ render :: PongGame -> Picture
58+ render _ = undefined
0 commit comments