Struct ggez::Context [] [src]

pub struct Context<'a> {
    pub sdl_context: Sdl,
    pub mixer_context: Sdl2MixerContext,
    pub renderer: Renderer<'a>,
    pub filesystem: Filesystem,
    pub gfx_context: GraphicsContext,
    pub event_context: EventSubsystem,
    pub timer_context: TimeContext,
    pub dpi: (f32, f32, f32),
    // some fields omitted

A Context is an object that holds on to global resources. It basically tracks hardware state such as the screen, audio system, timers, and so on. Generally this type is not thread- safe and only one Context can exist at a time. Trying to create another one will fail. In normal usage you don't have to worry about this because it gets created and managed by the Game object, and is handed to your GameState for use in drawing and such.

Most functions that interact with the hardware, for instance drawing things, playing sounds, or loading resources (which then need to be transformed into a format the hardware likes) will need to access the Context.



impl<'a> Context<'a>

Tries to create a new Context using settings from the given config file. Usually called by the engine as part of the set-up code.

Prints out information on the sound subsystem.

Prints out information on the resources subsystem.

Triggers a Quit event.

Trait Implementations

impl<'a> Debug for Context<'a>

Formats the value using the given formatter.