rui API

rui.rui module

class rui.rui.Component[source]

Bases: object

class rui.rui.Entity(tag='')[source]

Bases: object

Instances of Entity are unique IDs that hold Components. (optionally) tag is a string that refers to the entity

add_component(*args, **kwargs)[source]

Checks if alive before doing something

check_alive(function)[source]
get_component(*args, **kwargs)[source]

Checks if alive before doing something

get_components(*args, **kwargs)[source]

Checks if alive before doing something

get_tag(*args, **kwargs)[source]

Checks if alive before doing something

get_uuid(*args, **kwargs)[source]

Checks if alive before doing something

kill(*args, **kwargs)[source]

Checks if alive before doing something

set_tag(*args, **kwargs)[source]

Checks if alive before doing something

set_world(*args, **kwargs)[source]

Checks if alive before doing something

class rui.rui.System[source]

Bases: object

process(delta)[source]

Update the system

set_world(world)[source]

Sets the world this system belongs to

class rui.rui.World(delta=1)[source]

Bases: object

A World holds all entities, groups, and systems

add_entities(*entities)[source]

Add multiple entities to world All members of entities are of type Entity

add_entity(entity, second=False)[source]

Add entity to world. entity is of type Entity

add_system(system)[source]

Add system to the world. All systems will be processed on World.process() system is of type System

create_entity(tag='')[source]

Creates Entity (optionally) tag is a string that is the tag of the Entity.

deregister_entity_from_group(entity, group)[source]

Removes entity from group

get_delta()[source]

Returns delta

get_entities()[source]

Gets all entities

get_entities_by_components(*components)[source]

Get entity by list of components All members of components must be of type Component

get_entity_by_tag(tag)[source]

Get entity by tag tag is a string that is the tag of the Entity.

get_group(group)[source]

Gets a specific group group is the string of a Group

process()[source]

Processes entire world and all systems in it

register_entity_to_group(entity, group)[source]

Add entity to a group. If group does not exist, entity will be added as first member entity is of type Entity group is a string that is the name of the group

remove_entity(entity, second=False)[source]

Removes entity from world and kills entity

remove_system(system)[source]

Removes system from world and kills system

set_delta(delta)[source]

Sets delta

rui.exceptions module

exception rui.exceptions.DeadEntityError[source]

Bases: exceptions.Exception

exception rui.exceptions.DuplicateEntityError(entity)[source]

Bases: exceptions.Exception

exception rui.exceptions.DuplicateSystemError(system)[source]

Bases: exceptions.Exception

exception rui.exceptions.NonUniqueTagError(tag)[source]

Bases: exceptions.Exception

exception rui.exceptions.UnmanagedEntityError(entity)[source]

Bases: exceptions.Exception

exception rui.exceptions.UnmanagedSystemError(system)[source]

Bases: exceptions.Exception