Struct ggez::Context
[−]
[src]
pub struct Context { pub conf: Conf, pub sdl_context: Sdl, pub filesystem: Filesystem, pub gfx_context: GraphicsContext, pub event_context: EventSubsystem, pub timer_context: TimeContext, pub audio_context: AudioContext, pub default_font: Font, }
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.
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
conf: Conf
sdl_context: Sdl
filesystem: Filesystem
gfx_context: GraphicsContext
event_context: EventSubsystem
timer_context: TimeContext
audio_context: AudioContext
default_font: Font
Methods
impl Context
[src]
fn load_from_conf(
game_id: &'static str,
author: &'static str,
default_config: Conf
) -> GameResult<Context>
game_id: &'static str,
author: &'static str,
default_config: Conf
) -> GameResult<Context>
Tries to create a new Context loading a config
file from its default path, using the given Conf
object as a default if none is found.
The game_id
and author
are game-specific strings that
are used to locate the default storage locations for the
platform it looks in; for instance, on Linux, it will
look for ~/.config/id/conf.toml
fn print_resource_stats(&mut self)
Prints out information on the resources subsystem.
fn quit(&mut self) -> GameResult<()>
Triggers a Quit event.