Loxoc.core

Attributes

UniformValueType

The types able to be sent to shaders via Uniforms.

Classes

ShaderType

The shader type of a Shader object.

Camera

This class is the 3d perspective for a Window.

Mesh

This class is used to create/load meshes.

MeshDict

Loxoc.MeshDict is a datastructure that acts like a statically typed dictionary storing each Mesh by name.

Material

This decides how to render an Object (Object3D or Object2D).

Model

Holds all model data for an imported 3D asset file.

Object3D

This class is your 3D game object.

Shader

Used to import shader files (glsl) that can be used in Material s.

Vec4

A 4 float datastructure used to represent positional data, colors, or whatever you may need it for.

Vec3

A 3 float datastructure used to represent positional data, colors, or whatever you may need it for.

Vec2

A 2 float datastructure used to represent positional data, 2D rotation, or whatever you may need it for.

Window

An application window for a game. This class also keeps track of the state of the game engine runtime (ie. what to and not to render along with events and time).

EVENT_FLAG

An IO or engine event flag.

EVENT_STATE

The state of an IO or engine event flag.

MOUSE_EVENT_TYPE

The type of a mouse event.

MOUSE_BUTTON

The button of a mouse event.

MOUSE_WHEEL_DIRECTION

The wheel direction of a mouse wheel event.

MouseWheel

The mousewheel data for a mouse wheel event.

MouseDevice

The data for a mouse device populated durring a mouse event.

Event

This non-constructable class contains all information pertaining to Window events.

Quaternion

A "4 dimensional" rotation arround a developer defined Vec3 axis.

TextureFiltering

The texture filtering setting for a Texture .

TextureWraping

The texture wrapping setting for a Texture .

Texture

A texture for a Mesh or Sprite .

Sprite

The image asset which is used when rendering an Object2D . Serves a purpose similar to how Mesh is used with Object3D but for Object2D .

Object2D

An 2 Dimensional Object which is rendered infront of all Object3D s on the screen. Good for GUI, HUD interfaces, or anything else 2D.

PointLight

A Object that emits light from a Vec3 point in 3D space.

DirectionalLight

SpotLight

Collider

The Collider base class.

BoxCollider

An Oriented Box Collider.

ConvexCollider

A convex hull collider.

RayCollider

A raycast collider that takes in an Vec3 origin and Quaternion direction.

RayHit

Returned by RayCollider.get_collision . This class contains information about the RayCollider collision.

Matrix4x4

A 4 by 4 matrix.

Matrix3x4

A 3 by 4 matrix.

Matrix2x4

A 2 by 4 matrix.

Matrix3x3

A 3 by 3 matrix.

Matrix4x3

A 4 by 3 matrix.

Matrix2x3

A 2 by 3 matrix.

Matrix2x2

A 2 by 2 matrix.

Matrix3x2

A 3 by 2 matrix.

Matrix4x2

A 4 by 2 matrix.

Font

Renders the specified Font to the screen. Usable with Text .

Text

Renders the specified Text to the screen with the specified Font .

CubeMap

A cubemap. Can be used to create a SkyBox .

SkyBox

A CubeMap skybox. Can be applied to Window.sky_box .

Emitter

Emits particles.

Sound

A sound asset. This can also be used to play sounds directly.

Module Contents

Loxoc.core.UniformValueType

The types able to be sent to shaders via Uniforms.

Includes:

int , float , Matrix2x2 , Matrix2x3 , Matrix2x4 , Matrix3x2 , Matrix3x3 , Matrix3x4 , Matrix4x2 , Matrix4x3 , Matrix4x4 , Vec2 , Vec3 , Vec4

class Loxoc.core.ShaderType(*args, **kwds)

Bases: enum.Enum

The shader type of a Shader object.

FRAGMENT: ShaderType
VERTEX: ShaderType
GEOMETRY: ShaderType
COMPUTE: ShaderType
class Loxoc.core.Camera(position: Vec3, rotation: Vec3, view_width: int, view_height: int, focal_length: float, fov: float)

This class is the 3d perspective for a Window.

property view_width: int

The view width of the camera.

property view_height: int

The view height of the camera.

property focal_length: float

The focal length of the camera.

property fov: float

The field of view of the camera.

property deltatime: float

The deltatime of the Window the camera is attached to.

property dt: float

The deltatime of the Window the camera is attached to.

property time_ns: int

The time in nanoseconds since the creation of the Window the camera is attached to.

property time: int

The time in seconds since the creation of the Window the camera is attached to.

property position: Vec3

The current position of the Camera as a Vec3 .

property rotation: Quaternion

The current rotation of the Camera as a Quaternion .

class Loxoc.core.Mesh

This class is used to create/load meshes.

static from_file(file_path: str, animated: bool = False) Model

Returns the Model instance created from the provided file. If the 3D asset contains animations, set animated to True .

property name: str

Name of the mesh.

Return type:

str

class Loxoc.core.MeshDict(name: str, meshes: list[Mesh | MeshDict])

Loxoc.MeshDict is a datastructure that acts like a statically typed dictionary storing each Mesh by name. This is nessicary because 3D asset files can have more than one Mesh in them. If you have a 3D asset file with more than one Mesh inside of it, you can extract them from their MeshDict to new individual MeshDict s and then to Model s to be used in Object3D s like so:

my_assets: MeshDict = Model.from_file("./assets/models/model_name/model_name.gltf").mesh_dict
# Import the 3D asset file.

player_md = MeshDict("player_model_mesh", [my_assets["player_model"]])
# Extract the Mesh into its own group/MeshDict

player_object = Object3D(Model(player_md), Vec3(0.0, 0.0, 20.0), vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0))
# Now our model is ready to be used.

We can extract the Mesh s we need from the my_assets MeshDict by name. Hence we use my_assets["player_model"]. This is assuming your desired Mesh is at the top level of your imported 3D file/asset’s heirarchy. if it is in a group inside the 3D file/asset you imported you could do something like: my_assets["group_name"]["player_model"]

property name
The name associated with the :class:`MeshDict` .
insert(m: Mesh | MeshDict) None

Insert a Mesh. It will use the Mesh name as a key.

get(name: str) Mesh | MeshDict

Get a Mesh from the dict by name.

remove(name: str) None

Remove a Mesh from the dict by name.

__iter__() Generator[tuple[str, Mesh | MeshDict], None, None]

Itterates through the key value pairs of the dict.

