lucia

The main Lucia module

The functions here are responsible for initializing and quitting lucia, showing the game window, handle global events and so on. In addition, this part of lucia also contains most keyboard functions.

AudioBackend

AudioBackend(self, /, *args, **kwargs)

BASS

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

FMOD

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

OPENAL

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

initialize

initialize(audiobackend=1)

Initialize lucia and the underlying graphic, audio, keyboard, interface engines

quit

quit()

Shutdown lucia and close underlying engines freeing up system resources

show_window

show_window(title='LuciaGame', size=(640, 480))

Shows the main game window on the screen, this is most likely called at the start of a game

process_events

process_events()

This processes events for the window This should be called in any loop, to insure that the window and application stays responsive

key_pressed

key_pressed(key_code)

Checks if a key was pressed down this frame (single key press) * key_code: A pygame.K_ key code

returns: True if the specified key kode was pressed, False otherwise.

key_released

key_released(key_code)

Checks if a key was released down this frame (single key release) * key_code: A pygame.K_ key code

returns: True if the specified key kode was released, False otherwise.

key_down

key_down(key_code)

Checks if a key is beeing held down. * key_code: A pygame.K_ key code

returns: True if the specified key kode is beeing held down, False otherwise.

key_up

key_up(key_code)

Check if a key isn't beeing held down (ie if it's not pressed and held) * key_code : A pygame.K_ key code

returns: True if key is not held down, False otherwise

lucia.data

Provides functions for easily manipulating textual or binary data. Currently includes encryption and compression.

unsupportedAlgorithm

unsupportedAlgorithm(self, /, *args, **kwargs)

raised when the user tries supplying an algorithm not specified in constants

output

An output which automatically selects the first available output on the system

outputs

Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

lucia.packfile

Lucia's resource pack module

This module will aid in the interaction with and creation of data files for storing game assets. A lucia resource file is a binary file format with the ability to have encryption and/or compression instituted on a per-file basis at creation time. Using the get method one may retrieve the contents of any file added to the pack, for example to be used in a memory load function of a sound system.

InvalidPackHeader

InvalidPackHeader(self, /, *args, **kwargs)

raised when the packs header is invalid

ResourceFileVersion

ResourceFileVersion(self, /, *args, **kwargs)

The version should only change if changes are introduced that breaks backwards compatibility

v1

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

LoadPolicy

LoadPolicy(self, /, *args, **kwargs)

The load policy used when loading in data from a resource file

LOAD_ALL loads everything into ram. LOAD_INDEX only load in the filenames and where they are located on disk.

LOAD_ALL

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

LOAD_INDEX

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

ResourceFileItem

ResourceFileItem(self, name, content, compress, encrypt)

Internal object representing an item in the pack.

ResourceFile

ResourceFile(self, key, header=b'LURF', version=1)

The resource file object

You will interact with resource files through methods provided by this object. This object may have any number of instances, however only one instance should interact with a given file on the file system at a time.

load

ResourceFile.load(self, filename, policy=1)

Opens a resource file to be read.

This file will be checked for validity based on matching header, version, and a non-0 number of files. If one of these conditions fails, InvalidPackHeader will be raised. Otherwise this object will be loaded with the contents. :param filename: The file name to be read from the file system. :param policy (optional): The load policy to use, defaults to LoadPolicy.LOAD_ALL

save

ResourceFile.save(self, filename)

Saves data added to this object to a resource file.

When creating a resource file, this is the final method you would call. args: :param filename: The file name on disk to write to. Will be overwritten if already exists.

add_file

ResourceFile.add_file(self, name, compress=True, encrypt=True, internalname=None)

Adds a file on disk to the pack, optionally compressing and/or encrypting it.

args: :param name: The file name to read from. :param compress (boolean, optional): Whether compression should be applied to this file. Defaults to True. :param encrypt (boolean, optional): Whether encryption should be applied to this file. Defaults to True. :param internalname (optional): Internal file name to be used inside the pack. If None, the default, internal name will be same as name on disk.

get

ResourceFile.get(self, name)

[summary]

Args: name ([str]): The key to lookup in the data file

Returns: bytes or none: Returns the found result, or none if nothing with the specified key was found.