camera.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #ifndef CAMERA_H
  2. #define CAMERA_H
  3. #include "eruta.h"
  4. #include "inli.h"
  5. /** Forward declaration of structs and types. */
  6. typedef struct Camera_ Camera;
  7. typedef struct Tracker_ Tracker;
  8. typedef struct Panner_ Panner;
  9. typedef struct PannerList_ PannerList;
  10. typedef struct Lockin_ Lockin;
  11. typedef struct LockinList_ LockinList;
  12. /** Flags for the camera. */
  13. enum CameraFlags_ {
  14. /* Camera cannot move at all. */
  15. CAMERA_LOCK = 1 << 1,
  16. /* Camera panning disabled. */
  17. CAMERA_NOPAN = 1 << 2,
  18. /* Camera tracking disabled */
  19. CAMERA_NOTRACK = 1 << 3,
  20. /* Camera lockin disabled. */
  21. CAMERA_NOLOCKIN = 1 << 4,
  22. /* Camera tracking of tracked thing is immediate and locked on to tracked thing.
  23. * Otherwise, the tracking is only applied gradually.
  24. */
  25. CAMERA_TRACKLOCK = 1 << 5
  26. };
  27. /** Panner flags. */
  28. enum PannerFlags_ {
  29. PANNER_ACTIVE = 1 << 1,
  30. PANNER_IMMEDIATE= 1 << 2,
  31. };
  32. /** Lockin Flags. */
  33. enum LockinFlags_ {
  34. LOCKIN_ACTIVE = 1 << 1,
  35. };
  36. int panner_setflag (Panner * self , int flag );
  37. int panner_unsetflag (Panner * self , int flag );
  38. int panner_flag_ (Panner * self , int flag , int set );
  39. int panner_flag (Panner * self , int flag );
  40. Panner * panner_init (Panner * self , Point goal , float speed , int immediate );
  41. Panner * panner_done (Panner * self );
  42. PannerList * pannerlist_new (Point goal , float speed , int immediate );
  43. PannerList * pannerlist_free (PannerList * self );
  44. PannerList * pannerlist_freeall (PannerList * self );
  45. Lockin * lockin_init (Lockin * self , float x , float y , float w , float h );
  46. Lockin * lockin_done (Lockin * self );
  47. LockinList * lockinlist_new (float x , float y , float w , float h );
  48. LockinList * lockinlist_free (LockinList * self );
  49. LockinList * lockinlist_freeall (LockinList * self );
  50. int camera_setflag (Camera * self , int flag );
  51. int camera_unsetflag (Camera * self , int flag );
  52. int camera_flag_ (Camera * self , int flag , int set );
  53. int camera_flag (Camera * self , int flag );
  54. Camera * camera_done (Camera * self );
  55. Camera * camera_free (Camera * self );
  56. Camera * camera_init (Camera * self , float x , float y , float w , float h );
  57. Camera * camera_new (float x , float y , float w , float h );
  58. int camera_panning_p (Camera * self );
  59. int camera_lockin_p (Camera * self );
  60. int camera_tracking_p (Camera * self );
  61. int camera_applylockedtracking (Camera *self );
  62. int camera_applynormaltracking (Camera *self );
  63. int camera_applytracking (Camera *self );
  64. int camera_applypanners (Camera * self );
  65. int camera_applylockins (Camera * self );
  66. Camera * camera_update (Camera * self );
  67. Point camera_at (Camera * self );
  68. Point camera_at_x_ (Camera * self , float x );
  69. Point camera_at_y_ (Camera * self , float y );
  70. Point camera_at_xy_ (Camera * self , float x , float y );
  71. Point camera_at_ (Camera * self , Point at );
  72. float camera_at_x (Camera * self );
  73. float camera_at_y (Camera * self );
  74. float camera_w (Camera * self );
  75. float camera_h (Camera * self );
  76. float camera_br_x (Camera * self );
  77. float camera_br_y (Camera * self );
  78. Point camera_br(Camera * self);
  79. float camera_center_x (Camera * self );
  80. float camera_center_y (Camera * self );
  81. Point camera_center (Camera * self );
  82. Point camera_center_ (Camera * self , Point center );
  83. Point camera_centerdelta_ (Camera * self , Point newcenter , float deltax , float deltay );
  84. Point camera_speed_deltaxy (Camera * self , float dx , float dy );
  85. Point camera_speed_xy_ (Camera * self , float x , float y );
  86. Point camera_speed (Camera * self );
  87. Point camera_speed_ (Camera * self , Point speed );
  88. Camera * camera_debugprint (Camera * self );
  89. Panner * camera_newpanner (Camera * self , Point goal , float speed , int immediate );
  90. Panner * camera_freetoppanner (Camera * self );
  91. void camera_freepanners (Camera * self );
  92. Lockin * camera_newlockin (Camera * self , float x , float y , float w , float h );
  93. Lockin * camera_freetoplockin (Camera * self );
  94. void camera_freelockins (Camera * self );
  95. int camera_cansee (Camera * self , int x , int y , int w , int h );
  96. Point camera_worldtoscreen(Camera * self, Point world_pos);
  97. Point camera_screentoworld(Camera * self, Point screen_pos);
  98. #endif