working on adding a entity workflow
This commit is contained in:
52
source/game_source/entity.h
Normal file
52
source/game_source/entity.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#ifndef ENTITY_H
|
||||
#define ENTITY_H
|
||||
#include "vector.h"
|
||||
#include "tile.h"
|
||||
|
||||
typedef int(*entity_func)(void*);
|
||||
typedef int(*entity_update_func)(int, void*);
|
||||
|
||||
// Entity network transaction.
|
||||
typedef struct {
|
||||
int id;
|
||||
int action;
|
||||
int userdataSize;
|
||||
void* userdata;
|
||||
} entity_transaction;
|
||||
|
||||
// Entity Callbacks
|
||||
typedef struct {
|
||||
entity_func init;
|
||||
entity_update_func update;
|
||||
entity_func free;
|
||||
} entity_callbacks;
|
||||
|
||||
// Entity Struct
|
||||
typedef struct {
|
||||
int id;
|
||||
const char* name;
|
||||
const char* description;
|
||||
tile tile;
|
||||
vec2 position;
|
||||
void* userdata;
|
||||
entity_callbacks callback;
|
||||
entity_transaction ta;
|
||||
} entity;
|
||||
|
||||
entity* CreateEntity(const char* name, const char* description);
|
||||
int EntityAddCallbacks(entity* e, entity_callbacks cb);
|
||||
int EntitySetUserdat(entity* e, void* userdata);
|
||||
|
||||
// Gets
|
||||
const char* GetEntityDescription(entity* e);
|
||||
const char* GetEntityName(entity* e);
|
||||
|
||||
// Entity minipulation
|
||||
int EntityInit(entity* e);
|
||||
int EntityUpdate(entity* e, int action, void* userdata);
|
||||
int EntityFree(entity* e);
|
||||
|
||||
// Network
|
||||
int EntityTransaction(entity* e);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user