Future Features

class arcade.future.texture_render_target.RenderTargetTexture(width: int, height: int)[source]

Bases:

An alternative render target to the default window/screen. This can be used in creative ways.

Parameters:
  • width – Width of the render target in pixels

  • height – Height of the render target in pixels

clear()[source]

Clear the texture with the configured background color

resize(width: int, height: int)[source]

Resize the the internal texture

set_background_color(color: tuple[int, int, int, int])[source]

Set the background color for the light layer

property texture: Texture2D

The internal OpenGL texture

class arcade.future.input.inputs.InputType(value)[source]

Bases: Enum

An enumeration.

CONTROLLER_AXIS = 4
CONTROLLER_BUTTON = 3
KEYBOARD = 0
MOUSE_AXIS = 2
MOUSE_BUTTON = 1
class arcade.future.input.inputs.InputEnum(value)[source]

Bases: Enum

The base class for all input value enum.Enum types.

class arcade.future.input.inputs.StrEnum(value)[source]

Bases: str, InputEnum

An enumeration.

🧙 format(selfformat_spec)

Returns format using actual value type unless __str__ has been overridden.

class arcade.future.input.inputs.ControllerAxes(value)[source]

Bases: StrEnum

An enumeration.

LEFT_STICK_NEGATIVE_X = 'leftxnegative'
LEFT_STICK_NEGATIVE_Y = 'leftynegative'
LEFT_STICK_POSITIVE_X = 'leftxpositive'
LEFT_STICK_POSITIVE_Y = 'leftypositive'
LEFT_STICK_X = 'leftx'
LEFT_STICK_Y = 'lefty'
LEFT_TRIGGER = 'lefttrigger'
RIGHT_STICK_NEGATIVE_X = 'rightxnegative'
RIGHT_STICK_NEGATIVE_Y = 'rightynegative'
RIGHT_STICK_POSITIVE_X = 'rightxpositive'
RIGHT_STICK_POSITIVE_Y = 'rightypositive'
RIGHT_STICK_X = 'rightx'
RIGHT_STICK_Y = 'righty'
RIGHT_TRIGGER = 'righttrigger'
class arcade.future.input.inputs.ControllerButtons(value)[source]

Bases: StrEnum

An enumeration.

BACK = 'back'
BOTTOM_FACE = 'a'
DPAD_DOWN = 'dpdown'
DPAD_LEFT = 'dpleft'
DPAD_RIGHT = 'dpright'
DPAD_UP = 'dpup'
GUIDE = 'guide'
LEFT_FACE = 'x'
LEFT_SHOULDER = 'leftshoulder'
LEFT_STICK = 'leftstick'
LEFT_TRIGGER = 'lefttrigger'
RIGHT_FACE = 'b'
RIGHT_SHOULDER = 'rightshoulder'
RIGHT_STICK = 'rightstick'
RIGHT_TRIGGER = 'righttrigger'
START = 'start'
TOP_FACE = 'y'
class arcade.future.input.inputs.XBoxControllerButtons(value)[source]

Bases: StrEnum

An enumeration.

A = 'a'
B = 'b'
DPAD_DOWN = 'dpdown'
DPAD_LEFT = 'dpleft'
DPAD_RIGHT = 'dpright'
DPAD_UP = 'dpup'
GUIDE = 'guide'
LEFT_BUMPER = 'leftshoulder'
LEFT_STICK = 'leftstick'
RIGHT_BUMPER = 'rightshoulder'
RIGHT_STICK = 'rightstick'
SELECT = 'back'
START = 'start'
X = 'x'
Y = 'y'
class arcade.future.input.inputs.PSControllerButtons(value)[source]

Bases: StrEnum

An enumeration.