__getitem__(key: str) Mesh | MeshDict

Get a Mesh from the dict by name.

class Loxoc.core.Material(vertex: Shader | None = None, fragment: Shader | None = None, geometry: Shader | None = None, compute: Shader | None = None, animated: bool = False)

This decides how to render an Object (Object3D or Object2D).

You may supply your own Shader s to customize how Objects are rendered.

set_uniform(name: str, value: UniformValueType) None

Sets the value of a uniform for the shaders in the material.

property diffuse_texture: Texture

The diffuse Texture .

property specular_texture: Texture

The specular Texture .

property normals_texture: Texture

The normal Texture .

class Loxoc.core.Model(mesh_dict: MeshDict, animated: bool = False)

Holds all model data for an imported 3D asset file.

static from_file(file_path: str, animated: bool = False) Model

Returns the Model instance created from the provided file. If the 3D asset contains animations, set animated to True .

property use_default_material_properties: bool

Uses the Material properties defined by each Mesh ‘s Material . This only has an effect if the Object3D of interest has an object-level Material set (having an object-level Material means the Object3D ‘s Object3D.material attribute is set.). When there is an object-level Material set, the default value for use_default_material_properties is False.

play_animation(animation: str) None

Plays the specified animation.

property mesh_dict: MeshDict

The Model ‘s MeshDict .

property animated: bool

Whether or not the model has animations. If it does set this to true.

class Loxoc.core.Object3D(model_data: Model, position: Vec3 = Vec3(0.0, 0.0, 0.0), rotation: Vec3 = Vec3(0.0, 0.0, 0.0), scale: Vec3 = Vec3(1.0, 1.0, 1.0), collider: Collider | None = None, material: Material | None = None)

This class is your 3D game object.

property use_default_material_properties: bool

Uses the Material properties defined by each Mesh ‘s Material . This only has an effect if the Object3D of interest has an object-level Material set (having an object-level Material means the Object3D ‘s Object3D.material attribute is set.). When there is an object-level Material set, the default value for use_default_material_properties is False.

property material: Material

The Material used to specify how to render the Object3D

property model: Model

The Model of the Object3D

add_collider(collider: Collider) None

Adds a Collider to the object.

remove_collider(collider: Collider) None

Removes a Collider from the object.

check_collision(intersection: Vec3 | Object3D) bool

Checks for a collision between this Object3D and another Object3D or Vec3 .

get_model_matrix() Matrix4x4

Returns an instance of the model matrix as a Matrix4x4 .

play_animation(animation_name: str) None

Plays the specified animation by name of the model.

property position: Vec3

The position of the object as a vec3.

property rotation: Quaternion

The rotation of the object as a Quaternion.

property scale: Vec3

The scale of the object as a Vec3.

set_uniform(name: str, value: UniformValueType) None

Sets the value of a uniform for the Shader s in the object’s Material.

class Loxoc.core.Shader(source: str, shader_type: ShaderType)

Used to import shader files (glsl) that can be used in Material s.

classmethod from_file(filepath: str, type: ShaderType) Shader
class Loxoc.core.Vec4(x: float, y: float, z: float, w: float)

A 4 float datastructure used to represent positional data, colors, or whatever you may need it for. Contains useful linear algebra operators and functions.

__copy__() Quaternion

Copies the Vec4 .

__repr__() str

Returns a string representation of the Vec4 .

__neg__() Vec4

Negates the Vec4 .

property x: float

The x component Vec4 .

property y: float

The y component Vec4 .

property z: float

The z component Vec4 .

property w: float

The w component Vec4 .

__add__(other: Vec4 | float) Vec4

Adds the Vec4 .

__sub__(other: Vec4 | float) Vec4

Subtracts the Vec4 .

__mul__(other: Vec4 | float | Quaternion) Vec4

Multiplies the Vec4 .

__truediv__(other: Vec4 | float) Vec4

Divides the two Vec4 s.

dot(other: Vec4) float

Returns the dot product of the two Vec4 s.

get_magnitude() float

Returns the magnitude of the Vec4 .

get_normalized() Vec4

Returns the normalized Vec4 .

to_vec3() Vec3

Converts the Vec4 to a Vec3 using its x, y and z components.

to_vec2() Vec2

Converts the Vec4 to a Vec2 using its x and y components.

outer_product(vec: Vec2 | Vec3 | Vec4) Matrix2x4 | Matrix3x4 | Matrix4x4

Calculates the outer product.

distance(other: Vec4) float

The distance between two vectors as a float .

class Loxoc.core.Vec3(x: float, y: float, z: float)

A 3 float datastructure used to represent positional data, colors, or whatever you may need it for. Contains useful linear algebra operators and functions.

__repr__() str

Vec3 str representation.

property quaternion: Quaternion

Get the Quaternion form of the vector. Can also be assigned to, but not mutated.

property x: float
property y: float
property z: float
property up: Vec3

The up directional vector from the Euler representation of the Vec3 .

property right: Vec3

The right directional vector from the Euler representation of the Vec3 .

property forward: Vec3

The forward directional vector from the Euler representation of the Vec3 .

__neg__() Vec3

Negate a vector.

__add__(other: Vec3 | float) Vec3

Add 2 vectors.

__sub__(other: Vec3 | float) Vec3

Subtract 2 vectors.

__mul__(other: Vec3 | float | Quaternion) Vec3

Multiply 2 vectors.

__truediv__(other: Vec3 | float) Vec3

divide 2 vectors.

dot(other: Vec3) float

Performs a dot product operation between two Vec3 s.

cross(other: Quaternion | Vec3) Vec3

Performs a cross product operation between two Vec3 s.

get_magnitude() float

Returns the magnitude of the vector.

get_normalized() Vec3

Returns the normalized vector.

to_quaternion() Quaternion

Constructs a Quaternion from the given Euler Angle Vec3 (in radians).

outer_product(vec: Vec2 | Vec3 | Vec4) Matrix2x3 | Matrix3x3 | Matrix4x3

Calculates the outer product.

distance(other: Vec3) float

The distance between two vectors as a float .

class Loxoc.core.Vec2(x: float, y: float)

A 2 float datastructure used to represent positional data, 2D rotation, or whatever you may need it for. Contains useful linear algebra operators and functions.

__repr__() str

Vec2 str representation.

__neg__() Vec2
__copy__() Vec2
property angle: float

The vector converted to an angle in radians.

to_angle() float

Convert the vector to an angle in radians

