rayquiro.engine
rayquiro.engine is a powerful 3D/2D game-style native engine module built on top of the Raylib library. It provides high-performance rendering pipelines, entities, resource management, directional/ambient lighting, post-processing filters, input polling, and scene persistence workflows.
π Installationβ
Install globally on your machine:
rqio install rayquiro.engine
Or install locally in your project folder:
rqio install rayquiro.engine --local
π Importβ
import rayquiro.engine as engine;
(The alias raytolfas.engine is also accepted for backwards compatibility).
π οΈ Data Types & Conversionsβ
When passing data to rayquiro.engine APIs:
- Vectors (3D): Passed as a 3-element numeric array
[x, y, z]. E.g.,[6.0, 4.0, 8.0]. - Vectors (2D): Passed as a 2-element numeric array
[x, y]. E.g.,[1280.0, 720.0]. - Colors: Passed as a 4-element RGBA numeric array
[r, g, b, a](each element0-255). E.g.,[255, 236, 206, 255].
π₯οΈ Window & Backend APIβ
engine.backend(name)β
Configures the graphics API.
name(string) β The backend engine name (e.g."raylib"or"vulkan").
engine.backend_name()β
- Returns:
stringβ The active backend name.
engine.backend_info()β
- Returns:
tableβ A dictionary containing vendor, hardware, API version, and feature details.
engine.init(width, height, title) or engine.window(width, height, title)β
Creates the graphics window and initializes the rendering context.
width(number) β Window width.height(number) β Window height.title(string) β Display title.
engine.shutdown()β
Closes the engine window, unloads all cached assets, and cleans up memory.
engine.should_close()β
- Returns:
booleanβtrueif the window close button orESCwas pressed.
engine.vsync(enabled)β
enabled(boolean) β Enable or disable Vertical Synchronization.
engine.msaa(samples)β
samples(number) β Set multisample anti-aliasing sample count (e.g.,0,2,4,8).
engine.target_fps(fps)β
fps(number) β Sets the target frame rate (e.g.60,144).
engine.frame_time()β
- Returns:
numberβ Time elapsed during the previous frame in seconds.
ποΈ Frame Lifecycleβ
engine.begin() or engine.frame_begin()β
Clears the active frame buffer and begins recording render commands for the current frame.
engine.clear(color)β
Clears the active buffer with a background color.
color(RGBA array) β E.g.,[10, 15, 24, 255].
engine.end() or engine.frame_end()β
Finalizes rendering commands, resolves shaders, applies postfx filters, and displays the frame.
πΈ Camera APIβ
engine.camera(position, target, up, fov) or engine.set_camera(position, target, up, fov)β
Configures the default 3D rendering perspective camera.
position(3D vector) β Camera coordinates[x, y, z].target(3D vector) β Point the camera looks at[x, y, z].up(3D vector) β Up direction vector[x, y, z](usually[0, 1, 0]).fov(number) β Field of view angle (typically60).
engine.camera_orbit(yaw, pitch, distance)β
Orbits the perspective camera around the target point.
yaw(number) β Rotation angle.pitch(number) β Pitch/tilt angle.distance(number) β Distance from target point.
engine.camera_fov(fov)β
fov(number) β Set or query the current camera field of view.
πΊοΈ Scene & Asset APIβ
engine.scene(name)β
Sets or creates an active scene space.
name(string) β Scene name.
engine.scene_clear()β
Removes all entities and resources from the active scene.
engine.scene_stats()β
- Returns:
tableβ Stats like total entities, mesh count, texture count, and active lighting.
engine.scene_draw()β
Renders all active scene entities automatically.
engine.scene_save(path)β
Saves the active scene metadata to a .scene file.
engine.scene_load(path)β
Loads a saved scene from a .scene file.
engine.scene_watch(path)β
Enables live file watching on the specified .scene file path. When modified, the engine automatically reloads it.
engine.scene_reload(path)β
Manually triggers a scene reload from the specified file.
π¦ Mesh, Texture, & Material APIβ
engine.mesh(name, source, optionalData)β
Registers a mesh asset into the engine cache.
name(string) β Unique mesh name.source(string) β Mesh type (e.g."cube","plane","sphere") or path to a 3D model file (e.g."assets/models/hero.obj").
engine.mesh_exists(name)β
- Returns:
booleanβtrueif the mesh is cached.
engine.texture(name, filePath)β
Registers a texture file into memory.
name(string) β Unique texture label.filePath(string) β Path to the image file (e.g."assets/textures/wood.png").
engine.texture_exists(name)β
- Returns:
booleanβtrueif the texture is loaded.
engine.material(name, albedo, roughness, metallic, emissive)β
Creates a custom PBR material.
name(string) β Material label.albedo(RGBA array) β Base color.roughness(number) β Roughness value (0.0 - 1.0).metallic(number) β Metallic coefficient (0.0 - 1.0).emissive(RGBA array) β Emissive light tint.
engine.material_exists(name)β
- Returns:
booleanβtrueif the material exists.
engine.material_texture(materialName, textureName)β
Binds a texture to a material slot.
materialName(string) β Target material.textureName(string) β Cached texture name.
πΎ Entity APIβ
engine.entity(name, kind, position, color)β
Spawns a new entity in the scene space.
name(string) β Unique entity name.kind(string) β Mesh shape ("cube","plane","sphere").position(3D vector) β Spawn coordinates[x, y, z].color(RGBA array) β Base tint color.
engine.entity_remove(name)β
Removes the entity from the active scene.
engine.entity_exists(name)β
- Returns:
booleanβtrueif the entity is active.
engine.entity_set_position(name, position)β
position(3D vector) β[x, y, z].
engine.entity_get_position(name)β
- Returns:
3D vectorβ The[x, y, z]coordinates.
engine.entity_set_size(name, size)β
size(3D vector) β Width, height, and depth dimensions.
engine.entity_set_scale(name, scale)β
scale(3D vector) β[x, y, z]scaling factors.
engine.entity_set_radius(name, radius)β
radius(number) β Radius value (sphere entities).
engine.entity_set_color(name, color)β
color(RGBA array) β[r, g, b, a].
engine.entity_set_visible(name, visible)β
visible(boolean) β Hide or show the entity.
engine.entity_mesh(entityName, meshName)β
Binds a custom mesh to the entity.
engine.entity_texture(entityName, textureName)β
Binds a texture to the entity.
engine.entity_material(entityName, materialName)β
Binds a material to the entity.
π‘ Lighting APIβ
engine.light_ambient(color)β
Sets the ambient environment lighting color.
color(RGBA array) β E.g.,[30, 30, 45, 255].
engine.light_directional(direction, color, intensity)β
Creates or updates the primary directional light source (like the Sun).
direction(3D vector) β Direction vector[x, y, z]. E.g.,[0.5, -1.0, -0.5].color(RGBA array) β Light color.intensity(number) β Light strength (e.g.1.0).
π¨ Post-Processing (FX) APIβ
Apply runtime rendering effects dynamically:
engine.exposure(value)β Sets HDR exposure level.engine.vignette(value)β Sets vignette shadowing intensity.engine.film_grain(value)β Adjusts visual noise/grain.engine.saturation(value)β Adjusts color saturation factor.engine.contrast(value)β Adjusts contrast multiplier.engine.bloom(value)β Toggles bloom glow threshold.engine.fog(color, near, far, density)β Sets scene distance fog.engine.volumetric(value)β Configures volumetric light shafts.
β¨οΈ Input APIβ
engine.key_down(keyCode)β
- Returns:
booleanβtrueif the specified key is currently held down.
engine.key_pressed(keyCode)β
- Returns:
booleanβtrueif the key was clicked during this frame.
engine.mouse_down(buttonCode)β
- Returns:
booleanβtrueif the mouse button is pressed (0for left,1for right).
engine.mouse_pos()β
- Returns:
2D vectorβ Current screen coordinate array[x, y].
ποΈ Immediate Draw APIβ
Draw graphics directly to the screen (by-passing the entity manager). These must be called between engine.frame_begin() and engine.frame_end().
engine.draw_grid(slices, spacing)β Renders a grid pattern at the origin.engine.draw_cube(position, size, color)β Draws a solid cube.engine.draw_plane(position, size2d, color)β Draws a flat surface plane.engine.draw_sphere(position, radius, color)β Draws a solid sphere.engine.draw_text(text, x, y, fontSize, color)β Renders 2D screen text.engine.draw_fps(x, y)β Draws the default frames-per-second indicator.