1
0
Fork 0
This commit is contained in:
Florian RICHER 2022-06-21 22:37:45 +02:00
parent 0145968267
commit 898783ca80
9 changed files with 71 additions and 53 deletions

View file

@ -5,13 +5,24 @@ pub use renderer::Renderer;
mod default_state;
pub use default_state::DefaultState;
use wgpu::{TextureView, CommandEncoder, Queue};
use wgpu::{CommandEncoder, Queue, TextureView};
use winit::event::Event;
pub trait State {
fn new(renderer: &Renderer) -> Self where Self: Sized;
fn resize(&mut self, device: &wgpu::Device, config: &wgpu::SurfaceConfiguration, new_size: winit::dpi::PhysicalSize<u32>);
fn input(&mut self, event: &Event<()>) -> bool;
fn update(&mut self, queue: &Queue, dt: instant::Duration);
fn render(&mut self, view: &TextureView, encoder: &mut CommandEncoder) -> Result<(), wgpu::SurfaceError>;
}
fn new(renderer: &Renderer) -> Self
where
Self: Sized;
fn resize(
&mut self,
device: &wgpu::Device,
config: &wgpu::SurfaceConfiguration,
new_size: winit::dpi::PhysicalSize<u32>,
);
fn input(&mut self, event: &Event<()>) -> bool;
fn update(&mut self, queue: &Queue, dt: instant::Duration);
fn render(
&mut self,
view: &TextureView,
encoder: &mut CommandEncoder,
) -> Result<(), wgpu::SurfaceError>;
}