tile.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #ifndef ERUTA_TILE_H
  2. #define ERUTA_TILE_H
  3. #include "eruta.h"
  4. #include "image.h"
  5. // Default size of tiles is 32x32. Tilesheets should be a multiple of this.
  6. #define TILE_W 32
  7. #define TILE_H 32
  8. enum TILE_ANIME_OPCODE_ {
  9. TILE_ANIME_REWIND = 1,
  10. TILE_ANIME_NEXT = 2,
  11. TILE_ANIME_WAIT = 3,
  12. };
  13. /* Tile flags. */
  14. enum TILE_FLAGS_ {
  15. TILE_WALL = 1 << 0,
  16. TILE_WATER = 1 << 1,
  17. TILE_LEDGE = 1 << 2,
  18. TILE_STAIR = 1 << 3,
  19. TILE_PUSH = 1 << 4,
  20. TILE_NORTH = 1 << 5,
  21. TILE_SOUTH = 1 << 6,
  22. TILE_EAST = 1 << 7,
  23. TILE_WEST = 1 << 8,
  24. TILE_UP = 1 << 9,
  25. TILE_DOWN = 1 << 10,
  26. TILE_ICE = 1 << 11,
  27. };
  28. #define TILE_FRAMES 32
  29. #define TILE_PROGRAMS 32
  30. typedef struct Tileset_ Tileset;
  31. typedef struct Tile_ Tile;
  32. void tileset_done (Tileset * set );
  33. void tileset_free (Tileset * set );
  34. int tileset_size (Tileset * set );
  35. int tileset_firstgid(Tileset * set);
  36. /** Initializes a given tileset with a given bitmap tile sheet and firstgid */
  37. Tileset * tileset_init(Tileset * set, Image * sheet, int firstgid);
  38. Tileset * tileset_new(Image * sheet, int firstgid );
  39. Tile * tile_recalculate (Tile * tile );
  40. Tile * tile_init (Tile * tile , Tileset * set , int index );
  41. Tile * tileset_get (Tileset * set , int index );
  42. Tile * tile_anim_ (Tile * tile , int anim );
  43. int tile_anim (Tile * tile );
  44. Tile * tile_wait_ (Tile * tile , int wait );
  45. int tile_wait (Tile * tile );
  46. int tile_flags (Tile * tile );
  47. Tile * tile_flags_ (Tile * tile , int flags );
  48. Tile * tile_setflag (Tile * tile , int flag );
  49. Tile * tile_unflag (Tile * tile , int flag );
  50. int tile_isflag (Tile * tile , int flag );
  51. Tile * tile_property_ (Tile * tile , char * property );
  52. void tile_rewindanime (Tile * tile );
  53. void tile_update (Tile * tile , double dt );
  54. void tileset_update (Tileset * set , double dt );
  55. void tile_draw (Tile * tile , int x , int y, int drawflags);
  56. int tile_index (Tile * tile );
  57. int tile_kind (Tile * tile );
  58. void tile_draw_masked_to
  59. (Image * result, Tile * tile, Image * mask, float angle, int mask_flags);
  60. int tile_blend_(Tile * tile , int priority);
  61. int tile_blend(Tile * tile );
  62. int tile_blend_mask(Tile * tile);
  63. int tile_blend_mask_(Tile * tile, int mask);
  64. int tile_light_(Tile * tile , int value);
  65. int tile_light(Tile * tile );
  66. int tile_light_mask(Tile * tile);
  67. int tile_light_mask_(Tile * tile, int mask);
  68. int tile_shadow_(Tile * tile , int value);
  69. int tile_shadow(Tile * tile );
  70. int tile_shadow_mask(Tile * tile);
  71. int tile_shadow_mask_(Tile * tile, int mask);
  72. Tile * tile_add_animation_frame(Tile * tile, int index, double duration);
  73. #endif