Crate render

Source
Expand description

Original immediate/retained renderer and platform ABI. Game code, input, geometry and scheduling live in Rust; hosts only bind OS events and GPU submission.

Modules§

ao
Offline, deterministic triangle-scene vertex occlusion. No per-frame ray work.
audio
Shared runtime audio. Rust owns clips, voices and mixing; hosts consume PCM.
canvas
Aspect-preserving 2D canvas with one coordinate transform for drawing and input.
content
Optional authoring bridge. A Source polls only explicit local files or queued browser edits; ordinary frames do no filesystem work or source allocation.
demo
Shared native smoke-run support for small interactive examples. Each game supplies its own autoplay inputs and uses the same simulation as a human.
effects
Batched low-poly particle billboards and ribbons over the shared color stream. No per-particle mesh, material, texture, GPU buffer or shader allocation.
icons
Procedural vector icons: a shared visual vocabulary that replaces words.
input
Runtime input uses logical display pixels. Legacy polling remains available; PlayerInput consumes the same ordered, bounded event journal.
juice
Presentation “juice”: bursts, sparkles, confetti, shockwave rings, floating popups, toasts, screen shake and flashes that make accepted events felt instead of described.
lighting
Bounded frame lighting, explicit quality tiers and a directional shadow volume.
material
Reusable shader handles. GPU compilation is host-owned and replacements are transactional.
mesh
Reusable geometry with face normals for lit 3D scenes.
native
Original system window/input/context bindings and shared native GL submission. Linux uses X11/GLX, Windows uses Win32/WGL, macOS uses AppKit/NSOpenGL, and iOS uses UIKit scenes/CADisplayLink/EAGL. No third-party Rust crates.
performance
Shared runtime adapter for optional presentation adaptation and local reports.
post
Opt-in full-screen post-processing: bloom, tonemapping, grading, vignette and optional film grain, chromatic aberration and scanlines.
preferences
Validated live presentation settings, separate from persistence and simulation.
prelude
retained
Retained low-poly geometry and ordered instanced draw recording.
shaders
Original built-in faceted lighting and distance fog.
shapes
Anti-aliased immediate 2D shapes: rounded rectangles, circles, rings, arcs, capsules, polylines, gradients, soft shadows and additive glows.
skinning
Four-influence linear blend skinning for retained low-poly meshes. Immutable geometry/weights upload once; only bounded pose palettes change each frame.
status
Opt-in, read-only status. Games own facts, IDs, availability and accepted events.
storage
Typed local saves. Filesystem/browser I/O occurs only on explicit load/commit.
telemetry
Opt-in local recordings. GPU durations come only from tagged driver queries.
text
Styled bitmap text: a modern mixed-case face, drop shadows, outlines, letter spacing, alignment, measurement and allocation-free word wrapping.
ui
Quiet, readable overlay helpers shared by the examples.
visibility
Conservative transformed-bound visibility and per-object hysteretic LOD.

Macros§

game

Structs§

Batch
BitmapFontMetrics
Validated, reusable font geometry. No atlas, text buffer or allocation is needed.
BitmapTextMetrics
Logical size and tight visible bounds of a measured label.
Camera2D
Camera3D
Color
Unpremultiplied RGBA floating-point channels. No implicit gamma conversion.
Conf
Font
Mat4
Column-major 4x4 matrix acting on column vectors: translation * rotation * scale.
Mesh
Quat
Quaternion stored as vector part (x,y,z) followed by scalar part w.
Rect
Axis-aligned 2D rectangle. Width and height should be nonnegative.
ScreenImage
TextDimensions
TextParams
Touch
Vec2
Vec3
Vec4
Vertex

Enums§

FontMeasureError
A font size, scale or resulting coordinate cannot be measured safely.
KeyCode
Look
Authored keeps original colors. Presets preserve alpha and need no extra pass.
MouseButton
TouchPhase

Constants§

BLACK
BLUE
DARKGRAY
GRAY
GREEN
LIGHTGRAY
ORANGE
RED
WHITE
YELLOW

Traits§

Camera

Functions§

autoplay_enabled
clear_background
draw_circle
draw_circle_lines
draw_cube
Draws an axis-aligned resident cuboid.
draw_ellipse
Filled ellipse of radii rx/ry rotated by rotation degrees, as a 32-segment fan (96 vertices). The rim directions come from a shared table.
draw_ellipse_adaptive
draw_ellipse with its segment count chosen from the on-screen size: from 8 segments for a few-pixel blob shadow to 64 for a large ellipse, the same curve density as shapes (2–16 segments per quarter turn). Emits at most 192 vertices; non-finite input draws nothing.
draw_line
draw_line_3d
draw_lod
draw_mesh
draw_mesh_transformed
draw_poly
draw_rectangle
draw_rectangle_lines
draw_resident
draw_shadow
Submit a hidden opaque caster, for example a first-person character body.
draw_skinned
Record a GPU-skinned mesh using conservative deformed bounds. Position and inverse-transpose normal palettes are copied into this frame; later palette edits cannot change already recorded draws or their matching shadow pass.
draw_skinned_shadow
draw_skinned_viewmodel
Draw an animated first-person prop over world geometry, without casting or receiving world shadows. Uses the current perspective and lighting; call after world draws. It never changes the camera or following draw state.
draw_text
draw_text_ex
Draws classic 5×7 bitmap text with its baseline at y: one quad per horizontal run of lit font pixels in each glyph row, each exactly one font pixel tall. Coverage is identical to one quad per lit pixel with fewer vertices. Use text::draw_text_styled with text::FontFace::Classic for the same letters with vertically merged geometry, shadows and outlines.
draw_triangle
get_default_font
get_frame_time
get_screen_data
get_time
is_key_down
is_key_pressed
is_mouse_button_down
is_mouse_button_pressed
look
measure_text
mouse_delta_position
mouse_position
mouse_wheel
next_frame
quality
request_graphics_reset
Rebuild GPU caches on the next host frame without restarting game state.
run
screen_dpi_scale
screen_height
screen_width
set_camera
set_cursor_grab
set_default_camera
Restore the screen-space HUD camera. After a world camera this is also the post-processing HUD boundary; see post.
set_display_scale
Hosts supply framebuffer pixels per logical input/UI pixel.
set_fidelity
Independent presentation detail overrides. Zero follows device/preset defaults.
set_lighting
set_look
Select a palette for world draws. Default-camera HUD drawing stays authored.
set_point_lights
set_quality
set_quality_preference
User preference overrides authored quality; explicit env/URL overrides win.
set_sun_shadow
set_visibility
set_world_colors
Explicit world/HUD boundary for games drawing in screen coordinates. Turning world colors off is also the post-processing HUD boundary; see post.
shadow_quality
Effective shadow tier, including the independent player detail override.
show_mouse
simulate_mouse_with_touch
start
touches
vec2
vec3
vec4
visibility_stats
window_conf