BlockGame
A class for creating games with block-based graphics. See example usage in introprog.examples.TestBlockGame
Value parameters
- background
-
the color used when clearing pixels
- blockSize
-
the side of each square block in pixels
- dim
-
the (width, height) of the window in number of blocks
- framesPerSecond
-
the desired update rate in the gameLoop
- messageAreaBackground
-
the color of the message area background
- messageAreaHeight
-
the height in pixels of the message area
- title
-
the title of the window
Attributes
- Constructor
-
Create a new game.
- Source
- BlockGame.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class MovingBlockclass RandomBlocks
Members list
Value members
Concrete methods
Clear a rectangle in the message area in block coordinates.
Erase all blocks to background color.
Paint a block in color c
at (x
,y
) in block coordinates.
Write msg
in color
in the middle of the window. The drawing is postponed until the end of the current game loop iteration and thus the text drawn on top of any updated blocks.
Write msg
in color
in the middle of the window. The drawing is postponed until the end of the current game loop iteration and thus the text drawn on top of any updated blocks.
Attributes
- Source
- BlockGame.scala
Write msg
in color
in the message area at ('x','y') in block coordinates.
Write msg
in color
in the message area at ('x','y') in block coordinates.
Attributes
- Source
- BlockGame.scala
Erase the block at (x
,y
) to background
color.
Called in each gameLoop
iteration. Override if you want non-empty action.
Called in each gameLoop
iteration. Override if you want non-empty action.
Attributes
- Source
- BlockGame.scala
Returns the gameLoop delay in ms implied by framesPerSecond
.
Called when window is closed. Override if you want non-empty action.
Called when window is closed. Override if you want non-empty action.
Attributes
- Source
- BlockGame.scala
Called if no time is left in iteration to keep frame rate. Default action is to print a warning message.
Called if no time is left in iteration to keep frame rate. Default action is to print a warning message.
Attributes
- Source
- BlockGame.scala
Called when a key is pressed. Override if you want non-empty action.
Called when a key is pressed. Override if you want non-empty action.
Value parameters
- key
-
is a string representation of the pressed key
Attributes
- Source
- BlockGame.scala
Called when a key is released. Override if you want non-empty action.
Called when a key is released. Override if you want non-empty action.
Value parameters
- key
-
is a string representation of the released key
Attributes
- Source
- BlockGame.scala
Called when mouse is pressed. Override if you want non-empty action.
Called when mouse is pressed. Override if you want non-empty action.
Value parameters
- pos
-
the mouse position in underlying
pixelWindow
coordinates
Attributes
- Source
- BlockGame.scala
Called when mouse is released. Override if you want non-empty action.
Called when mouse is released. Override if you want non-empty action.
Value parameters
- pos
-
the mouse position in underlying
pixelWindow
coordinates
Attributes
- Source
- BlockGame.scala
Concrete fields
Attributes
- Source
- BlockGame.scala
Attributes
- Source
- BlockGame.scala
Attributes
- Source
- BlockGame.scala
Attributes
- Source
- BlockGame.scala
Attributes
- Source
- BlockGame.scala
Attributes
- Source
- BlockGame.scala
Attributes
- Source
- BlockGame.scala