entity.h 698 B

1234567891011121314151617181920212223242526272829303132333435
  1. #pragma once
  2. #include "game_engine.h"
  3. #include "director.h"
  4. #include <stdlib.h>
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. typedef struct Entity Entity;
  9. typedef struct {
  10. float x;
  11. float y;
  12. } Vector;
  13. #define VECTOR_ZERO ((Vector){0, 0})
  14. typedef struct {
  15. void (*start)(void* context);
  16. void (*stop)(void* context);
  17. void (*update)(Entity* entity, Director* director, void* context);
  18. void (*render)(Entity* entity, Director* director, Canvas* canvas, void* context);
  19. size_t context_size;
  20. } EntityDescription;
  21. Vector entity_pos_get(Entity* entity);
  22. void entity_pos_set(Entity* entity, Vector position);
  23. void* entity_context_get(Entity* entity);
  24. #ifdef __cplusplus
  25. }
  26. #endif