CIRCLE = 'b'
CROSS = 'a'
DPAD_DOWN = 'dpdown'
DPAD_LEFT = 'dpleft'
DPAD_RIGHT = 'dpright'
DPAD_UP = 'dpup'
GUIDE = 'guide'
L1 = 'leftshoulder'
L2 = 'lefttrigger'
L3 = 'leftstick'
R1 = 'rightshoulder'
R2 = 'righttrigger'
R3 = 'rightstick'
SELECT = 'back'
SQUARE = 'x'
START = 'start'
TRIANGLE = 'y'
class arcade.future.input.inputs.Keys(value)[source]

Bases: InputEnum

An enumeration.

A = 97
AMPERSAND = 38
APOSTROPHE = 39
ASCIICIRCUM = 94
ASCIITILDE = 126
ASTERISK = 42
AT = 64
B = 98
BACKSLASH = 92
BACKSPACE = 65288
BAR = 124
BEGIN = 65368
BRACELEFT = 123
BRACERIGHT = 125
BRACKETLEFT = 91
BRACKETRIGHT = 93
BREAK = 65387
C = 99
CANCEL = 65385
CAPSLOCK = 65509
CLEAR = 65291
COLON = 58
COMMA = 44
D = 100
DELETE = 65535
DOLLAR = 36
DOUBLEQUOTE = 34
DOWN = 65364
E = 101
END = 65367
ENTER = 65293
EQUAL = 61
ESCAPE = 65307
EXCLAMATION = 33
EXECUTE = 65378
F = 102
F1 = 65470
F10 = 65479
F11 = 65480
F12 = 65481
F13 = 65482
F14 = 65483
F15 = 65484
F16 = 65485
F17 = 65486
F18 = 65487
F19 = 65488
F2 = 65471
F20 = 65489
F21 = 65490
F22 = 65491
F23 = 65492
F24 = 65493
F3 = 65472
F4 = 65473
F5 = 65474
F6 = 65475
F7 = 65476
F8 = 65477
F9 = 65478
FIND = 65384
G = 103
GRAVE = 96
GREATER = 62
H = 104
HASH = 35
HELP = 65386
HOME = 65360
I = 105
INSERT = 65379
J = 106
K = 107
KEY_0 = 48
KEY_1 = 49
KEY_2 = 50
KEY_3 = 51
KEY_4 = 52
KEY_5 = 53
KEY_6 = 54
KEY_7 = 55
KEY_8 = 56
KEY_9 = 57
L = 108
LALT = 65513
LCOMMAND = 65517
LCTRL = 65507
LEFT = 65361
LESS = 60
LINEFEED = 65290
LMETA = 65511
LOPTION = 65488
LSHIFT = 65505
LWINDOWS = 65515
M = 109
MENU = 65383
MINUS = 45
MODESWITCH = 65406
MOD_ACCEL = 2
MOD_ALT = 4
MOD_CAPSLOCK = 8
MOD_COMMAND = 64
MOD_CTRL = 2
MOD_NUMLOCK = 16
MOD_OPTION = 128
MOD_SCROLLLOCK = 256
MOD_SHIFT = 1
MOD_WINDOWS = 32
MOTION_BACKSPACE = 65288
MOTION_BEGINNING_OF_FILE = 5
MOTION_BEGINNING_OF_LINE = 3
MOTION_DELETE = 65535
MOTION_DOWN = 65364
MOTION_END_OF_FILE = 6
MOTION_END_OF_LINE = 4
MOTION_LEFT = 65361
MOTION_NEXT_PAGE = 65366
MOTION_NEXT_WORD = 1
MOTION_PREVIOUS_PAGE = 65365
MOTION_PREVIOUS_WORD = 2
MOTION_RIGHT = 65363
MOTION_UP = 65362
N = 110
NUMLOCK = 65407
NUM_0 = 65456
NUM_1 = 65457
NUM_2 = 65458
NUM_3 = 65459
NUM_4 = 65460
NUM_5 = 65461
NUM_6 = 65462
NUM_7 = 65463
NUM_8 = 65464
NUM_9 = 65465
NUM_ADD = 65451
NUM_BEGIN = 65437
NUM_DECIMAL = 65454
NUM_DELETE = 65439
NUM_DIVIDE = 65455
NUM_DOWN = 65433
NUM_END = 65436
NUM_ENTER = 65421
NUM_EQUAL = 65469
NUM_F1 = 65425
NUM_F2 = 65426
NUM_F3 = 65427
NUM_F4 = 65428
NUM_HOME = 65429
NUM_INSERT = 65438
NUM_LEFT = 65430
NUM_MULTIPLY = 65450
NUM_NEXT = 65435
NUM_PAGE_DOWN = 65435
NUM_PAGE_UP = 65434
NUM_PRIOR = 65434
NUM_RIGHT = 65432
NUM_SEPARATOR = 65452
NUM_SPACE = 65408
NUM_SUBTRACT = 65453
NUM_TAB = 65417
NUM_UP = 65431
O = 111
P = 112
PAGEDOWN = 65366
PAGEUP = 65365
PARENLEFT = 40
PARENRIGHT = 41
PAUSE = 65299
PERCENT = 37
PERIOD = 46
PLUS = 43
POUND = 35
PRINT = 65377
Q = 113
QUESTION = 63
QUOTELEFT = 96
R = 114
RALT = 65514
RCOMMAND = 65518
RCTRL = 65508
REDO = 65382
RETURN = 65293
RIGHT = 65363
RMETA = 65512
ROPTION = 65489
RSHIFT = 65506
RWINDOWS = 65516
S = 115
SCRIPTSWITCH = 65406
SCROLLLOCK = 65300
SELECT = 65376
SEMICOLON = 59
SLASH = 47
SPACE = 32
SYSREQ = 65301
T = 116
TAB = 65289
U = 117
UNDERSCORE = 95
UNDO = 65381
UP = 65362
V = 118
W = 119
X = 120
Y = 121
Z = 122
class arcade.future.input.inputs.MouseAxes(value)[source]

