more struct docs
This commit is contained in:
		
							parent
							
								
									ebea5ffd22
								
							
						
					
					
						commit
						725a5d8f03
					
				
					 4 changed files with 22 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -6,7 +6,7 @@ use sdl2::Sdl;
 | 
			
		|||
use sdl2::rect::Rect;
 | 
			
		||||
use sdl2::render::WindowCanvas;
 | 
			
		||||
 | 
			
		||||
/// Creates a root window with SDL2, then displays each 2D video frame provided by the core
 | 
			
		||||
/// Creates a root window in SDL2, then displays each 2D video frame provided by the core
 | 
			
		||||
/// by converting it to a [sdl2::render::Texture] and copying it to the window's canvas.
 | 
			
		||||
///
 | 
			
		||||
/// This component has no public interface and manages the SDL2 window on its own.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,6 @@
 | 
			
		|||
//! [RetroComponent](crate::base::RetroComponent)s implementing interactive gameplay functionality
 | 
			
		||||
//! with SDL2.
 | 
			
		||||
 | 
			
		||||
mod canvas;
 | 
			
		||||
mod audio;
 | 
			
		||||
mod gamepad;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,7 +7,7 @@ use sdl2::Sdl;
 | 
			
		|||
use sdl2::rect::Rect;
 | 
			
		||||
use sdl2::render::WindowCanvas;
 | 
			
		||||
 | 
			
		||||
/// Uses SDL2 to create a root window with an OpenGL context and attaches libretro's
 | 
			
		||||
/// Create a root window in SDL2 with an OpenGL context and attaches libretro's
 | 
			
		||||
/// `hw_get_proc_address` calls to that of the [sdl2::VideoSubsystem].
 | 
			
		||||
///
 | 
			
		||||
/// If the core provides 2D framebuffer data to the component, it will simply display it with a
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,6 @@
 | 
			
		|||
//! Generally-useful [RetroComponent](crate::base::RetroComponent)s that have no dependencies
 | 
			
		||||
//! outside of [std].
 | 
			
		||||
 | 
			
		||||
use std::os::raw::c_uint;
 | 
			
		||||
use std::path::PathBuf;
 | 
			
		||||
use std::time::{Duration, Instant};
 | 
			
		||||
| 
						 | 
				
			
			@ -6,6 +9,7 @@ use crate::base::ControlFlow;
 | 
			
		|||
use crate::prelude::*;
 | 
			
		||||
use ferretro_base::retro::ffi::{Message, Language};
 | 
			
		||||
 | 
			
		||||
/// Provides paths to the BIOS ROMs, core library, assets, and saves to cores that need them.
 | 
			
		||||
#[derive(Default)]
 | 
			
		||||
pub struct PathBufComponent {
 | 
			
		||||
    pub sys_path: Option<PathBuf>,
 | 
			
		||||
| 
						 | 
				
			
			@ -30,6 +34,9 @@ impl RetroCallbacks for PathBufComponent {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Write's the core's own log statements to stderr.
 | 
			
		||||
///
 | 
			
		||||
/// The public member [Self::prefix] may be set to add a prefix to each logged line.
 | 
			
		||||
#[derive(Default)]
 | 
			
		||||
pub struct StderrLogComponent {
 | 
			
		||||
    pub prefix: String,
 | 
			
		||||
| 
						 | 
				
			
			@ -42,6 +49,10 @@ impl RetroCallbacks for StderrLogComponent {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Writes all the input descriptors, variables, and subsystem information to stderr as they are
 | 
			
		||||
/// provided by the core.
 | 
			
		||||
///
 | 
			
		||||
/// The public member [Self::prefix] may be set to add a prefix to each logged line.
 | 
			
		||||
#[derive(Default)]
 | 
			
		||||
pub struct StderrSysInfoLogComponent {
 | 
			
		||||
    pub prefix: String,
 | 
			
		||||
| 
						 | 
				
			
			@ -71,6 +82,9 @@ impl RetroCallbacks for StderrSysInfoLogComponent {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Trace-logs every callback call made and their arguments to stderr.
 | 
			
		||||
///
 | 
			
		||||
/// The public member [Self::prefix] may be set to add a prefix to each logged line.
 | 
			
		||||
#[derive(Default)]
 | 
			
		||||
pub struct StderrCallTraceComponent {
 | 
			
		||||
    pub prefix: String,
 | 
			
		||||
| 
						 | 
				
			
			@ -199,6 +213,9 @@ impl RetroCallbacks for StderrCallTraceComponent {
 | 
			
		|||
    // TODO: etc...
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Uses [std::thread::sleep] to maintain the target FPS specified by the core.
 | 
			
		||||
///
 | 
			
		||||
/// The sleep occurs during either `video_refresh` or at the end of `run()`.
 | 
			
		||||
pub struct SleepFramerateLimitComponent {
 | 
			
		||||
    did_sleep: bool,
 | 
			
		||||
    fps: f64,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue