siege.io

ActionState

class ActionState
clear()

Clears all added inputs.

requireRelease()

Requires this action to have all inputs released before it can be triggered again.

elapsed
Total time for current state
inputs
List of GameInputs for this ActionState
isDisabled
Set to True to disable this ActionState from checking input
isPressed
Is True when input has been received
isPressedThisFrame
Tracks if this input was being pressed this frame
justPressed
Is True on initial input. False when input is held down.
justPressedThisFrame
Tracks if this input was just pressed this frame
justReleased
Is True on initial input release, False otherwise
justReleasedThisFrame
Tracks if this input was just released this frame
onChange
Event to call on state change
whilePressed
Event to call every frame the input is pressed

DataStream

class DataStream
__init__(arg2)
Parameters:arg2 (int) –
append(data)

Adds data to the end of the buffer

Parameters:data (DataStream) – DataStream to add on to current buffer
append(data, size)

Adds size amount of data to the end of current buffer

Parameters:
  • data (object) – data to add on to current buffer
  • size (int) – size of the data to add
begin()

Reads a partition header and pushes it onto the stack

clear()

Removes all data from the buffer

compress()

Compresses the data in the buffer

converge()

Exits a partition scope and moves to the outer partition

decompress()

Decompresses the data in the buffer

diverge()

Creates a partition in the datastream that is prefixed with a size header

end()

Used to signal the stream that the current position should be at the end of a partition

partitionLength()

Returns length of the top of the partition stack

Return type:int
readBool()

Ret a boolean from the buffer and returns it

Return type:bool
readColor()

Read a Color from the buffer and returns it

Return type:Color
readDict()

Reads a Python dictionary from the buffer and returns it

Return type:dict
readDouble()

Read an double from the buffer and returns it

Return type:float
readFloat()

Read an float from the buffer and returns it

Return type:float
readInt16()

Read an integer from the buffer and returns it

Return type:int
readInt32()

Read an integer from the buffer and returns it

Return type:int
readInt8()

Read an integer from the buffer and returns it

Return type:int
readNullTermString()

Reads a null terminated string from the buffer and returns it

Return type:str
readObject()

Reads a Python obejct from the buffer and returns it

Return type:object
readPixelRect()

Read a PixelRect from the buffer and returns it

Return type:PixelRect
readPixelVector()

Read a PixelVector from the buffer and returns it

Return type:PixelVector
readRect()

Read a Rect from the buffer and returns it

Return type:Rect
readString()

Read a string from the buffer and returns it

Return type:str
readTileRect()

Read a TileRect from the buffer and returns it

Return type:TileRect
readTileVector()

Read a TileVector from the buffer and returns it

Return type:TileVector
readUint16()

Read an integer from the buffer and returns it

Return type:int
readUint32()

Read an integer from the buffer and returns it

Return type:int
readUint64()

Read an integer from the buffer and returns it

Return type:long
readUint8()

Read an integer from the buffer and returns it

Return type:int
readVector()

Read a Vector from the buffer and returns it

Return type:Vector
readVector3()

Read a Vector3 from the buffer and returns it

Return type:Vector3
readWString()

Read an wide character string from the buffer and returns it

Return type:unicode
reserve(arg2)

Reserves space in the buffer to improve performance

Parameters:arg2 (int) –
resize(arg2)

Resizes the buffer to the specified size

Parameters:arg2 (int) –
size()

Returns the size of the data in the buffer

Return type:int
skip()

Skips over the remainder of the current partition

writeBool(data)

Appends data to the end of the current buffer data

Parameters:data (bool) – Boolean to write to buffer
writeColor(data)

Appends data to the end of the current buffer data

Parameters:data (Color) – Color to write to buffer
writeDict(data)

Appends data to the end of the current buffer data

Parameters:data (dict) – Python dictionary to write to buffer
writeDouble(data)

Appends data to the end of the current buffer data

Parameters:data (float) – Double to write to buffer
writeFloat(data)

Appends data to the end of the current buffer data

Parameters:data (float) – Float to write to buffer
writeInt16(data)

Appends data to the end of the current buffer data

Parameters:data (int) – Int16 to write to buffer
writeInt32(data)

Appends data to the end of the current buffer data

Parameters:data (int) – Int32 to write to buffer
writeInt8(data)

Appends data to the end of the current buffer data

Parameters:data (int) – Int8 to write to buffer
writeNullTermString(data)

Appends a null terminated string to the end of the current buffer.

Parameters:data (str) – String to write to buffer
writeObject(data)

Appends data to the end of the current buffer data

Parameters:data (object) – Python Object to write to buffer
writePixelRect(data)