Bases: InputEnum

An enumeration.

X = 0
Y = 1
class arcade.future.input.inputs.MouseButtons(value)[source]

Bases: InputEnum

An enumeration.

LEFT = 1
MIDDLE = 2
MOUSE_1 = 1
MOUSE_2 = 4
MOUSE_3 = 2
MOUSE_4 = 8
MOUSE_5 = 16
RIGHT = 4
arcade.future.input.inputs.parse_mapping_input_enum(raw: RawBindBase) InputEnum[source]

Parse the InputEnum for a given raw value.

See RawBindBase to learn more about required arguments.

Parameters:

raw – A dict with "input_type" and "input" corresponding to InputEnum values.

Returns:

An InputEnum.

class arcade.future.input.manager.RawInputManager[source]

Bases: TypedDict

actions: list[RawAction]
axes: list[RawAxis]
controller_deadzone: float
class arcade.future.input.manager.ActionState(value)[source]

Bases: Enum

An enumeration.

PRESSED = 1
RELEASED = 0
class arcade.future.input.manager.InputDevice(value)[source]

Bases: Enum

An enumeration.

CONTROLLER = 1
KEYBOARD = 0
class arcade.future.input.manager.InputManager(controller: Controller | None = None, allow_keyboard: bool = True, action_handlers: Callable[[str, ActionState], Any] | Iterable[Callable[[str, ActionState], Any]] = (), controller_deadzone: float = 0.1)[source]

Bases:

