add generic pixel type parameter to SystemResources
this has no immediate use, but i think it will be useful in the future for writing generic constraints requiring 32-bit color support while not forcing use of any specific SystemResources implementation
This commit is contained in:
parent
cf6b7e5e3c
commit
4069a92843
|
@ -251,6 +251,8 @@ impl std::fmt::Debug for DosLike {
|
|||
}
|
||||
|
||||
impl SystemResources for DosLike {
|
||||
type PixelType = u8;
|
||||
|
||||
fn update(&mut self) -> Result<(), SystemResourcesError> {
|
||||
self.cursor.update(&self.mouse);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ use thiserror::Error;
|
|||
|
||||
use crate::audio::device::AudioDeviceError;
|
||||
use crate::audio::AudioError;
|
||||
use crate::graphics::Pixel;
|
||||
use crate::system::event::SystemEvent;
|
||||
use crate::system::framebuffer::SdlFramebufferError;
|
||||
|
||||
|
@ -41,6 +42,8 @@ pub trait SystemResourcesConfig {
|
|||
/// Trait used to implement structs which get used by [`System`] to provide access to hardware resources like
|
||||
/// audio, video and input devices.
|
||||
pub trait SystemResources: std::fmt::Debug {
|
||||
type PixelType: Pixel;
|
||||
|
||||
/// Perform any per-frame hardware resource updates. You should prefer to call [`System::update`] instead of this
|
||||
/// in your main loop.
|
||||
fn update(&mut self) -> Result<(), SystemResourcesError>;
|
||||
|
|
|
@ -205,6 +205,8 @@ impl std::fmt::Debug for Standard {
|
|||
}
|
||||
|
||||
impl SystemResources for Standard {
|
||||
type PixelType = u32;
|
||||
|
||||
fn update(&mut self) -> Result<(), SystemResourcesError> {
|
||||
self.cursor.update(&self.mouse);
|
||||
|
||||
|
|
Loading…
Reference in a new issue