modes Submodule

ScoreDisplay

class procgame.modes.ScoreDisplay(game, priority, left_players_justify='right')

ScoreDisplay is a mode that provides a DMD layer containing a generic 1-to-4 player score display. To use ScoreDisplay simply instantiate it and add it to the mode queue. A low priority is recommended.

When the layer is asked for its next_frame() the DMD frame is built based on the player score and ball information contained in the GameController.

ScoreDisplay uses a number of fonts, the defaults of which are included in the shared DMD resources folder. If a font cannot be found then the score may not display properly in some states. Fonts are loaded using procgame.dmd.font_named(); see its documentation for dealing with fonts that cannot be found.

You can substitute your own fonts (of the appropriate size) by assigning the font attributes after initializing ScoreDisplay.

credit_string_callback

If non-None, update_layer() will call it with no parameters to get the credit string (usually FREE PLAY or CREDITS 1 or similar). If this method returns the empty string no text will be shown (and any ball count will be centered). If None, FREE PLAY will be shown.

font_09x5

Defaults to Font09x5.dmd.

font_09x6

Defaults to Font09x6.dmd.

font_09x7

Defaults to Font09x7.dmd.

font_14x10

Defaults to Font14x10.dmd.

font_14x8

Defaults to Font14x8.dmd.

font_14x9

Defaults to Font14x9.dmd.

font_18x10

Defaults to Font18x10.dmd.

font_18x11

Defaults to Font18x11.dmd.

font_18x12

Defaults to Font18x12.dmd.

font_common

Font used for the bottom status line text: 'BALL 1  FREE PLAY'. Defaults to Font07x5.dmd.

font_for_score(score, is_active_player)

Returns the font to be used for displaying the given numeric score value in a 2, 3, or 4-player game.

font_for_score_single(score)

Returns the font to be used for displaying the given numeric score value in a single-player game.

format_score(score)

Returns a string representation of the given score value. Override to customize the display of numeric score values.

set_left_players_justify(left_players_justify)

Call to set the justification of the left-hand players’ scores in a multiplayer game. Valid values for left_players_justify are 'left' and 'right'.

update_layer()

Called by the layer to update the score layer for the present game state.

Table Of Contents

Previous topic

lamps Submodule

Next topic

sound Submodule

This Page