property x: float
property y: float
__add__(other: Vec2 | float) Vec2
__sub__(other: Vec2 | float) Vec2
__mul__(other: Vec2 | float) Vec2
__truediv__(other: Vec2 | float) Vec2
dot(other: Vec2) float

Calculate the dot product of 2 Vec2 s.

get_magnitude() float

Calculate the Vec2 ‘s magnitude.

get_normalized() Vec2

Calculate the normalized Vec2 of the Vec2 .

classmethod from_angle(angle: float) Vec2

Construct a normalized Vec2 given an angle.

outer_product(vec: Vec2 | Vec3 | Vec4) Matrix2x2 | Matrix3x2 | Matrix4x2

Calculates the outer product.

distance(other: Vec2) float

The distance between two vectors as a float .

class Loxoc.core.Window(title: str, cam: Camera, width: int, height: int, fullscreen: bool = False, ambient_light: Vec3 = Vec3(1.0, 1.0, 1.0))

An application window for a game. This class also keeps track of the state of the game engine runtime (ie. what to and not to render along with events and time).

ambient_light: Vec3

The ambient or “base” level of light before any lights are added

property fullscreen: bool

Wether to render the window in fullscreen mode (True) or not (False).

property resizeable: bool

This flag determines wether or not the window is resizeable. The default value is True.

property sky_box: SkyBox

The Skybox .

property event: Event

This is the most recent event that the window recieved durring Window.update() .

property deltatime: float

The current deltatime for the window.

property dt: float

The current deltatime for the window.

property time_ns: int

Time since the launch of the window in nanoseconds.

property time: int

Time since the launch of the window in seconds.

update() None

Re-renders and refreshes the Window.event on the application Window . Should be used in a render/gameloop like so:

window = Window(...)

while ...:

    # render/gameloop code...

    window.update()

Whenever Window.update() is called, a new frame is drawn to the Window . If the program ends, the window will be closed.

lock_mouse(lock: bool) None

Locks the mouse in the center of the window.

add_object(obj: Object3D) None

Adds the Object3D to the scene. This ensures that the Object3D is rendered by the camera.

remove_object(obj: Object3D) None

Removes the Object3D from the scene. Only Object3D s which are in the scene will be rendered by the camera.

add_object_list(objs: list[Object3D]) None

Adds multiple Object3D s to the scene. This ensures that they are rendered by the camera.

remove_object_list(objs: list[Object3D]) None

Removes multiple Object3D s from the scene. Only Object3D s which are in the scene will be rendered by the camera.

add_object2d(obj: Object2D) None

Adds the Object2D to the scene. This ensures that the Object2D is rendered by the camera.

remove_object2d(obj: Object2D) None

Removes the Object2D from the scene. Only Object2D s which are in the scene will be rendered by the camera.

add_object2d_list(objs: list[Object2D]) None

Adds multiple Object2D s to the scene. This ensures that they are rendered by the camera.

remove_object2d_list(objs: list[Object2D]) None

Removes multiple Object2D s from the scene. Only Object2D s which are in the scene will be rendered by the camera.

add_point_light(obj: PointLight) None

Adds the PointLight to the scene. This ensures that the PointLight is rendered by the camera.

remove_point_light(obj: PointLight) None

Removes the PointLight from the scene. Only PointLight s which are in the scene will be rendered by the camera.

add_point_light_list(objs: list[PointLight]) None

Adds multiple PointLight s to the scene. This ensures that they are rendered by the camera.

remove_point_light_list(objs: list[PointLight]) None

Removes multiple PointLight s from the scene. Only PointLight s which are in the scene will be rendered by the camera.

add_directional_light(obj: DirectionalLight) None

Adds the DirectionalLight to the scene. This ensures that the DirectionalLight is rendered by the camera.

remove_directional_light(obj: DirectionalLight) None

Removes the DirectionalLight from the scene. Only DirectionalLight s which are in the scene will be rendered by the camera.

add_directional_light_list(objs: list[DirectionalLight]) None

Adds multiple DirectionalLight s to the scene. This ensures that they are rendered by the camera.

remove_directional_light_list(objs: list[DirectionalLight]) None

Removes multiple DirectionalLight s from the scene. Only DirectionalLight s which are in the scene will be rendered by the camera.

add_spot_light(obj: SpotLight) None

Adds the SpotLight to the scene. This ensures that the SpotLight is rendered by the camera.

remove_spot_light(obj: SpotLight) None

Removes the SpotLight from the scene. Only SpotLight s which are in the scene will be rendered by the camera.

add_spot_light_list(objs: list[SpotLight]) None

Adds multiple SpotLight s to the scene. This ensures that they are rendered by the camera.

remove_spot_light_list(objs: list[SpotLight]) None

Removes multiple SpotLight s from the scene. Only SpotLight s which are in the scene will be rendered by the camera.

add_text(obj: Text) None

Adds the Text to the scene. This ensures that the Text is rendered by the camera.

remove_text(obj: Text) None

Removes the Text from the scene. Only Text s which are in the scene will be rendered by the camera.

add_text_list(objs: list[Text]) None

Adds multiple Text s to the scene. This ensures that they are rendered by the camera.

remove_text_list(objs: list[Text]) None

Removes multiple Text s from the scene. Only Text s which are in the scene will be rendered by the camera.

add_emitter(obj: Emitter) None

Adds the Emitter to the scene. This ensures that the Emitter is rendered by the camera.

remove_emitter(obj: Emitter) None

Removes the Emitter from the scene. Only Emitter s which are in the scene will be rendered by the camera.

add_emitter_list(objs: list[Emitter]) None

Adds multiple Emitter s to the scene. This ensures that they are rendered by the camera.

remove_emitter_list(objs: list[Emitter]) None

Removes multiple Emitter s from the scene. Only Emitter s which are in the scene will be rendered by the camera.

class Loxoc.core.EVENT_FLAG(*args, **kwds)

Bases: enum.Enum

An IO or engine event flag.

WINDOW_MINIMIZE: EVENT_FLAG

Flagged when the window minimize button is clicked.

WINDOW_CLOSE: EVENT_FLAG

Flagged when the window close button is clicked.

QUIT: EVENT_FLAG

Flagged when the window close button is clicked.

