Loading

Paste #plhuzlcpr

  1. struct DrawData {
  2.     int32 level;                 ///< Slice of this sprite (vertical row).
  3.     uint16 z_height;             ///< Height of the voxel being drawn.
  4.     SpriteOrder order;           ///< Selection when to draw this sprite (sorts sprites within a voxel). @see SpriteOrder
  5.     const ImageData *sprite;     ///< Mouse cursor to draw.
  6.     Point32 base;                ///< Base coordinate of the image, relative to top-left of the window.
  7.     const Recolouring *recolour; ///< Recolouring of the sprite.
  8. };
  9.  
  10. /**
  11.  * Sort predicate of the draw data.
  12.  * @param dd1 First value to compare.
  13.  * @param dd2 Second value to compare.
  14.  * @return \c true if \a dd1 should be drawn before \a dd2.
  15.  */
  16. inline bool operator<(const DrawData &dd1, const DrawData &dd2)
  17. {
  18.     if (dd1.level != dd2.level) return dd1.level < dd2.level; // Order on slice first.
  19.     if (dd1.z_height != dd2.z_height) return dd1.z_height < dd2.z_height; // Lower in the same slice first.
  20.     if (dd1.order != dd2.order) return dd1.order < dd2.order; // Type of sprite.
  21.     return dd1.base.y < dd2.base.y;
  22. }

Comments