object.h 609 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef OBJECT_H_
  2. #define OBJECT_H_
  3. #include <graphx.h>
  4. #include "sprite.h"
  5. typedef struct Scale {
  6. int x;
  7. int y;
  8. } Scale;
  9. typedef struct Object Object;
  10. typedef void (*Object_func)(Object*);
  11. typedef int (*Object_func_int)(Object*);
  12. struct Object {
  13. int id;
  14. int x;
  15. int y;
  16. Scale scale;
  17. Sprite* sprite;
  18. struct Scene* scene;
  19. Object_func_int height;
  20. Object_func_int width;
  21. Object_func draw;
  22. Object_func update;
  23. Object_func load;
  24. Object_func free;
  25. };
  26. void Object_draw(Object* self);
  27. void free_Object(Object* self);
  28. Object* new_Object(int x, int y);
  29. #endif