KEY_UP: EVENT_FLAG
KEY_DOWN: EVENT_FLAG
KEY_RIGHT: EVENT_FLAG
KEY_LEFT: EVENT_FLAG
KEY_SPACE: EVENT_FLAG
KEY_a: EVENT_FLAG
KEY_b: EVENT_FLAG
KEY_c: EVENT_FLAG
KEY_d: EVENT_FLAG
KEY_e: EVENT_FLAG
KEY_f: EVENT_FLAG
KEY_g: EVENT_FLAG
KEY_h: EVENT_FLAG
KEY_i: EVENT_FLAG
KEY_j: EVENT_FLAG
KEY_k: EVENT_FLAG
KEY_l: EVENT_FLAG
KEY_m: EVENT_FLAG
KEY_n: EVENT_FLAG
KEY_o: EVENT_FLAG
KEY_p: EVENT_FLAG
KEY_q: EVENT_FLAG
KEY_r: EVENT_FLAG
KEY_s: EVENT_FLAG
KEY_t: EVENT_FLAG
KEY_u: EVENT_FLAG
KEY_v: EVENT_FLAG
KEY_w: EVENT_FLAG
KEY_x: EVENT_FLAG
KEY_y: EVENT_FLAG
KEY_z: EVENT_FLAG
KEY_LSHIFT: EVENT_FLAG
KEY_RSHIFT: EVENT_FLAG
KEY_LCTRL: EVENT_FLAG
KEY_LALT: EVENT_FLAG
KEY_ESCAPE: EVENT_FLAG
KEY_COMMA: EVENT_FLAG
KEY_PERIOD: EVENT_FLAG
KEY_FORWARDSLASH: EVENT_FLAG
KEY_BACKSLASH: EVENT_FLAG
KEY_OPEN_BRACKET: EVENT_FLAG
KEY_CLOSE_BRACKET: EVENT_FLAG
KEY_SEMICOLON: EVENT_FLAG
KEY_QUOTE: EVENT_FLAG
KEY_ENTER: EVENT_FLAG
KEY_BACKSPACE: EVENT_FLAG
KEY_TAB: EVENT_FLAG
KEY_BACKTICK: EVENT_FLAG
KEY_DASH: EVENT_FLAG
KEY_EQUALS: EVENT_FLAG
KEY_1: EVENT_FLAG
KEY_2: EVENT_FLAG
KEY_3: EVENT_FLAG
KEY_4: EVENT_FLAG
KEY_5: EVENT_FLAG
KEY_6: EVENT_FLAG
KEY_7: EVENT_FLAG
KEY_8: EVENT_FLAG
KEY_9: EVENT_FLAG
KEY_0: EVENT_FLAG
KEY_RCTRL: EVENT_FLAG
KEY_RALT: EVENT_FLAG
MOUSE_BUTTON_DOWN: EVENT_FLAG
MOUSE_BUTTON_UP: EVENT_FLAG
MOUSE_WHEEL: EVENT_FLAG
MOUSE_MOTION: EVENT_FLAG
WINDOW_RESIZE: EVENT_FLAG
class Loxoc.core.EVENT_STATE(*args, **kwds)

Bases: enum.Enum

The state of an IO or engine event flag.

NONE: EVENT_STATE
PRESSED: EVENT_STATE
RELEASED: EVENT_STATE
class Loxoc.core.MOUSE_EVENT_TYPE(*args, **kwds)

Bases: enum.Enum

The type of a mouse event.

BUTTON_DOWN: MOUSE_EVENT_TYPE
BUTTON_UP: MOUSE_EVENT_TYPE
NONE: MOUSE_EVENT_TYPE
class Loxoc.core.MOUSE_BUTTON(*args, **kwds)

Bases: enum.Enum

The button of a mouse event.

LEFT: MOUSE_BUTTON
RIGHT: MOUSE_BUTTON
MIDDLE: MOUSE_BUTTON
class Loxoc.core.MOUSE_WHEEL_DIRECTION(*args, **kwds)

Bases: enum.Enum

The wheel direction of a mouse wheel event.

FLIPPED: MOUSE_WHEEL_DIRECTION
NORMAL: MOUSE_WHEEL_DIRECTION
class Loxoc.core.MouseWheel

The mousewheel data for a mouse wheel event.

int_x: int

The x value of the mouse wheel with integer precision.

int_y: int

The y value of the mouse wheel with integer precision.

x: float

The x value of the mouse wheel with full floating point precision.

y: float

The y value of the mouse wheel with full floating point precision.

direction: MOUSE_WHEEL_DIRECTION

The direction of the mouse wheel.

class Loxoc.core.MouseDevice

The data for a mouse device populated durring a mouse event.

id: int

The id of the mouse device.

timestamp: int

The timestamp of the mouse event.

x: int

The x position of the mouse in relation to the window.

y: int

The y position of the mouse in relation to the window.

rel_x: int

The x position of the mouse relative to its last position. Also can be thought of as the mouse x delta.

rel_y: int

The y position of the mouse relative to its last position. Also can be thought of as the mouse y delta.

clicks: int

The ammount of clicks recorded.

type: MOUSE_EVENT_TYPE

The type of mouse event.

state: EVENT_STATE

The state of the mouse event.

button: MOUSE_BUTTON

The button pressed durring the mouse event.

wheel: MouseWheel

The mouse wheel data for mouse wheel events.

class Loxoc.core.Event

This non-constructable class contains all information pertaining to Window events. This class can be accessed/read via Window .event .

To check if an EVENT_FLAG has been triggered you can use Window .event.check_flag(...):

window = Window(...)

while not window.event.check_flag(EVENT_FLAG.QUIT):

    # some game loop code...

    window.update()

This can be useful for events where you only need to chjeck if they have been triggered. Such as quitting the game when you close the window.

To check the EVENT_STATE of an EVENT_FLAG you can use Window .event.get_flag(...):

window = Window(...)

while not window.event.check_flag(EVENT_FLAG.QUIT):

    if window.event.get_flag(EVENT_FLAG.KEY_UP) == EVENT_STATE.PRESSED:
        # do some stuff when up is pressed...

    window.update()

This can be useful for getting the EVENT_STATE of specific EVENT_FLAG s. It is recommended to do this before attempting to access data from the Event that is related to the EVENT_FLAG and its EVENT_STATE .

get_flag(_event: EVENT_FLAG) EVENT_STATE

Checks if the provided event flag is occuring.

check_flag(_event: EVENT_FLAG) bool

Checks if the provided event flag is occuring.

property mouse: MouseDevice

Gets the current mouse device. Contains current mouse events.