Appends data to the end of the current buffer data

Parameters:data (PixelRect) – PixelRect to write to buffer
writePixelVector(data)

Appends data to the end of the current buffer data

Parameters:data (PixelVector) – PixelVector to write to buffer
writeRect(data)

Appends data to the end of the current buffer data

Parameters:data (Rect) – Rect to write to buffer
writeString(data)

Appends data to the end of the current buffer data

Parameters:data (str) – String to write to buffer
writeTileRect(data)

Appends data to the end of the current buffer data

Parameters:data (TileRect) – TileRect to write to buffer
writeTileVector(data)

Appends data to the end of the current buffer data

Parameters:data (TileVector) – TileVector to write to buffer
writeUint16(data)

Appends data to the end of the current buffer data

Parameters:data (int) – Uint16 to write to buffer
writeUint32(data)

Appends data to the end of the current buffer data

Parameters:data (int) – Uint32 to write to buffer
writeUint64(data)

Appends data to the end of the current buffer data

Parameters:data (long) – Uint64 to write to buffer
writeUint8(data)

Appends data to the end of the current buffer data

Parameters:data (int) – Uint8 to write to buffer
writeVector(data)

Appends data to the end of the current buffer data

Parameters:data (Vector) – Vector to write to buffer
writeVector3(data)

Appends data to the end of the current buffer data

Parameters:data (Vector3) – Vector3 to write to buffer
writeWString(data)

Appends data to the end of the current buffer data

Parameters:data (unicode) – Wide String to write to buffer

File

class File
static backupCloudFiles(arg1, arg2)
Parameters:
  • arg1 (str) –
  • arg2 (object) –
static exists(filePath[, isCloudSave=True])
Parameters:
  • filePath (object) –
  • isCloudSave (bool) –
Return type:

bool

static getCharacters(configDirectory)
Parameters:configDirectory (object) –
Return type:StringList
static getValidPath(filePath)

Formats a string to remove invalid characters from a string ([?\/:*<>|”])

Parameters:filePath (str) – Path to the file
Returns:A formated string
Return type:str
static getWorlds(configDirectory)
Parameters:configDirectory (object) –
Return type:StringList
static load(filePath, data[, isCloudSave=True])

Appends the file data to the DataStream

Parameters:
  • filePath (object) – Path to the file
  • data (DataStream) – DataStream to write to
  • isCloudSave (bool) –
Returns:

Returns the file version number

Return type:

int

static open(filePath)

Opens file at the path and reads into a buffer

Parameters:filePath (object) – Path to target file
Returns:If the file is valid it is returned
Return type:File
static remove(filePath[, isCloudSave=True])
Parameters:
  • filePath (object) –
  • isCloudSave (bool) –
static removeDirectory(directoryPath[, isCloudSave=True])
Parameters:
  • directoryPath (object) –
  • isCloudSave (bool) –
static save(filePath, data[, isCloudSave=True])

Writes contents of data to the file at path

Parameters:
  • filePath (object) – Path to file for writing
  • data (DataStream) – Data to write to the file
  • isCloudSave (bool) –
static saveSimple(filePath, data[, isCloudSave=True])

Writes contents of data to the file at path

Parameters:
  • filePath (object) – Path to file for writing
  • data (str) – Data to write to the file
  • isCloudSave (bool) –
static usingSteamCloud()
Return type:bool

FileManager

class FileManager
asyncRead(filePath, onComplete, isCreaFile[, useCompression=True[, isCloudSave=True]])

Reads from a file using a new thread

Parameters:
  • filePath (object) – Path to the file
  • onComplete (FileOnCompleteHandler) – Filer handler for a complete read
  • isCreaFile (bool) – Set to true to mark file as a Crea file, false otherwise
  • useCompression (bool) – Decompress the data read from file.
  • isCloudSave (bool) – Saved to Steam Cloud (if enabled)
asyncWrite(filePath, onComplete, stream[, useCompression=True[, isCloudSave=True]])

Writes to a file using a new thread

Parameters:
  • filePath (object) – Path to the file
  • onComplete (FileOnCompleteHandler) – FileOnCompleteHandler Callback function that is called when the file write is finished.
  • stream (DataStream) – DataStream to write to
  • useCompression (bool) – Compress stream before writing to file.
  • isCloudSave (bool) – Saved to Steam Cloud (if enabled)

FileOnCompleteHandler

class FileOnCompleteHandler
__call__(arg2, arg3)
Parameters:
static create([func=None])
Parameters:func (object) –
Return type:FileOnCompleteHandler

GameInput

class GameInput
isPriorityPressed()
Return type:bool
update()

Updates each ActionState in game

