taisei/src/resource/animation.h

42 lines
1.2 KiB
C
Raw Normal View History

/*
* This software is licensed under the terms of the MIT-License
* See COPYING for further information.
* ---
2018-01-04 18:14:31 +01:00
* Copyright (c) 2011-2018, Lukas Weber <laochailan@web.de>.
* Copyright (c) 2012-2018, Andrei Alexeyev <akari@alienslab.net>.
*/
2017-09-27 14:14:53 +02:00
#pragma once
#include "taisei.h"
#include "sprite.h"
struct Animation;
typedef struct Animation {
// i'm emulating lao's fixed rows/cols table system,
// even though animations could have arbitrarily sized framegroups now.
// i just don't want to rewrite the whole animation system from scratch.
// be my guest if you want to try and do this the right way.
int rows;
int cols;
int speed;
Sprite **frames;
} Animation;
char* animation_path(const char *name);
bool check_animation_path(const char *path);
2017-03-13 06:44:39 +01:00
void* load_animation_begin(const char *filename, unsigned int flags);
void* load_animation_end(void *opaque, const char *filename, unsigned int flags);
void unload_animation(void *vani);
2017-02-28 18:47:47 +01:00
Animation *get_ani(const char *name);
2017-10-03 17:25:38 +02:00
void draw_animation(float x, float y, int col, int row, const char *name);
void draw_animation_p(float x, float y, int col, int row, Animation *ani);
#define ANI_PATH_PREFIX TEX_PATH_PREFIX
#define ANI_EXTENSION ".ani"