get_mouse(id: int) MouseDevice

Gets the mouse device with the provided id. Contains current mouse events.

class Loxoc.core.Quaternion(w: float, x: float, y: float, z: float)

A “4 dimensional” rotation arround a developer defined Vec3 axis.

In simple terms, a Quaternion is just an angle (in radians) rotation arround some 3D vector. For example if we wanted to rotate arround the Euler y axis of an Object3D or along “yaw” we would just rotate arroud the Object3D .rotation.up vector:

obj = Object3D(...)

yaw_rotation = math.radians(90)

quat = Quaternion.from_axis_angle(obj.rotation.up, yaw_rotation)

It is recommended to construct Quaternions with Quaternion.from_axis_angle().

Read more about Quaternions here.

__repr__() str

The string representation of the Quaternion.

__neg__() Quaternion
property w: float
property x: float
property y: float
property z: float
property up: Vec3

The up directional vector.

property right: Vec3

The right directional vector.

property forward: Vec3

The forward directional vector.

property euler_angles: Vec3

The Euler Angle Vec3 form of the Quaternion. Can also be assigned to, but not mutated.

Use Quaternion.rotate_pitch(), Quaternion.rotate_yaw(), and Quaternion.rotate_roll() for mutating Euler angle rotation.

property euler_pitch: float

Rotation about the x axis.

rotate_pitch(value: float) Quaternion

Rotates the Euler pitch (x) axis by the provided value.

property euler_yaw: float

Rotation about the y axis.

rotate_yaw(value: float) Quaternion

Rotates the Euler yaw (y) axis by the provided value.

property euler_roll: float

Rotation about the z axis.

rotate_roll(value: float) Quaternion

Rotates the Euler roll (z) axis by the provided value.

__add__(other: Quaternion | float) Quaternion
__sub__(other: Quaternion | float) Quaternion
__mul__(other: Quaternion | float | Vec3) Quaternion | Vec3
__truediv__(other: Quaternion | float) Quaternion
dot(other: Quaternion) float

The dot product of 2 Quaternion s.

cross(other: Quaternion | Vec3) float

The cross product of the Quaternion and another compatible structure.

get_magnitude() float

Returns the magnitude of the Quaternion .

get_normalized() Quaternion

Returns the normalized Quaternion .

to_euler() Vec3

Converts the Quaternion to a Euler Angle Vec3 (in radians).

get_conjugate() Quaternion

The conjugate of the Quaternion .

get_inverse() Quaternion

The inverse of the Quaternion .

get_reverse() Quaternion

The 180 degree reverse of the Quaternion .

static from_euler(euler_vec: Vec3) Quaternion

Converts the provided Euler Angle Vec3 (in radians) to a Quaternion .

static from_axis_angle(axis: Vec3, angle: float) Quaternion

Constructs a Quaternion with a rotation of angle arround axis.

Parameters:
  • axis (Vec3) – A Euler Angle Vec3 (in radians).

  • angle (float) – An angle in radians of which to rotate arround the axis.

rotate(axis: Vec3, angle: float) None

Mutably rotates the Quaternion by angle arround axis.

Parameters:
  • axis (Vec3) – A Euler Angle Vec3 (in radians).

  • angle (float) – An angle in radians of which to rotate arround the axis.

static from_quat(quat: Quaternion) Quaternion

Used to construct a copy of a Quaternion .

static from_unit(axis: Vec3, up: Vec3 | None = Vec3(0.0, 1.0, 0.0)) Quaternion

Takes in a unit Vec3 direction and returns a Quaternion rotated in that direction from the global forward Vec3(0.0, 0.0, 1.0) .

lerp(other: Quaternion, ratio: float) Quaternion

Returns a lerped Quaternion between two Quaternion by the provided ratio.

slerp(other: Quaternion, ratio: float) Quaternion

Returns a slerped Quaternion between two Quaternion by the provided ratio.

class Loxoc.core.TextureFiltering(*args, **kwds)

Bases: enum.Enum

The texture filtering setting for a Texture .

NEAREST: TextureFiltering
LINEAR: TextureFiltering
class Loxoc.core.TextureWraping(*args, **kwds)

Bases: enum.Enum

The texture wrapping setting for a Texture .

REPEAT: TextureWraping
MIRRORED_REPEAT: TextureWraping
CLAMP_TO_EDGE: TextureWraping
CLAMP_TO_BORDER: TextureWraping
class Loxoc.core.Texture

A texture for a Mesh or Sprite .

classmethod from_file(file_path: str, wrap: TextureWraping = TextureWraping.REPEAT, filtering: TextureFiltering = TextureFiltering.LINEAR) Texture

Create a Texture from the specified file.

class Loxoc.core.Sprite(file_path: str)

The image asset which is used when rendering an Object2D . Serves a purpose similar to how Mesh is used with Object3D but for Object2D .

texture: Texture

The Texture that is drawn when the Sprite is rendered.

classmethod from_texture(tex: Texture) Sprite

Creates a sprite of the supplied texture.

class Loxoc.core.Object2D(sprite: Sprite, camera: Camera, position: Vec2 = Vec2(0.0, 0.0), depth: float = 0.0, rotation: float = 0.0, scale: Vec2 = Vec2(1.0, 1.0), material: Material = None)

An 2 Dimensional Object which is rendered infront of all Object3D s on the screen. Good for GUI, HUD interfaces, or anything else 2D.

property material: Material

The Material to render the Sprite with when the Object2D is rendered.

property sprite: Sprite

The Sprite to be displayed when the Object2D is rendered.

property position: Vec2

The position of the Object2D on the screen as a Vec2.

property depth: float

The depth layer of the Sprite when rendered, or “z” position. Object2D s with a higher depth are rendered underneath Object2D s with a lower depth.

property rotation: float

The rotation of the Object2D on the screen as a Vec2.

property scale: Vec2

The scale of the Object2D on the screen as a Vec2.

property untransformed_dimensions: Vec2

The screen/camera coordinate dimensions of the Sprite before scale is applied.

property dimensions: Vec2

The true screen/camera coordinate dimensions of the Sprite .

property width: float

The true screen/camera coordinate height of the Sprite .

property height: float

The true screen/camera coordinate height of the Sprite .

set_uniform(name: str, value: UniformValueType) None

Sets the value of a uniform for the shaders in the Object2D ‘s Material.

class Loxoc.core.PointLight(position: Vec3, radius: float, color: Vec3, intensity: float)

