Skip to content

Commit 74a56ca

Browse files
committed
improve docs of BlockGame, fix Documentattion for gameloop is missing #41
1 parent 43f1129 commit 74a56ca

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/scala/introprog/BlockGame.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package introprog
22

33
import java.awt.Color
44

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+
*
68
* @constructor Create a new game.
79
* @param title the title of the window
810
* @param dim the (width, height) of the window in number of blocks
@@ -84,6 +86,8 @@ abstract class BlockGame(
8486
/** The game loop that continues while not `stopWhen` is true.
8587
* It draws only updated blocks aiming at the desired frame rate.
8688
* 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`.
8791
*/
8892
protected def gameLoop(stopWhen: => Boolean): Unit = while !stopWhen do
8993
import PixelWindow.Event

0 commit comments

Comments
 (0)