-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
letsplay_retro_frontend: Major refactoring
- Split all frontend implementation stuff into a new module - Begin a heavy cleanup of the public API - ... - profit?
- Loading branch information
Showing
6 changed files
with
76 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use std::ffi; | ||
|
||
/// Initalization data for HW OpenGL cores. | ||
pub struct HwGlInitData { | ||
/// A pointer to a function that can be used to request OpenGL extension functions. | ||
/// Given to the core so they can do so. | ||
pub get_proc_address: *mut ffi::c_void, | ||
} | ||
|
||
/// Interface for the frontend to call to user code. | ||
pub trait FrontendInterface { | ||
/// Called when video is updated. | ||
fn video_update(&mut self, slice: &[u32], pitch: u32); | ||
|
||
/// Called when video is updated and the core is using HW OpenGL rendering. | ||
fn video_update_gl(&mut self); | ||
|
||
/// Called when resize occurs. | ||
fn video_resize(&mut self, width: u32, height: u32); | ||
|
||
// TODO(lily): This should probably return the amount of consumed frames, | ||
// as in some cases that *might* differ? | ||
fn audio_sample(&mut self, slice: &[i16], size: usize); | ||
|
||
/// Called to poll input. | ||
fn input_poll(&mut self); | ||
|
||
/// Initalize hardware accelerated rendering using OpenGL. | ||
/// Return [Option::None] to indicate OpenGL initalization has failed. | ||
fn hw_gl_init(&mut self) -> Option<HwGlInitData>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
mod interface; | ||
pub use interface::*; | ||
|
||
mod frontend_impl; | ||
pub use frontend_impl::Frontend; | ||
|
||
mod core_variable; | ||
pub use core_variable::*; | ||
|
||
mod callbacks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters