2012-07-10 14:28:47 +00:00
|
|
|
#ifndef _PAYSAGES_LAYERS_H_
|
|
|
|
#define _PAYSAGES_LAYERS_H_
|
|
|
|
|
|
|
|
/* Factorized layer management (with names) */
|
|
|
|
|
2013-01-19 22:42:50 +00:00
|
|
|
#include "tools/pack.h"
|
2012-07-10 14:28:47 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef void* (*LayerCallbackCreate)();
|
|
|
|
typedef void (*LayerCallbackDelete)(void* layer);
|
|
|
|
typedef void (*LayerCallbackCopy)(void* source, void* definition);
|
|
|
|
typedef void (*LayerCallbackValidate)(void* layer);
|
|
|
|
typedef void (*LayerCallbackSave)(PackStream* stream, void* layer);
|
|
|
|
typedef void (*LayerCallbackLoad)(PackStream* stream, void* layer);
|
2013-01-19 22:42:50 +00:00
|
|
|
|
2012-07-10 14:28:47 +00:00
|
|
|
typedef struct {
|
|
|
|
LayerCallbackCreate callback_create;
|
|
|
|
LayerCallbackDelete callback_delete;
|
|
|
|
LayerCallbackCopy callback_copy;
|
|
|
|
LayerCallbackValidate callback_validate;
|
|
|
|
LayerCallbackSave callback_save;
|
|
|
|
LayerCallbackLoad callback_load;
|
|
|
|
} LayerType;
|
|
|
|
|
|
|
|
typedef struct Layers Layers;
|
|
|
|
|
|
|
|
Layers* layersCreate(LayerType type, int max_layer_count);
|
2012-07-10 20:00:44 +00:00
|
|
|
Layers* layersCreateCopy(Layers* original);
|
2012-07-10 14:28:47 +00:00
|
|
|
void layersDelete(Layers* layers);
|
|
|
|
|
|
|
|
void layersCopy(Layers* source, Layers* destination);
|
|
|
|
void layersValidate(Layers* layers);
|
|
|
|
|
|
|
|
void layersSave(PackStream* stream, Layers* layers);
|
|
|
|
void layersLoad(PackStream* stream, Layers* layers);
|
|
|
|
|
|
|
|
const char* layersGetName(Layers* layers, int layer);
|
|
|
|
void layersSetName(Layers* layers, int layer, const char* name);
|
|
|
|
|
2013-01-30 14:30:06 +00:00
|
|
|
void layersClear(Layers* layers);
|
2012-07-10 14:28:47 +00:00
|
|
|
int layersCount(Layers* layers);
|
|
|
|
void* layersGetLayer(Layers* layers, int layer);
|
|
|
|
int layersAddLayer(Layers* layers, void* definition);
|
|
|
|
void layersDeleteLayer(Layers* layers, int layer);
|
|
|
|
void layersMove(Layers* layers, int layer, int new_position);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|