[][src]Trait romy_core::Game

pub trait Game {
    fn step(&mut self, arguments: &StepArguments);
fn draw(&self, arguments: &DrawArguments) -> Image;
fn render_audio(&self, arguments: &RenderAudioArguments) -> Sound; }

The core trait used by Romy, games need to implement this. Romy will use these methods to run the game.

Required methods

fn step(&mut self, arguments: &StepArguments)

Simulates the game by one step

Arguments

  • arguments - Info, such as inputs, to be used in this step

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

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.

Loading content...

Implementors

Loading content...