message: Clarify and correct comments in hello_world.rs example.
diff: @@ -14,13 +14,11 @@ struct MainState {
  frames: usize,
  }
  -// Then we implement the `ggez:event::EventHandler` trait on it, which
  -// requires callbacks for updating and drawing the game state each frame.
  -//
  -// The `EventHandler` trait also contains callbacks for event handling
  -// that you can override if you wish, but the defaults are fine.
  impl MainState {
  fn new(ctx: &mut Context) -> GameResult<MainState> {
  +
  + // The ttf file will be in your resources directory. Later, we
  + // will mount that directory so we can omit it in the path here.
  let font = graphics::Font::new(ctx, "/DejaVuSerif.ttf", 48)?;
  let text = graphics::Text::new(ctx, "Hello world!", &font)?;
  @@ -33,6 +31,11 @@ impl MainState {
  }
  +// Then we implement the `ggez:event::EventHandler` trait on it, which
  +// requires callbacks for updating and drawing the game state each frame.
  +//
  +// The `EventHandler` trait also contains callbacks for event handling
  +// that you can override if you wish, but the defaults are fine.
  impl event::EventHandler for MainState {
  fn update(&mut self, _ctx: &mut Context) -> GameResult<()> {
  Ok(())
  @@ -40,15 +43,17 @@ impl event::EventHandler for MainState {
  fn draw(&mut self, ctx: &mut Context) -> GameResult<()> {
  graphics::clear(ctx);
  - // Drawables are drawn from their center.
  - let dest_point = graphics::Point2::new(self.text.width() as f32 / 2.0 + 10.0,
  - self.text.height() as f32 / 2.0 + 10.0);
  +
  + // Drawables are drawn from their top-left corner.
  + let dest_point = graphics::Point2::new(10.0, 10.0);
  graphics::draw(ctx, &self.text, dest_point, 0.0)?;
  graphics::present(ctx);
  +
  self.frames += 1;
  if (self.frames % 100) == 0 {
  println!("FPS: {}", ggez::timer::get_fps(ctx));
  }
  +
  Ok(())
  }
  }
  @@ -57,16 +62,16 @@ impl event::EventHandler for MainState {
  //
  // * First, create a new `ggez::conf::Conf`
  // object which contains configuration info on things such
  -// as screen resolution and window title,
  +// as screen resolution and window title.
  // * Second, create a `ggez::game::Game` object which will
  -// do the work of creating our MainState and running our game,
  -// * then just call `game.run()` which runs the `Game` mainloop.
  +// do the work of creating our MainState and running our game.
  +// * Then, just call `game.run()` which runs the `Game` mainloop.
  pub fn main() {
  let c = conf::Conf::new();
  let ctx = &mut Context::load_from_conf("helloworld", "ggez", c).unwrap();
  - // We add the CARGO_MANIFEST_DIR/resources do the filesystems paths so
  - // we we look in the cargo project for files.
  + // We add the CARGO_MANIFEST_DIR/resources to the filesystem's path
  + // so that ggez will look in our cargo project directory for files.
  if let Ok(manifest_dir) = env::var("CARGO_MANIFEST_DIR") {
  let mut path = path::PathBuf::from(manifest_dir);
  path.push("resources");
  