A Object that emits light from a Vec3 point in 3D space.

property position: Vec3

The Vec3 position of the light.

property color: Vec3

The Vec3 color of the light in rgb.

property intensity: float

The intensity of the light.

property radius: float

The radius of the light

class Loxoc.core.DirectionalLight(rotation: Vec3 = None, color: Vec3 = None, ambient: Vec3 = None, diffuse: Vec3 = None, specular: Vec3 = None, intensity: float = 1.0)
property rotation: Quaternion

The Quaternion rotation of the DirectionalLight

property ambient: Vec3

The Vec3 ambient property of the DirectionalLight

property diffuse: Vec3

The Vec3 diffuse property of the DirectionalLight

property specular: Vec3

The Vec3 specular property of the DirectionalLight

property intensity: float

The intensity property of the DirectionalLight

property color: Vec3

The Vec3 color property of the DirectionalLight

class Loxoc.core.SpotLight(position: Vec3, rotation: Vec3 = None, color: Vec3 = None, cutoff: float = 12.5, outer_cutoff: float = 17.5, intensity: float = 1.0, reach: float = 100.0, cookie: Texture = None)
property position: Vec3

The Vec3 position of the light.

property rotation: Quaternion

The direction of the spotlight as a Quaternion .

property cookie: Texture

The Texture of the light cookie the spotlight will cast if provided.

property color: Vec3

The Vec3 color of the light.

property intensity: float

The intensity of the light.

property cutoff: float

the cutoff of the light cookie as an angle from the center.

property outer_cutoff: float

the cutoff of the light cookie smoothing as an angle from the center.

property reach: float

The distance the light is able to travel.

class Loxoc.core.Collider

The Collider base class.

check_collision(intersection: Vec3 | Collider | Object3D) bool

Checks for a collision between this Collider and another Collider , Object3D or Vec3 .

property offset: Vec3

The Vec3 offset of the collider.

property rotation: Quaternion

The Quaternion rotation of the collider.

property scale: Vec3

The Vec3 scale of the collider.

property show
Makes the collider visible.  Good for debugging purposes.
dbg_render(cam: Camera) None

Call this function when you wish to show a collider’s collision mesh despite the collider not having an owner. (This api is temporary until future game engine systems are implemented.)

class Loxoc.core.BoxCollider(object: Object3D, offset: Vec3 = Vec3(0, 0, 0), rotation: Vec3 | Quaternion = Vec3(0, 0, 0), scale: Vec3 = Vec3(1.0, 1.0, 1.0))

Bases: Collider

An Oriented Box Collider.

classmethod from_bounds(upper_bound: Vec3 = Vec3(10, 10, 10), lower_bound: Vec3 = Vec3(-10, -10, -10), offset: Vec3 = Vec3(0, 0, 0), rotation: Vec3 | Quaternion = Vec3(0, 0, 0), scale: Vec3 = Vec3(1.0, 1.0, 1.0)) BoxCollider

Constructs an BoxCollider from the provided bounds.

class Loxoc.core.ConvexCollider(object: Object3D, offset: Vec3 = Vec3(0, 0, 0), rotation: Vec3 | Quaternion = Vec3(0, 0, 0), scale: Vec3 = Vec3(1.0, 1.0, 1.0))

Bases: Collider

A convex hull collider.

classmethod from_mesh(msh: Mesh, offset: Vec3 = Vec3(0, 0, 0), rotation: Vec3 | Quaternion = Vec3(0, 0, 0), scale: Vec3 = Vec3(1.0, 1.0, 1.0)) BoxCollider

Creates a ConvexCollider from the provided Mesh .

classmethod from_mesh_dict(msh_dict: MeshDict, offset: Vec3 = Vec3(0, 0, 0), rotation: Vec3 | Quaternion = Vec3(0, 0, 0), scale: Vec3 = Vec3(1.0, 1.0, 1.0)) BoxCollider

Creates a ConvexCollider from the provided MeshDict .

class Loxoc.core.RayCollider(origin: Vec3, direction: Quaternion)

Bases: Collider

A raycast collider that takes in an Vec3 origin and Quaternion direction.

get_collision(intersection: Collider | Object3D) RayHit

Checks for a collision on the RayCollider . Upon colliding this function returns an instance of RayHit .

property rotation: Quaternion

The Quaternion direction of the RayCollider .

property direction: Quaternion

The Quaternion direction of the RayCollider .

property offset: Vec3

The Vec3 origin of the RayCollider .

property origin: Vec3

The Vec3 origin of the RayCollider .

class Loxoc.core.RayHit

Returned by RayCollider.get_collision . This class contains information about the RayCollider collision.

property hit: bool

True if the RayCollider has hit its target, False if not.

property has_normal: bool

Wether the RayHit ‘s collided surface has a normal.

property has_distance: bool

Wether the RayHit has recorded the distance between the collision point and its origin.

property position: Vec3

The Vec3 position of the RayHit .

property normal: Vec3

The Vec3 normal of the surface the RayCollider has collided with.

property distance: float

The distance between the Vec3 origin and the Vec3 position of the RayHit .

class Loxoc.core.Matrix4x4(x0: float, y0: float, z0: float, w0: float, x1: float, y1: float, z1: float, w1: float, x2: float, y2: float, z2: float, w2: float, x3: float, y3: float, z3: float, w3: float)

A 4 by 4 matrix.

static from_identity(value: float) Matrix4x4

Creates a identity matrix with value.

static from_ortho(left: float, right: float, bottom: float, top: float, zNear: float | None = None, zFar: float | None = None) Matrix4x4

Creates an orthographic projection Matrix4x4 with the specified bounds.

static look_at(eye: Vec3, center: Vec3, up: Vec3) Matrix4x4

Creates a look at Matrix4x4 from the specified parameters.

static from_perspective(fovy: float, aspect: float, near: float, far: float) Matrix4x4

Creates a perspective projection Matrix4x4 with the specified bounds.

static from_quaternion(quat: Quaternion) Matrix4x4

Converts a Quaternion into a Matrix4x4 .

to_quaternion() Quaternion

Converts the Matrix4x4 into a Quaternion .

get_up() Vec3

Returns the up Vec3 of the Matrix4x4 , assuming that it is being used as a transform.

get_right() Vec3

Returns the right Vec3 of the Matrix4x4 , assuming that it is being used as a transform.

get_forward() Vec3

