Skip to content

Commit

Permalink
add data api sound length functions
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDavenport committed Sep 12, 2022
1 parent 8c868dd commit c1675e7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/api-reference/data.md
Expand Up @@ -37,4 +37,22 @@ fn sprite_width(sheet_index: i32) -> i32;
// Returns the number of sprites within the sprite sheet. If an invalid sprite sheet index is passed in,
// the function will return -1.
fn sprite_count(sheet_index: i32) -> i32;

// Returns the length of the requested song in seconds.
// If the song is invalid, will return NaN.
fn bgm_length_secs(bgm_index: i32) -> f32;

// Returns the length of the requested song in frames.
// The result of this function is always rounded up, ensuring that this sequence will be completed if
// the complete number of frames have passed.
fn bgm_length_frames(bgm_index: i32) -> i32;

// Returns the length of the requested song in seconds.
// If the sfx is invalid, will return NaN.
fn sfx_length_secs(sfx_index: i32) -> f32;

// Returns the length of the requested song in frames.
// The result of this function is always rounded up, ensuring that this sequence will be completed if
// the complete number of frames have passed.
fn sfx_length_frames(sfx_index: i32) -> i32;
```
4 changes: 4 additions & 0 deletions docs/api-reference/index.md
Expand Up @@ -52,6 +52,10 @@ extern "C" {
pub fn sprite_height(sprite_sheet: i32) -> i32;
pub fn sprite_width(sprite_sheet: i32) -> i32;
pub fn sprite_count(sprite_sheet: i32) -> i32;
pub fn bgm_length_secs(bgm_index: i32) -> f32;
pub fn bgm_length_frames(bgm_index: i32) -> i32;
pub fn sfx_length_secs(sfx_index: i32) -> f32;
pub fn sfx_length_frames(sfx_index: i32) -> i32;
}

// Graphics Params
Expand Down

0 comments on commit c1675e7

Please sign in to comment.