isPressed
True if any input was received from the user
priorityInputs

ComboInput

class ComboInput
__init__(inputs)
Parameters:inputs (list) –
inputs
The combination of GameInputs used.

JoyInput

class JoyInput
__eq__(arg2)
Parameters:arg2 (JoyInput) –
Return type:bool
__init__(joyId, joyButton)
Parameters:
  • joyId (int) –
  • joyButton (int) –
__init__(joyId, joyAxis, axisDelta)
Parameters:
  • joyId (int) –
  • joyAxis (Axis) –
  • axisDelta (float) –
axis
The joystick axis. See sf::Joystick::Axis
button
Which joystick button to use
delta
Dead zone for axis input
id
Index for this Joystick
position
The current position for the axis.
useAxis
Set to True for a joystick axis
useButton
Set to True for a joystick button

KeyInput

class KeyInput
__eq__(arg2)
Parameters:arg2 (KeyInput) –
Return type:bool
__init__(key)
Parameters:key (Key) –
key
Which keyboard key to use

MouseInput

class MouseInput
__eq__(arg2)
Parameters:arg2 (MouseInput) –
Return type:bool
__init__(button)
Parameters:button (Button) –
button
Which mouse button to use

GameInputList

class GameInputList
__contains__(arg2)
Parameters:arg2 (object) –
Return type:bool
__delitem__(arg2)
Parameters:arg2 (object) –
__getitem__(arg2)
Parameters:arg2 (object) –
Return type:object
__iter__()
Return type:object
__len__()
Return type:int
__setitem__(arg2, arg3)
Parameters:
  • arg2 (object) –
  • arg3 (object) –
append(arg2)
Parameters:arg2 (object) –
extend(arg2)
Parameters:arg2 (object) –

Input

class Input
createAction()

Returns a new ActionState

Return type:ActionState
removeAction(actionState)

Removes target ActionState from this Input

Parameters:actionState (ActionState) – The ActionState to be removed
update(frameTime)

Updates all ActionStates that this has created

Parameters:frameTime (int) – elapsed time for the frame
actions
List of ActionStates

Joystick

class Joystick
static getAxisPosition(joystick, axis)

Get the current position of a joystick axis

Parameters:
  • joystick (int) – Index of the joystick
  • axis (Axis) – Axis to check
Returns:

Current position of the axis, in range [-100, 100]

Return type:

float

static getButtonCount(joystick)

Return the number of buttons supported by a joystick.

Parameters:joystick (int) – Index of the joystick
Returns:Number of buttons supported by the joystick, or 0 if joystick is not connected
Return type:int
static getIdentification(joystick)

Get the joystick information

Parameters:joystick (int) – Index of the joystick
Returns:Structure containing joystick information.
Return type:JoystickIdentification
static hasAxis(joystick, axis)

Check if a joystick supports a given axis.

Parameters:
  • joystick (int) – Indexof the joystick
  • axis (Axis) – Axis to check
Returns:

True if the joystick supports the axis, false otherwise

Return type:

bool

static isButtonPressed(joystick, button)

Check if a joystick button is pressed.

Parameters:
  • joystick (int) – Index of joystick
  • button (int) – Button to check
Returns:

True if the button is pressed, false otherwise

Return type:

bool

static isConnected(joystick)

Check if a joystick is connected.

Parameters:joystick (int) – Index of joystick to check
Returns:True if the joystick is connected, false otherwise
Return type:bool
static update()

Update the states of all joysticks.

Axis = <class 'siege.io.Axis'>
AxisCount = 8
ButtonCount = 32
Count = 8
PovX = siege.io.Axis.PovX
PovY = siege.io.Axis.PovY
R = siege.io.Axis.R
U = siege.io.Axis.U
V = siege.io.Axis.V
X = siege.io.Axis.X
Y = siege.io.Axis.Y
Z = siege.io.Axis.Z

JoystickIdentification

class JoystickIdentification
name
productId
vendorId

Keyboard

class Keyboard
static isKeyPressed(key)

Check if a key is pressed