Returns the forward Vec3 of the Matrix4x4 , assuming that it is being used as a transform.

inverse() Matrix4x4

Returns the inverse of the Matrix4x4 .

transpose() Matrix4x4

Transposes the matrix.

determinant() float

Returns the determinant of the Matrix4x4 .

__getitem__(index: int) Vec4

Returns index th column of the Matrix4x4 as a Vec4 .

__neg__() Matrix4x4

Negates the Matrix4x4 .

__sub__(other: Matrix4x4 | float) Matrix4x4

Subtracts the Matrix4x4 .

__add__(other: Matrix4x4 | float) Matrix4x4

Adds the Matrix4x4 .

__mul__(other: Matrix4x4 | Vec4 | float) Matrix4x4 | Vec4

Multiplies the Matrix4x4 .

__truediv__(other: Matrix4x4 | float) Matrix4x4

Divides the Matrix4x4 .

class Loxoc.core.Matrix3x4(x0: float, y0, z0: float, w0: float, x1: float, y1: float, z1: float, w1: float, x2: float, y2: float, z2: float, w2: float)

A 3 by 4 matrix.

static from_identity(value: float) Matrix3x4

Creates a identity matrix with value.

__getitem__(index: int) Vec4

Returns index th column of the Matrix3x4 as a Vec4 .

__neg__() Matrix3x4

Negates the Matrix3x4 .

__sub__(other: Matrix3x4 | float) Matrix3x4

Subtracts the Matrix3x4 .

__add__(other: Matrix3x4 | float) Matrix3x4

Adds the Matrix3x4 .

__mul__(other: float | Vec4) Matrix3x4 | Vec4

Multiplies the Matrix3x4 .

__truediv__(other: float) Matrix3x4

Divides the Matrix3x4 by a scalar .

transpose() Matrix4x3

Transposes the matrix.

class Loxoc.core.Matrix2x4(x0: float, y0: float, z0: float, w0: float, x1: float, y1: float, z1: float, w1: float)

A 2 by 4 matrix.

static from_identity(value: float) Matrix2x4

Creates a identity matrix with value.

__getitem__(index: int) Vec4

Returns index th column of the Matrix2x4 as a Vec4 .

__neg__() Matrix2x4

Negates the Matrix2x4 .

__sub__(other: Matrix2x4 | float) Matrix2x4

Subtracts the Matrix2x4 .

__add__(other: Matrix2x4 | float) Matrix2x4

Adds the Matrix2x4 .

__mul__(other: float | Vec4) Matrix2x4 | Vec4

Multiplies the Matrix2x4 .

__truediv__(other: float) Matrix2x4

Divides the Matrix2x4 by a scalar .

transpose() Matrix4x2

Transposes the matrix.

class Loxoc.core.Matrix3x3(x0: float, y0: float, z0: float, x1: float, y1: float, z1: float, x2: float, y2: float, z2: float)

A 3 by 3 matrix.

static from_identity(value: float) Matrix3x3

Creates a identity matrix with value.

to_quaternion() Quaternion

Converts the Matrix3x3 to a Quaternion.

get_up() Vec3

Gets the up Vec3 of the Matrix3x3 as a transform matrix.

get_right() Vec3

Gets the right Vec3 of the Matrix3x3 as a transform matrix.

get_forward() Vec3

Gets the forward Vec3 of the Matrix3x3 as a transform matrix.

inverse() Matrix3x3

Inverses the Matrix3x3 .

determinant() float

Returns the determinant of the Matrix3x3 .

__getitem__(index: int) Vec3

Returns index th column of the Matrix3x3 as a Vec3 .

__neg__() Matrix3x3

Negates the Matrix3x3 .

__sub__(other: Matrix3x3 | float) Matrix3x3

Subtracts the Matrix3x3 .

__add__(other: Matrix3x3 | float) Matrix3x3

Adds the Matrix3x3 .

__mul__(other: Matrix3x3 | float | Vec3) Matrix3x3 | Vec3

Multiplies the Matrix3x3 .

__truediv__(other: Matrix3x3 | float) Matrix3x3

Divides the Matrix3x3 .

transpose() Matrix3x3

Transposes the matrix.

class Loxoc.core.Matrix4x3(x0: float, y0: float, z0: float, x1: float, y1: float, z1: float, x2: float, y2: float, z2: float, x3: float, y3: float, z3: float)

A 4 by 3 matrix.

static from_identity(value: float) Matrix4x3

Creates a identity matrix with value.

__getitem__(index: int) Vec3

Returns index th column of the Matrix4x3 as a Vec3 .

__neg__() Matrix4x3

Negates the Matrix4x3 .

__sub__(other: Matrix4x3 | float) Matrix4x3

Subtracts the Matrix4x3 .

__add__(other: Matrix4x3 | float) Matrix4x3

Adds the Matrix4x3 .

__mul__(other: float | Vec4) Matrix4x3 | Vec3

Multiplies the Matrix4x3 .

__truediv__(other: float) Matrix4x3

Divides the Matrix4x3 by a scalar.

transpose() Matrix3x4

Transposes the matrix.

class Loxoc.core.Matrix2x3(x0: float, y0: float, z0: float, x1: float, y1: float, z1: float)

A 2 by 3 matrix.

static from_identity(value: float) Matrix2x3

Creates a identity matrix with value.

__getitem__(index: int) Vec3

Returns index th column of the Matrix4x3 as a Vec3 .

__neg__() Matrix2x3

Negates the Matrix2x3 .

__sub__(other: Matrix2x3 | float) Matrix2x3

Subtracts the Matrix2x3 .

__add__(other: Matrix2x3 | float) Matrix2x3

Adds the Matrix2x3 .

__mul__(other: float | Vec2 | Vec3) Matrix2x3 | Vec3

Multiplies the Matrix2x3 .

__truediv__(other: float) Matrix2x3

Divides the Matrix2x3 by a scalar.

transpose() Matrix3x2

Transposes the matrix.

class Loxoc.core.Matrix2x2(x0: float, y0: float, x1: float, y1: float)

A 2 by 2 matrix.

static from_identity(value: float) Matrix2x2

Creates a identity matrix with value.

inverse() Matrix2x2

Inverses the Matrix2x2 .

determinant() float

Returns the determinant of the Matrix2x2 .

__getitem__(index: int) Vec2

Returns index th column of the Matrix2x2 as a Vec2 .

__neg__() Matrix2x2

