constants

Accessible constants are the following:

General purpose:

  • PYGAMELIB_VERSION

enum pygamelib.constants.Alignment(value)

Alignment regroup constants that used for various alignment purpose when organizing UI elements or other such graphical elements.

V_CENTER and H_CENTER respectively stand for Vertical center and Horizontal Center.

Member Type:

int

Valid values are as follows:

LEFT = <Alignment.LEFT: 30000011>
RIGHT = <Alignment.RIGHT: 30000100>
CENTER = <Alignment.CENTER: 30000101>
TOP = <Alignment.TOP: 30000110>
BOTTOM = <Alignment.BOTTOM: 30000111>
V_CENTER = <Alignment.V_CENTER: 30001000>
H_CENTER = <Alignment.H_CENTER: 30001001>
enum pygamelib.constants.Algorithm(value)

A set of constants to identify the different algorithms used in the library (when a choice is possible). For now, it’s only the path finding algorithm.

Member Type:

int

Valid values are as follows:

BFS = <Algorithm.BFS: 90000100>
ASTAR = <Algorithm.ASTAR: 90000101>
enum pygamelib.constants.Direction(value)

Direction hold the basic constants for directions in the pygamelib. It is used for a wide variety of use cases from moving a player or NPC to indicate the direction of the movement of a cursor in the UI module!

Member Type:

int

Valid values are as follows:

NO_DIR = <Direction.NO_DIR: 10000000>
UP = <Direction.UP: 10000001>
DOWN = <Direction.DOWN: 10000010>
LEFT = <Direction.LEFT: 10000011>
RIGHT = <Direction.RIGHT: 10000100>
DRUP = <Direction.DRUP: 10000101>
DRDOWN = <Direction.DRDOWN: 10000110>
DLUP = <Direction.DLUP: 10000111>
DLDOWN = <Direction.DLDOWN: 10001000>
enum pygamelib.constants.EngineConstant(value)

A couple of constants that controls the behavior of the engine itself.

Member Type:

int

Valid values are as follows:

NO_PLAYER = <EngineConstant.NO_PLAYER: 90000001>
enum pygamelib.constants.EngineMode(value)

Constants that controls the mode of the engine. So far, it’s a choice between real time and turn by turn, but in the future there could be additional modes.

Member Type:

int

Valid values are as follows:

MODE_REAL_TIME = <EngineMode.MODE_REAL_TIME: 90000002>
MODE_TURN_BY_TURN = <EngineMode.MODE_TURN_BY_TURN: 90000003>
enum pygamelib.constants.InputValidator(value)

InputValidators are used in the UI module to indicate what type of inputs are valid and/or accepted from the user.

Member Type:

int

Valid values are as follows:

INTEGER_FILTER = <InputValidator.INTEGER_FILTER: 50000001>
PRINTABLE_FILTER = <InputValidator.PRINTABLE_FILTER: 50000002>
enum pygamelib.constants.Orientation(value)

Orientation regroup constants that are used to describe the orientation of graphical elements. The best example, is the BoxLayout: it can be organized vertically or horizontally.

Member Type:

int

Valid values are as follows:

HORIZONTAL = <Orientation.HORIZONTAL: 30000001>
VERTICAL = <Orientation.VERTICAL: 30000010>
enum pygamelib.constants.Permission(value)

Permission constants to separate what objects are allowed to interact with others. Mostly used to separate NPCs from Players.

Member Type:

int

Valid values are as follows:

PLAYER_AUTHORIZED = <Permission.PLAYER_AUTHORIZED: 20000001>
NPC_AUTHORIZED = <Permission.NPC_AUTHORIZED: 20000010>
ALL_CHARACTERS_AUTHORIZED = <Permission.ALL_CHARACTERS_AUTHORIZED: 20000011>
ALL_MOVABLE_AUTHORIZED = <Permission.ALL_MOVABLE_AUTHORIZED: 20000100>
NONE_AUTHORIZED = <Permission.NONE_AUTHORIZED: 20000101>
enum pygamelib.constants.SizeConstraint(value)

SizeConstraint regroup constants that are used in element which the size can vary depending on context.

Member Type:

int

Valid values are as follows:

DEFAULT_SIZE = <SizeConstraint.DEFAULT_SIZE: 60000001>
MINIMUM_SIZE = <SizeConstraint.MINIMUM_SIZE: 60000002>
MAXIMUM_SIZE = <SizeConstraint.MAXIMUM_SIZE: 60000003>
EXPAND = <SizeConstraint.EXPAND: 60000004>
enum pygamelib.constants.State(value)

A set of constants that describe the internal state of something. For example the, state of the Game engine that are used to process or not some events.

Member Type:

int

Valid values are as follows:

RUNNING = <State.RUNNING: 40000001>
PAUSED = <State.PAUSED: 40000010>
STOPPED = <State.STOPPED: 40000011>
enum pygamelib.constants.TextStyle(value)

TextStyling is used to format characters or text. It is mostly used by Text.

Member Type:

str

Valid values are as follows:

BOLD = <TextStyle.BOLD: '\x1b[1m'>
UNDERLINE = <TextStyle.UNDERLINE: '\x1b[4m'>

The following constants are used in versions <= 1.3.0 and have been deprecated starting version 1.4.0.

Directions:

  • NO_DIR: This one is used when no direction can be provided by an actuator (destination reached for a PathFinder for example)

  • UP

  • DOWN

  • LEFT

  • RIGHT

  • DRUP : Diagonal right up

  • DRDOWN : Diagonal right down

  • DLUP : Diagonal Left up

  • DLDOWN : Diagonal left down

Permissions:

  • PLAYER_AUTHORIZED

  • NPC_AUTHORIZED

  • ALL_PLAYABLE_AUTHORIZED (deprecated in 1.2.0 in favor of ALL_CHARACTERS_AUTHORIZED)

  • ALL_CHARACTERS_AUTHORIZED

  • ALL_MOVABLE_AUTHORIZED

  • NONE_AUTHORIZED

UI positions:

  • ORIENTATION_HORIZONTAL

  • ORIENTATION_VERTICAL

  • ALIGN_LEFT

  • ALIGN_RIGHT

  • ALIGN_CENTER

Actions states (for Actuators for example):

  • RUNNING

  • PAUSED

  • STOPPED

Accepted input (mainly used in pygamelib.gfx.ui for input dialogs): * INTEGER_FILTER * PRINTABLE_FILTER

Path Finding Algorithm Constants:

  • ALGO_BFS

  • ALGO_ASTAR

Text styling constants:

  • BOLD

  • UNDERLINE

Special constants:

  • NO_PLAYER : That constant is used to tell the Game object not to manage the player.

  • MODE_RT : Set the game object to Real Time mode. The game runs independently from the user input.

  • MODE_TBT : Set the game object to Turn By Turn mode. The game runs turn by turn and pause between each user input.