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
.
Fields
sdl_context: Sdl
mixer_context: Sdl2MixerContext
renderer: Renderer<'a>
filesystem: Filesystem
gfx_context: GraphicsContext
event_context: EventSubsystem
timer_context: TimeContext
dpi: (f32, f32, f32)
Methods
impl<'a> Context<'a>
[src]
fn from_conf(conf: &Conf,
fs: Filesystem,
sdl_context: Sdl)
-> GameResult<Context<'a>>
fs: Filesystem,
sdl_context: Sdl)
-> GameResult<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.
fn print_sound_stats(&self)
Prints out information on the sound subsystem.
fn print_resource_stats(&mut self)
Prints out information on the resources subsystem.
fn quit(&mut self) -> GameResult<()>
Triggers a Quit event.