Negates the Matrix2x2 .

__sub__(other: Matrix2x2 | float) Matrix2x2

Subtracts the Matrix2x2 .

__add__(other: Matrix2x2 | float) Matrix2x2

Adds the Matrix2x2 .

__mul__(other: Matrix2x2 | float | Vec2) Matrix2x2 | Vec2

Multiplies the Matrix2x2 .

__truediv__(other: Matrix2x2 | float) Matrix2x2

Divides the Matrix2x2 .

transpose() Matrix2x2

Transposes the matrix.

class Loxoc.core.Matrix3x2(x0: float, y0: float, x1: float, y1: float, x2: float, y2: float)

A 3 by 2 matrix.

static from_identity(value: float) Matrix3x2

Creates a identity matrix with value.

__getitem__(index: int) Vec2

Returns index th column of the Matrix3x2 as a Vec2 .

__neg__() Matrix3x2

Negates the Matrix3x2 .

__sub__(other: Matrix3x2 | float) Matrix3x2

Subtracts the Matrix3x2.

__add__(other: Matrix3x2 | float) Matrix3x2

Adds the Matrix3x2 .

__mul__(other: float | Vec3) Matrix3x2 | Vec2

Multiplies the Matrix3x2 .

__truediv__(other: float) Matrix3x2

Divides the Matrix3x2 by a scalar.

transpose() Matrix2x3

Transposes the matrix.

class Loxoc.core.Matrix4x2(x0: float, y0: float, x1: float, y1: float, x2: float, y2: float, x3: float, y3: float)

A 4 by 2 matrix.

static from_identity(value: float) Matrix4x2

Creates a identity matrix with value.

__getitem__(index: int) Vec2

Returns index th column of the Matrix4x2 as a Vec2 .

__neg__() Matrix4x2

Negates the Matrix4x2 .

__sub__(other: Matrix4x2 | float) Matrix4x2

Subtracts the Matrix4x2 .

__add__(other: Matrix4x2 | float) Matrix4x2

Adds the Matrix4x2 .

__mul__(other: float | Vec4) Matrix4x2 | Vec2

Multiplies the Matrix4x2 .

__truediv__(other: float) Matrix4x2

Divides the Matrix4x2 by a scalar.

transpose() Matrix2x4

Transposes the matrix.

class Loxoc.core.Font(font_path: str, font_size: int = 48)

Renders the specified Font to the screen. Usable with Text .

class Loxoc.core.Text(text_string: str, color: Vec4, position: Vec2, scale: Vec2 = Vec2(1.0, 1.0), rotation: float = 0, font: Font | None = None, material: Material | None = None)

Renders the specified Text to the screen with the specified Font .

property rotation: float

The rotation of the text.

property position: Vec2

The Vec2 position of the text.

property scale: Vec2

The Vec2 scale of the text.

property color: Vec4

The Vec4 color of the text.

property material: Material

The Material of the text.

property font: Font

The Font of the text.

property text: str

The content of the text object.

class Loxoc.core.CubeMap(right_path: str, left_path: str, top_path: str, bottom_path: str, back_path: str, front_path: str)

A cubemap. Can be used to create a SkyBox .

class Loxoc.core.SkyBox(cube_map: CubeMap, mat: Material | None = None)

A CubeMap skybox. Can be applied to Window.sky_box .

property material: Material

The Material used to render the SkyBox .

property cubemap: CubeMap

The CubeMap used in rendering the SkyBox .

class Loxoc.core.Emitter(position: Vec3, direction: Quaternion, scale_min: Vec2 = Vec2(1.0, 1.0), scale_max: Vec2 = Vec2(1.0, 1.0), rate: int = 50, decay_rate: float = 1.0, spread: float = math.radians(30), velocity_decay: float = 1.0, start_velocity_min: float = 1.0, start_velocity_max: float = 1.0, start_lifetime_min: float = 10.0, start_lifetime_max: float = 10.0, color_min: Vec4 = Vec4(1.0, 1.0, 1.0, 1.0), color_max: Vec4 = Vec4(1.0, 1.0, 1.0, 1.0), material: Material | None = None)

Emits particles.

start() None

Starts emitting particles.

stop() None

Stops emitting particles.

property material: Material

The Material for the particle.

property position: Vec3

The Vec3 position of the emitter.

property direction: Quaternion

The Quaternion direction of the emitter.

property color_min: Vec4

The Vec4 minimum color of the particles. The color of the particle will be randomly selected between Emitter.color_min and Emitter.color_max .

property color_max: Vec4

The Vec4 maximum color of the particles. The color of the particle will be randomly selected between Emitter.color_min and Emitter.color_max .

property scale_min: Vec2

The Vec2 minimum scale of the particles. The scale of the particle will be randomly selected between Emitter.scale_min and Emitter.scale_max .

property scale_max: Vec2

The Vec2 maximum scale of the particles. The scale of the particle will be randomly selected between Emitter.scale_min and Emitter.scale_max .

property rate: int

The ammount of particles present at any one time.

property decay_rate: float

The speed of decay, or how much a particle’s life decreases each second. When a particle’s life reaches 0, it disappears.

property spread: float

The radius of the cone of particle spread.

property velocity_decay: float

The ammount a particle’s velocity decreases over time.

property start_velocity_min: float

The minimum starting velocity of a particle. The start velocity of a particle will be randomly selected between Emitter.start_velocity_min and Emitter.start_velocity_max .

property start_velocity_max: float

The maximum starting velocity of a particle. The start velocity of a particle will be randomly selected between Emitter.start_velocity_min and Emitter.start_velocity_max .

property start_lifetime_min: float

The minimum starting life value of a particle. The start life value of a particle will be randomly selected between Emitter.start_lifetime_min and Emitter.start_lifetime_max .

property start_lifetime_max: float

The maximum starting life value of a particle. The start life value of a particle will be randomly selected between Emitter.start_lifetime_min and Emitter.start_lifetime_max .

class Loxoc.core.Sound(win: Window, source: str, loop: bool)

A sound asset. This can also be used to play sounds directly.

play(volume: float = 1.0, panning: float = 0.0, pitch: float = 1.0, position: Vec3 | None = None) None

Plays the sound globally. If a Vec3 position is specified, the panning and volume will be balanced to play from that position relative to the camera. It will play with the same panning and volume until the sound is finished. For dynamic positional audio see Sound3D .

stop() None

Stops the sound if it is playing.