add_action_input(action: str, input: InputEnum, mod_shift: bool = False, mod_ctrl: bool = False, mod_alt: bool = False)[source]
add_axis_input(axis: str, input: InputEnum, scale: float = 1.0)[source]
property allow_keyboard
axis(name: str) float[source]
bind_controller(controller: Controller)[source]
clear_action_input(action: str)[source]
clear_axis_input(axis: str)[source]
copy_existing(existing: InputManager)[source]
dispatch_action(action: str, state: ActionState)[source]
classmethod from_existing(existing: InputManager, controller: Controller | None = None) InputManager[source]
new_action(name: str)[source]
new_axis(name: str)[source]
on_button_press(controller: Controller, button_name: str)[source]
on_button_release(controller: Controller, button_name: str)[source]
on_dpad_motion(controller: Controller, motion: Vec2)[source]
on_key_press(key: int, modifiers: int) None[source]
on_key_release(key: int, modifiers: int) None[source]
on_mouse_press(x: int, y: int, button: int, modifiers: int) None[source]
on_mouse_release(x: int, y: int, button: int, modifiers: int) None[source]
on_stick_motion(controller: Controller, name: str, motion: Vec2)[source]
on_trigger_motion(controller: Controller, trigger_name: str, value: float)[source]
classmethod parse(raw: RawInputManager) InputManager[source]
register_action_handler(handler: Callable[[str, ActionState], Any] | Iterable[Callable[[str, ActionState], Any]])[source]
remove_action(name: str)[source]
remove_axis(name: str)[source]
serialize() RawInputManager[source]
subscribe_to_action(name: str, subscriber: Callable[[ActionState], Any])[source]
unbind_controller()[source]
update()[source]
class arcade.future.input.input_mapping.Action(name: str)[source]

Bases:

add_mapping(mapping: ActionMapping) None[source]
remove_mapping(mapping: ActionMapping) None[source]
class arcade.future.input.input_mapping.Axis(name: str)[source]

Bases:

add_mapping(mapping: AxisMapping) None[source]
remove_mapping(mapping: AxisMapping) None[source]
class arcade.future.input.input_mapping.InputMapping(input: InputEnum)[source]

Bases:

Base class for other mappings.

Without subclassing, it’s still useful as a type annotation since we we use type hashing a lot.

class arcade.future.input.input_mapping.ActionMapping(input: InputEnum, mod_shift: bool = False, mod_ctrl: bool = False, mod_alt: bool = False)[source]

Bases: InputMapping

class arcade.future.input.input_mapping.AxisMapping(input: InputEnum, scale: float)[source]

Bases: InputMapping

arcade.future.input.input_mapping.serialize_action(action: Action) RawAction[source]
arcade.future.input.input_mapping.parse_raw_axis(raw_axis: RawAxis) Axis[source]
arcade.future.input.input_mapping.serialize_axis(axis: Axis) RawAxis[source]
class arcade.future.input.raw_dicts.RawBindBase[source]

Bases: TypedDict

General base for raw axis or action binds.

Anything matching this can be passed to parse_mapping_input_enum() to extract a corresponding InputEnum value.

For specific raw types, see:

input: str | int
input_type: int
class arcade.future.input.raw_dicts.RawActionMapping[source]

Bases: RawBindBase

input: str | int
input_type: int
mod_alt: bool
mod_ctrl: bool
mod_shift: bool
class arcade.future.input.raw_dicts.RawAxisMapping[source]

Bases: RawBindBase

input: str | int
input_type: int
scale: float
class arcade.future.input.raw_dicts.RawAction[source]

Bases: TypedDict

Annotates the raw form for ActionMapping.

mappings: list[RawActionMapping]
name: str
class arcade.future.input.raw_dicts.RawAxis[source]

Bases: TypedDict

Annotates the raw form for AxisMapping.

mappings: list[RawAxisMapping]
name: str
class arcade.future.background.background_texture.BackgroundTexture(texture: Texture2D, offset: tuple[float, float] = (0.0, 0.0), scale: float = 1.0, angle: float = 0.0)[source]

Bases:

