Skip to content

Commit

Permalink
improve docs of BlockGame, fix Documentattion for gameloop is missing #…
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornregnell committed Jun 11, 2024
1 parent 43f1129 commit 74a56ca
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/scala/introprog/BlockGame.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package introprog

import java.awt.Color

/** A class for creating games with block-based graphics.
/** A class for creating games with block-based graphics.
* See example usage in [`introprog.examples.TestBlockGame`](https://github.com/lunduniversity/introprog-scalalib/blob/master/src/main/scala/introprog/examples/TestBlockGame.scala#L7).
*
* @constructor Create a new game.
* @param title the title of the window
* @param dim the (width, height) of the window in number of blocks
Expand Down Expand Up @@ -84,6 +86,8 @@ abstract class BlockGame(
/** The game loop that continues while not `stopWhen` is true.
* It draws only updated blocks aiming at the desired frame rate.
* It calls each `onXXX` method if a corresponding event is detected.
* Use the call-by-name `stopWhen` to pass a condition that ends the loop if false.
* See example usage in `introprog.examples.TestBlockGame`.
*/
protected def gameLoop(stopWhen: => Boolean): Unit = while !stopWhen do
import PixelWindow.Event
Expand Down

0 comments on commit 74a56ca

Please sign in to comment.