area.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #ifndef area_H_INCLUDED
  2. #define area_H_INCLUDED
  3. /*
  4. An area is an in game region that forms a single unity in which play
  5. takes place. Ok, its' what you'd call a "level". Every area
  6. consists of a single tile map that determines the visual looks of the area,
  7. a chipmunk cpSpace that simulates the dynamics, sprite information
  8. that determines the visibility and position of the sprites, and a reference
  9. to the scripting engine that contains the logical state of the game.
  10. Division of the data locations: visual and physics engine: in C.
  11. Logic/game/character data: in scripting engine.
  12. */
  13. struct Area_;
  14. typedef struct Area_ Area;
  15. /** Need the camera and it's prototypes. */
  16. #include "camera.h"
  17. #include "thing.h"
  18. int area_maxthings (Area * area);
  19. Thing * area_thing (Area * area , int index);
  20. Thing * area_thing_(Area * area , int index , Thing * set);
  21. int area_get_unused_thing_id(Area * self);
  22. Thing * area_addthing (Area * area , int index, Thing * thing);
  23. int area_deletething (Area * area , int index);
  24. Area * area_cleanupthings (Area * self);
  25. Area * area_emptythings (Area * self);
  26. Area * area_done (Area * self);
  27. Area * area_free (Area * self);
  28. Area * area_alloc(void);
  29. Area * area_init (Area * self);
  30. Area * area_new(void);
  31. void area_draw_physics_(Area * self, int draw);
  32. int area_draw_physics(Area * self);
  33. Thing *
  34. area_newstatic(Area * self, int index, int kind , int x , int y , int z , int w , int h);
  35. Thing *
  36. area_newdynamic(Area * self, int index, int kind , int x , int y , int z , int w , int h);
  37. void area_draw (Area * self , Camera * camera );
  38. void area_update (Area * self , double dt );
  39. Thing * thing_new_dynamic(Area * area,
  40. int id, int kind,
  41. int x, int y, int z, int w, int h);
  42. void area_draw_layer (Area * self, Camera * camera, int layer);
  43. /* There are some tile map related functionalities that are declared in tilemap.h
  44. * in stead of here to avoid cyclical dependencies.
  45. */
  46. /* Finding of things. */
  47. int area_find_things(Area * self, int x, int y, int w, int h,
  48. void * extra,
  49. int (callback)(Thing * thing, void * extra));
  50. BumpHull * area_add_hull(Area * self, int index, int kind,
  51. int x, int y, int z, int w, int h);
  52. Area * area_delete_hull(Area * self, int index);
  53. Area * area_delete_body(Area * self, int index);
  54. int area_set_thing_hull_flag(Area * me , int index, int flag);
  55. int area_unset_thing_hull_flag(Area * me , int index, int flag);
  56. int area_thing_hull_flags_(Area * me , int index, int flags);
  57. int area_thing_hull_flags(Area * me , int index);
  58. int area_set_hull_flag(Area * me , int index, int flag);
  59. int area_unset_hull_flag(Area * me , int index, int flag);
  60. int area_hull_flags_(Area * me , int index, int flags);
  61. int area_hull_flags(Area * me , int index);
  62. int area_thing_hull_group(Area * me , int index);
  63. int area_thing_hull_group_(Area * me, int index, int group);
  64. void area_update_things(Area * self);
  65. Thing * area_new_thing(Area * self, int kind,
  66. int x, int y, int z, int w, int h);
  67. int area_new_thing_id(Area * self, int kind, int x, int y, int z, int w, int h);
  68. int area_delete_thing(Area * area, int index);
  69. Thing * bumphull_thing(BumpHull * hull);
  70. #ifdef COMMENT_
  71. int thing_track (Tracker * tracker , void * data );
  72. #endif
  73. #endif