💾 Archived View for thrig.me › blog › 2024 › 02 › 29 › animate.h captured on 2024-07-09 at 02:12:23.

View Raw

More Information

⬅️ Previous capture (2024-03-21)

-=-=-=-=-=-=-

// animate.h - headers for a small integer energy system

#include <assert.h>
#include <limits.h>
#include <stdint.h>
#include <stdlib.h>

struct ani;
struct anivec;
typedef int (*ani_update)(struct ani *ent, size_t turn);

typedef struct {
	int xx;
	int yy;
} coord;

struct ani {
	int alive;
	int newbie;
	int disp;
	int energy;
	coord pos;
	ani_update update;
};

struct anivec {
	size_t count;
	struct ani *entry;
};

struct anivec *ani_init(size_t count);
void anivec_update(struct anivec *av, size_t turn);

struct ani *ani_create(struct anivec *av, int disp, int energy, ani_update fn);
void ani_murder(struct ani *ep);