2D Run-and-gun shooter inspired by One Man's Doomsday, Counter-Strike, and Metal Slug.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

41 lines
691 B

  1. #ifndef IZ_POOL_H
  2. #define IZ_POOL_H
  3. #include <SDL_stdinc.h>
  4. #include "../../common/IZ_common.h"
  5. #include "../data/IZ_list.h"
  6. #define POOL_MAX_SIZE (1llu << 23) // 16MB
  7. struct IZ_Pool;
  8. typedef struct {
  9. size_t size;
  10. u64 priority;
  11. u64 timestamp;
  12. } IZ_PoolAllocationArgs;
  13. typedef struct {
  14. void* pointer;
  15. IZ_PoolAllocationArgs args;
  16. struct IZ_Pool* pool;
  17. } IZ_PoolItem;
  18. typedef struct IZ_Pool {
  19. IZ_List items;
  20. u64 next_address;
  21. u64 allocated_memory;
  22. size_t max_size;
  23. void* memory;
  24. } IZ_Pool;
  25. void IZ_PoolInitialize(IZ_Pool*, size_t);
  26. IZ_PoolItem* IZ_PoolAllocate(IZ_Pool*, IZ_PoolAllocationArgs);
  27. void IZ_PoolDeallocate(IZ_PoolItem*);
  28. void IZ_PoolTeardown(IZ_Pool*);
  29. #endif