Crate wolf_engine_sdl2

Source
Expand description

Provides sdl2 integrations for wolf_engine.

§Installation

Add this package, and sdl2 to your project’s dependencies:

wolf_engine_sdl2 = "*"
sdl2 = "*"

§Example

The main job of this package is to provide thin Subcontext wrappers around the normal sdl2 types, and a Plugin to set everything up, allowing wolf_engine to manage sdl2 for you. The sdl2 objects are accessible through public fields on the Subcontexts, and their normal usage is not changed.

Load the SdlPlugin with the EngineBuilder at startup.

use wolf_engine::*;
use wolf_engine_sdl2::*;

EngineBuilder::new()
    .with_plugin(Box::from(SdlPlugin::default()))
    .build()
    .unwrap()
    .run(Box::from(my_game));

SDL Subcontexts can be accessed through the Context object.

let mut sdl_video = context.borrow_mut::<SdlVideoContext>().unwrap();
sdl_video.canvas.clear();
sdl_video.canvas.present();

For a more complete usage example, see the Quickstart Example.

Structs§

SdlAudioContext
Provides access to sdl2’s AudioSubsystem.
SdlContext
Provides access to the main Sdl instance.
SdlMainLoop
SdlPlugin
Provides sdl2 integrations for wolf_engine.
SdlPluginBuilder
Build and customize an instance of SdlPlugin.
SdlVideoContext
Provides access to sdl2’s WindowCanvas and VideoSubsystem.
SdlWindowSettings
Settings for creating the SDL window.