tests: test_syntax now reports other errors before the pkgconfig error
[nit.git] / examples / mnit_ballz / src / display.nit
1 # this file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 # Handles the drawing of all the game
16 module display
17
18 import game_logic
19
20 redef class Ball
21
22 # Draw `self` onto `display` with image from `assets`
23 fun draw(display: Display, assets: Assets)
24 do
25 display.blit_centered(assets.ball, center.x, center.y)
26 end
27 end
28
29 redef class Wall
30
31 # Draw `self` onto `display` with image from `assets`
32 fun draw(display: Display, assets: Assets)
33 do
34 display.blit_rotated(assets.vertical_wall, center.x, center.y, angle)
35 end
36 end
37
38 redef class Game
39
40 # Draw all the entities onto `display`
41 fun draw(display: Display, assets: Assets)
42 do
43 display.clear (0.0, 0.0, 0.0)
44 ball.draw(display, assets)
45 for wall in walls do wall.draw(display, assets)
46 end
47 end