1. 27 Dec, 2020 1 commit
    • Rahix's avatar
      sprite: Add custom offsetting mechanism · c12ef4fe
      Rahix authored
      In case some entity needs its sprite to be offset from its position, add
      an `offset` attribute to the `Sprite` component which allows doing just
      that.
      
      The offset is a translation vector from the default position.  By
      default, a sprite is placed such that its center is located at the
      entities `Position`.
      c12ef4fe
  2. 26 Dec, 2020 2 commits
    • Rahix's avatar
      sprite: Allow passing `Sprite` directly · 8a478b46
      Rahix authored
      Allow passing either an ImageHandle or a `Sprite` to Sprite::new().
      8a478b46
    • Rahix's avatar
      sprites: Don't hold center coordinates in component · ff31586d
      Rahix authored
      Query the size of the sprite on the fly during rendering.  This makes
      component instanciation much easier because it no longer requires access
      to the `Rendering` API.
      
      As a later optimization, we could move this ofsetting into the
      draw_image() function via a new parameter.
      ff31586d
  3. 22 Dec, 2020 2 commits