tilemap.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #ifndef TILEMAP_H
  2. #define TILEMAP_H
  3. typedef struct Tilemap_ Tilemap;
  4. #include "area.h"
  5. #include "tile.h"
  6. #include "tilepane.h"
  7. /* Tile maps have at most 4 panes. */
  8. #define TILEMAP_PANES 4
  9. Image * image_loadtexture (const char * category , int index );
  10. Tilemap * tilemap_done (Tilemap * self );
  11. Tilemap * tilemap_init (Tilemap * self , Tileset * set , int w , int h, Area * areq );
  12. Tilemap * tilemap_free (Tilemap * map );
  13. Tilemap * tilemap_new (Tileset * set , int w , int h, Area * area );
  14. int tilemap_panes(Tilemap * self);
  15. Tilepane * tilemap_pane (Tilemap * self , int index );
  16. Tilepane * tilemap_pane_ (Tilemap * self , int index , Tilepane * pane );
  17. Tilepane * tilemap_panenew (Tilemap * self , int index , int w , int h );
  18. Tile * tilemap_get (Tilemap * self , int l , int x , int y );
  19. int tile_thingkind (Tile * tile );
  20. Thing * tilemap_tiletothing (Tilemap * self , int l , int x , int y , Tile * tile );
  21. Tile * tilemap_settile (Tilemap * self , int l , int x , int y , Tile * tile );
  22. Tile * tilemap_setindex (Tilemap * self , int l , int x , int y , int index );
  23. Tile * tilemap_rect (Tilemap * self , int l , int x , int y , int w , int h , Tile * tile );
  24. Tile * tilemap_fill (Tilemap * self , int l , Tile * tile );
  25. int tilemap_getindex (Tilemap * self , int l , int x , int y );
  26. Thing * tilemap_addtilething (Tilemap * self , int kind , int tx , int ty , int layer );
  27. void tilemap_draw (Tilemap * map , Camera * camera );
  28. void tilemap_update (Tilemap * map , double dt );
  29. Thing * tilemap_addthing(Tilemap * self , int index, int kind , int x , int y , int z , int w , int h);
  30. Lockin * tilepane_lockin (Tilepane * pane , Camera * camera );
  31. Lockin * tilemap_layer_lockin (Tilemap * map , int layer , Camera * camera );
  32. int tilemap_gridwide(Tilemap * self);
  33. int tilemap_gridhigh(Tilemap * self);
  34. Area * tilemap_area(Tilemap * self);
  35. Thing * tilemap_thing(Tilemap * self, int index);
  36. bool tilemap_init_blend(Tilemap * self);
  37. void tilemap_draw_layer(Tilemap * map, Camera * camera, int layer);
  38. void tilemap_draw_layer_shadows(Tilemap * map, Camera * camera, int layer);
  39. /* This is here in stead of in area.h to avoid cyclical dependencies. */
  40. ERES area_tilemap_(Area * self, Tilemap * map);
  41. void tilemap_draw_layer_tiles(Tilemap * map, Camera * camera, int layer);
  42. void tilemap_draw_layer_blends(Tilemap * map, Camera * camera, int layer);
  43. Tileset * tilemap_tileset(Tilemap * me);
  44. int tilemap_firstgid(Tilemap * me);
  45. int tilemap_set_flags(Tilemap * self, int l, int x, int y, int flags);
  46. int tilemap_get_flags(Tilemap * self, int l, int x, int y);
  47. #ifdef COMMENT_
  48. Tilepane * tilepane_savefile (Tilepane *pane , int paneid , FILE *fout );
  49. Tilemap * tilemap_savefile (Tilemap * map , FILE * fout );
  50. Tilemap * tilemap_save (Tilemap * map , int index );
  51. int tilemap_track (Tracker * tracker , void * data );
  52. #endif
  53. #endif