pub trait Game {
// Required methods
fn step(&mut self, arguments: &StepArguments);
fn draw(&self, arguments: &DrawArguments) -> Image;
fn render_audio(&self, arguments: &RenderAudioArguments) -> Sound;
}Expand description
The core trait used by Romy, games need to implement this. Romy will use these methods to run the game.
Required Methods§
Sourcefn step(&mut self, arguments: &StepArguments)
fn step(&mut self, arguments: &StepArguments)
Sourcefn draw(&self, arguments: &DrawArguments) -> Image
fn draw(&self, arguments: &DrawArguments) -> Image
Renders an image for Romy to display, can be called many times per step.
This function can return any image.
§Arguments
arguments- Info, such as the width of the frame Romy is rendering too, to be used in this step
Sourcefn render_audio(&self, arguments: &RenderAudioArguments) -> Sound
fn render_audio(&self, arguments: &RenderAudioArguments) -> Sound
Renders some audio for Romy to play, called once per step.
The sound returned currently needs to be at a sample rate of 44100hz, and have enough samples to cover the amount of time between calls to step.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".