//This code is copyright Andrew Story (Kaslai/Aslai) All rights reserved.
//This and derivative works can be distributed as seen fit,
//so long as this notice remains unchanged and present

#pragma once
#include "global/stdinc.h"
#include "engine/media.h"
#include "engine/types.h"
#include "global/classes.h"

struct Animation{
    CImage img;
    int frames;
    int w;
    int h;
    int origin_x;
    int origin_y;
    char* id;
    int pos;
    Context* parent;
    void draw( int x, int y, int frame );
    Animation( CImage image, Context* prnt, int framecnt, int wid, int hig, int or_x, int or_y, char* ID  );
    ~Animation();
};

extern std::vector<Animation*> animations;
extern std::map<const char*, int, map_char> animation_map;

Animation* animation_add( CImage, Context*, int framecnt, int wid, int hig, int or_x, int or_y, char* ID );
void animation_rem( Animation* );
Animation* animation_get_by_id( char* ID );