BackgroundTextures are PODs (packet of data) types. They have very little functionality by themselves, but are used by Backgrounds. They hold an arcade.gl.Texture``and 3 `pyglet.math.Mat3.

The Mat3s define the scaling, rotation, and translation of the pixel data in the texture. see background_fs.glsl in resources/shaders for an implementation of this.

property angle: float
static from_file(tex_src: str, offset: tuple[float, float] = (0.0, 0.0), scale: float = 1.0, angle: float = 0.0, filters=(9728, 9728))[source]
property offset: tuple[float, float]
property pixel_transform
render_target(context: ArcadeContext, color_attachments: list[Texture2D] | None = None, depth_attachment: Texture2D | None = None) Framebuffer[source]
property scale: float
use(unit: int = 0) None[source]

Bind the texture to a channel,

Parameters:

unit – The texture unit to bind the texture.

property wrap_x: int

Get or set the horizontal wrapping of the texture. This decides how textures are read when texture coordinates are outside the [0.0, 1.0] area. Default value is REPEAT.

Valid options are:

# Note: Enums can also be accessed in arcade.gl.
# Repeat pixels on the y-axis.
texture.wrap_x = ctx.REPEAT
# Repeat pixels on the y-axis mirrored.
texture.wrap_x = ctx.MIRRORED_REPEAT
# Repeat the edge pixels when reading outside the texture.
texture.wrap_x = ctx.CLAMP_TO_EDGE
# Use the border color (black by default) when reading outside the texture.
texture.wrap_x = ctx.CLAMP_TO_BORDER
Type:

int

property wrap_y: int

Get or set the horizontal wrapping of the texture. This decides how textures are read when texture coordinates are outside the [0.0, 1.0] area. Default value is REPEAT.

Valid options are:

# Note: Enums can also be accessed in arcade.gl.
# Repeat pixels on the y-axis.
texture.wrap_y = ctx.REPEAT
# Repeat pixels on the y-axis mirrored.
texture.wrap_y = ctx.MIRRORED_REPEAT
# Repeat the edge pixels when reading outside the texture.
texture.wrap_y = ctx.CLAMP_TO_EDGE
# Use the border color (black by default) when reading outside the texture.
texture.wrap_y = ctx.CLAMP_TO_BORDER
Type:

int

class arcade.future.background.background.Background(texture: BackgroundTexture, pos: tuple[float, float], size: tuple[int, int], color: tuple[float, float, float] | tuple[int, int, int], shader: Program | None = None, geometry: Geometry | None = None)[source]

Bases:

Backgrounds are large geometries to which a Background texture is rendered. By default, the position defines the bottom left corner. If the size is larger than the given BackgroundTexture the texture will repeat. A shift value can be given when calling draw. This can be used to move the background without actually adjusting the position You may supply your own shader and geometries. The default shader implements 4 uniforms. vec2 pos, vec2 size, vec3 color, mat3 pixelTransform, and float blend.

property blend: float
blend_layer(other, percent: float)[source]
property color: tuple[int, int, int]

Color in the range of 0-255.

property color_norm: tuple[float, float, float]
draw(shift: tuple[float, float] = (0.0, 0.0))[source]
static from_file(tex_src: str, pos: tuple[float, float] = (0.0, 0.0), size: tuple[int, int] | None = None, offset: tuple[float, float] = (0.0, 0.0), scale: float = 1.0, angle: float = 0.0, *, filters=(9728, 9728), color: tuple[int, int, int] | None = None, color_norm: tuple[float, float, float] | None = None, shader: Program | None = None, geometry: Geometry | None = None)[source]

This will generate a Background from an input image source. The generated texture is not stored in the texture cache or any texture atlas.

Parameters:
  • tex_src – The image source.

  • pos – The position of the Background (Bottom Left Corner by default).

  • size – The width and height of the Background.

  • offset – The BackgroundTexture offset.

  • scale – The BackgroundTexture Scale.

  • angle – The BackgroundTexture angle.

  • filters – The OpenGl Texture filters (gl.Nearest by default).

  • color – This is a color defined from 0-255. Priorities color_norm

  • color_norm – This is a color defined from 0.0-1.0. Priorities color_norm assumed to be in the range 0.0-1.0.

  • shader – The shader used for rendering.

  • geometry – The geometry used for rendering (a rectangle equal to the size by default).

property pos: tuple[float, float]
property size: tuple[int, int]
class arcade.future.background.groups.BackgroundGroup(backgrounds: list[Background] | None = None)[source]

Bases:

If you have many backgrounds which you would like to draw together and move together this can help. The pos of the Background Group is independent of each Background pos. The offset of the BackgroundGroup is the same as each background.

add(item: Background)[source]
add_from_file(tex_src: str, pos: tuple[float, float] = (0.0, 0.0), size: tuple[int, int] | None = None, offset: tuple[float, float] = (0.0, 0.0), scale: float = 1.0, angle: float = 0.0, *, filters=(9728, 9728), color: tuple[int, int, int] | None = None, color_norm: tuple[float, float, float] | None = None, shader: Program | None = None, geometry: Geometry | None = None)[source]
draw()[source]
extend(items: list[Background])[source]
property offset
property pos
class arcade.future.background.groups.ParallaxGroup(backgrounds: list[Background] | None = None, depths: list[float] | None = None)[source]

Bases:

The ParallaxBackground holds a list of backgrounds and a list of depths. When you change the offset through the ParallaxBackground each Background’s offset will be set inversely proportional to its depth. This creates the effect of Backgrounds with greater depths appearing further away. The depth does not affect the positioning of layers at all.

add(item: Background, depth: float = 1.0)[source]
add_from_file(tex_src: str, pos: tuple[float, float] = (0.0, 0.0), size: tuple[int, int] | None = None, depth: float = 1, offset: tuple[float, float] = (0.0, 0.0), scale: float = 1.0, angle: float = 0.0, *, filters=(9728, 9728), color: tuple[int, int, int] | None = None, color_norm: tuple[float, float, float] | None = None, shader: Program | None = None, geometry: Geometry | None = None)[source]
change_depth(item: Background, new_depth: float)[source]
draw()[source]
extend(items: list[Background], depths: list[float])[source]
property offset: tuple[float, float]
property pos: tuple[float, float]
remove(item: Background)[source]
class arcade.future.light.lights.Light(center_x: float, center_y: float, radius: float = 50.0, color: tuple[int, int, int] | tuple[int, int, int, int] = (255, 255, 255, 255), mode: str = 'hard')[source]

Bases:

Create a Light.

Note: It’s important to separate lights that don’t change properties and static ones with the usage parameter.

Parameters:
  • center_x – X position of the light

  • center_y – Y position of the light

  • radius – Radius of the light

  • color – Color of the light

  • mode – ‘hard’ or ‘soft’ light

HARD = 1.0
SOFT = 0.0
property position: tuple[float, float]

Get or set the light position

property radius: float

Get or set the light size

class arcade.future.light.lights.LightLayer(width: int, height: int)[source]

Bases: RenderTargetTexture

Create a LightLayer

The size of a layer should ideally be of the same size and the screen.

Parameters:
  • width – Width of light layer

  • height – Height of light layer

🧙 iter(self) Iterator[Light][source]

Return an iterable object of lights

🧙 len(self) int[source]

Number of lights

add(light: Light)[source]

Add a Light to the layer

clear()[source]
property diffuse_texture
draw(position: tuple[float, float] = (0, 0), target=None, ambient_color: tuple[int, int, int] | tuple[int, int, int, int] = (64, 64, 64))[source]

Draw the lights

Parameters:
  • position – Position offset (scrolling)

  • target – The window or framebuffer we want to render to (default is window)

  • ambient_color – The ambient light color

extend(lights: Sequence[Light])[source]
property light_texture
remove(light: Light)[source]

Remove a light to the layer

resize(width, height)[source]
class arcade.future.video.video_player.VideoPlayer(path: str | Path, loop: bool = False)[source]

Bases:

Primitive video player for arcade.

Parameters:
  • path – Path of the video that is to be played.

  • loop – Pass True to make the video loop.

draw(left: int = 0, bottom: int = 0, size: tuple[int, int] | None = None) None[source]

Draw the current video frame.

Parameters:
  • left – Window position from the left.

  • bottom – Window position from the bottom.

  • size – The size of the video rectangle. If None, the video will be drawn in its original size.

get_video_size() tuple[int, int][source]
property height: int

Video height.

property width: int

Video width.

class arcade.future.video.video_player.VideoPlayerView(path: str | Path)[source]

Bases: View

on_draw() None[source]