Parameters:key (Key) – The key to check
Returns:True if key pressed, false otherwise
Return type:bool
A = siege.io.Key.A
Add = siege.io.Key.Add
B = siege.io.Key.B
BackSlash = siege.io.Key.BackSlash
BackSpace = siege.io.Key.BackSpace
C = siege.io.Key.C
Comma = siege.io.Key.Comma
D = siege.io.Key.D
Dash = siege.io.Key.Dash
Delete = siege.io.Key.Delete
Divide = siege.io.Key.Divide
Down = siege.io.Key.Down
E = siege.io.Key.E
End = siege.io.Key.End
Equal = siege.io.Key.Equal
Escape = siege.io.Key.Escape
F = siege.io.Key.F
F1 = siege.io.Key.F1
F10 = siege.io.Key.F10
F11 = siege.io.Key.F11
F12 = siege.io.Key.F12
F13 = siege.io.Key.F13
F14 = siege.io.Key.F14
F15 = siege.io.Key.F15
F2 = siege.io.Key.F2
F3 = siege.io.Key.F3
F4 = siege.io.Key.F4
F5 = siege.io.Key.F5
F6 = siege.io.Key.F6
F7 = siege.io.Key.F7
F8 = siege.io.Key.F8
F9 = siege.io.Key.F9
G = siege.io.Key.G
H = siege.io.Key.H
Home = siege.io.Key.Home
I = siege.io.Key.I
Insert = siege.io.Key.Insert
J = siege.io.Key.J
K = siege.io.Key.K
Key = <class 'siege.io.Key'>
KeyCount = siege.io.Key.KeyCount
L = siege.io.Key.L
LAlt = siege.io.Key.LAlt
LBracket = siege.io.Key.LBracket
LControl = siege.io.Key.LControl
LShift = siege.io.Key.LShift
LSystem = siege.io.Key.LSystem
Left = siege.io.Key.Left
M = siege.io.Key.M
Menu = siege.io.Key.Menu
Multiply = siege.io.Key.Multiply
N = siege.io.Key.N
Num0 = siege.io.Key.Num0
Num1 = siege.io.Key.Num1
Num2 = siege.io.Key.Num2
Num3 = siege.io.Key.Num3
Num4 = siege.io.Key.Num4
Num5 = siege.io.Key.Num5
Num6 = siege.io.Key.Num6
Num7 = siege.io.Key.Num7
Num8 = siege.io.Key.Num8
Num9 = siege.io.Key.Num9
Numpad0 = siege.io.Key.Numpad0
Numpad1 = siege.io.Key.Numpad1
Numpad2 = siege.io.Key.Numpad2
Numpad3 = siege.io.Key.Numpad3
Numpad4 = siege.io.Key.Numpad4
Numpad5 = siege.io.Key.Numpad5
Numpad6 = siege.io.Key.Numpad6
Numpad7 = siege.io.Key.Numpad7
Numpad8 = siege.io.Key.Numpad8
Numpad9 = siege.io.Key.Numpad9
O = siege.io.Key.O
P = siege.io.Key.P
PageDown = siege.io.Key.PageDown
PageUp = siege.io.Key.PageUp
Pause = siege.io.Key.Pause
Period = siege.io.Key.Period
Q = siege.io.Key.Q
Quote = siege.io.Key.Quote
R = siege.io.Key.R
RAlt = siege.io.Key.RAlt
RBracket = siege.io.Key.RBracket
RControl = siege.io.Key.RControl
RShift = siege.io.Key.RShift
RSystem = siege.io.Key.RSystem
Return = siege.io.Key.Return
Right = siege.io.Key.Right
S = siege.io.Key.S
SemiColon = siege.io.Key.SemiColon
Slash = siege.io.Key.Slash
Space = siege.io.Key.Space
Subtract = siege.io.Key.Subtract
T = siege.io.Key.T
Tab = siege.io.Key.Tab
Tilde = siege.io.Key.Tilde
U = siege.io.Key.U
Up = siege.io.Key.Up
V = siege.io.Key.V
W = siege.io.Key.W
X = siege.io.Key.X
Y = siege.io.Key.Y
Z = siege.io.Key.Z

Mouse

class Mouse
static getPosition()

Returns the current position of the mouse in desktop coordinates

Return type:sfTileVector
static getPosition(relativeTo)

Get the current position of the mouse in window coordinate

Parameters:relativeTo (object) – Reference window
Returns:Current position of the mouse
Return type:sfTileVector
static isButtonPressed(button)

Check if a mouse button is pressed

Parameters:button (Button) – Button to check
Returns:True if the button if pressed, false otherwise
Return type:bool
static setPosition(position)

Set the current position of the mouse in desktop coordinates.

Parameters:position (sfTileVector) – New position of the mouse
static setPosition(position, relativeTo)

This function sets the current position of the mouse cursor, relative to the given window.

Parameters:
  • position (sfTileVector) – New position of the mouse
  • relativeTo (object) – Reference window
Button = <class 'siege.io.Button'>
ButtonCount = siege.io.Button.ButtonCount
Left = siege.io.Button.Left
Middle = siege.io.Button.Middle
Right = siege.io.Button.Right
XButton1 = siege.io.Button.XButton1
XButton2 = siege.io.Button.XButton2