core.utils package

Submodules

core.utils.aliases module

Aliases for various types used within Forge that do not need to be exposed.

core.utils.base module

Various base classes for Forge to organize code.

class core.utils.base.Renderable(*args, **kwargs)

Bases: Protocol

Base renderable class for Forge.

render(display: Surface) None

Render the object to the display.

Parameters

display (core.utils.aliases.Surface) – Display to which the object is to be rendered.

core.utils.dispatch module

Custom function-overloading in Python using Python decorators with type-hints.

core.utils.dispatch.multidispatch(*types: Type)

Decorator for class methods using type-hints enabling, function-overloading using dynamic dispatch.

Parameters

types (tuple[Type]) – Types to be overloaded.

core.utils.loaders module

Loaders for various assets in Forge.

core.utils.loaders.load_sprites_from_folders(path: str) list[core.engine.sprite.Sprite]

Load files from various nested sub-folders as Forge sprites.

Parameters

path (str) – Base or parent folder path.

Returns

List of all sprites loaded from the sub-folders.

Return type

list[core.engine.sprite.Sprite]

core.utils.shapes module

Basic shapes in Forge.

class core.utils.shapes.Circle(radius: float)

Bases: Shape

Circle shape in Forge.

area() float

Calculate the area of the circle.

Returns

Area of the circle.

Return type

float

radius: float
class core.utils.shapes.Rectangle(width: float, height: float)

Bases: Shape

Rectangle shape in Forge.

area() float

Calculate the area of the rectangle.

Returns

Area of the rectangle.

Return type

float

height: float
width: float
class core.utils.shapes.Shape(*args, **kwargs)

Bases: Protocol

Base shape class in Forge.

area() float

Calculate the area of the shape.

Returns

Area of the shape.

Return type

float

class core.utils.shapes.ShapeType(value)

Bases: Enum

Enumeration of all shape types supported by Forge.

CIRCLE = 2
RECTANGLE = 1

Module contents