Skip to content

stdlib/streamingView source ↗

streaming

17 items · generated by scribe fromstdlib/streaming.fd· synced 2026-11-15

stdlib/streaming17 items

Contents

Chunk

pub struct Chunk {

Fields:

NameType
cxi64
cyi64
statei64
last_usedi64
dataVec<i64>

Defined at line 18


StreamManager

pub struct StreamManager {

Fields:

NameType
chunk_sizei64
view_radiusi64
focus_xi64
focus_yi64
chunksVec<Chunk>
ticki64
load_counti64
unload_counti64

Defined at line 32


streaming_create

Create a new stream manager. chunk_size = pixel dimensions of each chunk (e.g., 32 or 64). view_radius = number of chunks to keep loaded in each direction from focus.

pub fn streaming_create(chunk_size: i64, view_radius: i64) -> StreamManager {

Parameters:

  • chunk_size: i64
  • view_radius: i64

Returns: StreamManager

Defined at line 55


streaming_set_focus

Set the focus point (usually the player’s world position).

pub fn streaming_set_focus(mgr: & mut StreamManager, x: i64, y: i64) -> void {

Parameters:

  • mgr: & mut StreamManager
  • x: i64
  • y: i64

Returns: void

Defined at line 64


streaming_world_to_chunk

Get the chunk coordinate for a world position.

pub fn streaming_world_to_chunk(mgr: StreamManager, x: i64, y: i64) -> (i64, i64) {

Parameters:

  • mgr: StreamManager
  • x: i64
  • y: i64

Returns: (i64, i64)

Defined at line 70


streaming_chunk_to_world

Get the world-space top-left corner of a chunk.

pub fn streaming_chunk_to_world(mgr: StreamManager, cx: i64, cy: i64) -> (i64, i64) {

Parameters:

  • mgr: StreamManager
  • cx: i64
  • cy: i64

Returns: (i64, i64)

Defined at line 75


streaming_find_chunk

Find the index of a chunk in the manager’s list. Returns -1 if not found.

pub fn streaming_find_chunk(mgr: StreamManager, cx: i64, cy: i64) -> i64 {

Parameters:

  • mgr: StreamManager
  • cx: i64
  • cy: i64

Returns: i64

Defined at line 82


streaming_is_chunk_loaded

Check if a chunk is currently loaded.

pub fn streaming_is_chunk_loaded(mgr: StreamManager, cx: i64, cy: i64) -> bool {

Parameters:

  • mgr: StreamManager
  • cx: i64
  • cy: i64

Returns: bool

Defined at line 95


streaming_update

Update the stream manager: load chunks within view radius, unload those outside. Returns the number of chunks that changed state.

pub fn streaming_update(mgr: & mut StreamManager) -> i64 {

Parameters:

  • mgr: & mut StreamManager

Returns: i64

Defined at line 108


streaming_loaded_count

Get the number of currently loaded chunks.

pub fn streaming_loaded_count(mgr: StreamManager) -> i64 {

Parameters:

  • mgr: StreamManager

Returns: i64

Defined at line 186


streaming_total_loaded

Get total chunks ever loaded.

pub fn streaming_total_loaded(mgr: StreamManager) -> i64 {

Parameters:

  • mgr: StreamManager

Returns: i64

Defined at line 200


streaming_total_unloaded

Get total chunks ever unloaded.

pub fn streaming_total_unloaded(mgr: StreamManager) -> i64 {

Parameters:

  • mgr: StreamManager

Returns: i64

Defined at line 205


streaming_view_diameter

Get the view diameter (in pixels) of the loaded area.

pub fn streaming_view_diameter(mgr: StreamManager) -> i64 {

Parameters:

  • mgr: StreamManager

Returns: i64

Defined at line 210


streaming_is_position_loaded

Check if a world position is within the loaded area.

pub fn streaming_is_position_loaded(mgr: StreamManager, x: i64, y: i64) -> bool {

Parameters:

  • mgr: StreamManager
  • x: i64
  • y: i64

Returns: bool

Defined at line 215


streaming_get_chunk_data

Get data from a chunk at a local (within-chunk) position. Returns 0 if chunk not loaded or out of bounds.

pub fn streaming_get_chunk_data(mgr: StreamManager, cx: i64, cy: i64, local_x: i64, local_y: i64) -> i64 {

Parameters:

  • mgr: StreamManager
  • cx: i64
  • cy: i64
  • local_x: i64
  • local_y: i64

Returns: i64

Defined at line 225


streaming_set_chunk_data

Set data in a chunk at a local position.

pub fn streaming_set_chunk_data(mgr: & mut StreamManager, cx: i64, cy: i64, local_x: i64, local_y: i64, value: i64) -> void {

Parameters:

  • mgr: & mut StreamManager
  • cx: i64
  • cy: i64
  • local_x: i64
  • local_y: i64
  • value: i64

Returns: void

Defined at line 241


streaming_stats

Get a summary string of the stream manager state.

pub fn streaming_stats(mgr: StreamManager) -> str {

Parameters:

  • mgr: StreamManager

Returns: str

Defined at line 256


Generated by scribe, the Fides documentation generator