Skip to content

Commit

Permalink
remove multivalue as they aren't working
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDavenport committed Apr 15, 2024
1 parent d2a44cb commit 3edec27
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 39 deletions.
4 changes: 0 additions & 4 deletions gamercade_console/src/api/data_api.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
pub trait DataApi {
fn height(&self) -> i32;
fn width(&self) -> i32;
fn dimensions(&self) -> (i32, i32);
fn fps(&self) -> i32;
fn frame_time(&self) -> f32;

Expand All @@ -11,7 +10,6 @@ pub trait DataApi {
fn sprite_height(&self, sheet_index: i32) -> i32;
fn sprite_width(&self, sheet_index: i32) -> i32;
fn sprite_count(&self, sheet_index: i32) -> i32;
fn sprite_dimensions(&self, sheet_index: i32) -> (i32, i32);

fn bgm_length_secs(&self, bgm_index: i32) -> f32;
fn bgm_length_frames(&self, bgm_index: i32) -> i32;
Expand All @@ -34,14 +32,12 @@ macro_rules! derive_bind_data_api {
derive_bind_data_api! {
bind_height,
bind_width,
bind_dimensions,
bind_fps,
bind_frame_time,
bind_sprite_sheet_count,
bind_palette_count,
bind_sprite_height,
bind_sprite_width,
bind_sprite_dimensions,
bind_sprite_count,
bind_bgm_length_secs,
bind_bgm_length_frames,
Expand Down
2 changes: 0 additions & 2 deletions gamercade_console/src/console/bindings/data_binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ macro_rules! derive_data_api_binding {
derive_data_api_binding! {
height(),
width(),
dimensions(),
fps(),
frame_time(),
sprite_sheet_count(),
palette_count(),
sprite_height(sprite_sheet: i32),
sprite_width(sprite_sheet: i32),
sprite_dimensions(sprite_sheet: i32),
sprite_count(sprite_sheet: i32),
bgm_length_secs(bgm_index: i32),
bgm_length_frames(bgm_index: i32),
Expand Down
10 changes: 0 additions & 10 deletions gamercade_console/src/console/contexts/data_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ impl DataApi for DataContext {
self.rom.width()
}

fn dimensions(&self) -> (i32, i32) {
(self.rom.width(), self.rom.height())
}

fn fps(&self) -> i32 {
self.rom.frame_rate.frames_per_second() as i32
}
Expand Down Expand Up @@ -57,12 +53,6 @@ impl DataApi for DataContext {
.unwrap_or(-1)
}

fn sprite_dimensions(&self, sheet_index: i32) -> (i32, i32) {
self.get_sprite_sheet(sheet_index)
.map(|sheet| (sheet.width as i32, sheet.height as i32))
.unwrap_or((-1, -1))
}

fn sprite_count(&self, sheet_index: i32) -> i32 {
self.get_sprite_sheet(sheet_index)
.map(|sheet| sheet.count as i32)
Expand Down
20 changes: 0 additions & 20 deletions gamercade_rs/src/api/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ pub fn width() -> usize {
unsafe { raw::width() as usize }
}

/// Returns the width and height of the screen, in pixels
pub fn dimensions() -> (usize, usize) {
unsafe {
let (width, height) = raw::dimensions();
(width as usize, height as usize)
}
}

/// Returns the target frame rate, in frames per second.
pub fn fps() -> usize {
unsafe { raw::fps() as usize }
Expand Down Expand Up @@ -54,18 +46,6 @@ pub fn sprite_width(sprite_sheet: usize) -> Option<u32> {
i32_u32_to_option(val)
}

/// Returns the width and height of each image for the request sprite sheet.
/// If the index is invalid, will return None.
pub fn sprite_dimensions(sprite_sheet: usize) -> Option<(u32, u32)> {
let (width, height) = unsafe { raw::sprite_dimensions(sprite_sheet as i32) };

if width.is_negative() {
None
} else {
Some((width as u32, height as u32))
}
}

/// Returns the number of sprites for the requsted sprite sheet.
/// If the index is invalid, will return None.
pub fn sprite_count(sprite_sheet: usize) -> Option<u32> {
Expand Down
3 changes: 0 additions & 3 deletions gamercade_rs/src/raw.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![allow(missing_docs)]
#![allow(improper_ctypes)]

// Audio
extern "C" {
Expand All @@ -13,14 +12,12 @@ extern "C" {
// Data
pub fn height() -> i32;
pub fn width() -> i32;
pub fn dimensions() -> (i32, i32);
pub fn fps() -> i32;
pub fn frame_time() -> f32;
pub fn sprite_sheet_count() -> i32;
pub fn palette_count() -> i32;
pub fn sprite_height(sprite_sheet: i32) -> i32;
pub fn sprite_width(sprite_sheet: i32) -> i32;
pub fn sprite_dimensions(sprite_sheet: i32) -> (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;
Expand Down

0 comments on commit 3edec27

Please sign in to comment.