You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/scala/introprog/BlockGame.scala
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,9 @@ package introprog
2
2
3
3
importjava.awt.Color
4
4
5
-
/** A class for creating games with block-based graphics.
5
+
/** A class for creating games with block-based graphics.
6
+
* See example usage in [`introprog.examples.TestBlockGame`](https://github.com/lunduniversity/introprog-scalalib/blob/master/src/main/scala/introprog/examples/TestBlockGame.scala#L7).
7
+
*
6
8
* @constructor Create a new game.
7
9
* @paramtitle the title of the window
8
10
* @paramdim the (width, height) of the window in number of blocks
@@ -84,6 +86,8 @@ abstract class BlockGame(
84
86
/** The game loop that continues while not `stopWhen` is true.
85
87
* It draws only updated blocks aiming at the desired frame rate.
86
88
* It calls each `onXXX` method if a corresponding event is detected.
89
+
* Use the call-by-name `stopWhen` to pass a condition that ends the loop if false.
90
+
* See example usage in `introprog.examples.TestBlockGame`.
87
91
*/
88
92
protecteddefgameLoop(stopWhen: =>Boolean):Unit=while!stopWhen do
0 commit comments