2018-02-06 07:19:25 +01:00
|
|
|
/*
|
|
|
|
* This software is licensed under the terms of the MIT-License
|
|
|
|
* See COPYING for further information.
|
|
|
|
* ---
|
|
|
|
* Copyright (c) 2011-2018, Lukas Weber <laochailan@web.de>.
|
|
|
|
* Copyright (c) 2012-2018, Andrei Alexeyev <akari@alienslab.net>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "taisei.h"
|
|
|
|
|
2018-04-12 16:08:48 +02:00
|
|
|
#include "resource.h"
|
2018-02-06 07:19:25 +01:00
|
|
|
#include "texture.h"
|
|
|
|
|
|
|
|
typedef struct Sprite {
|
|
|
|
Texture *tex;
|
|
|
|
FloatRect tex_area;
|
|
|
|
float w;
|
|
|
|
float h;
|
|
|
|
} Sprite;
|
|
|
|
|
|
|
|
char* sprite_path(const char *name);
|
2018-04-12 16:08:48 +02:00
|
|
|
void* load_sprite_begin(const char *path, uint flags);
|
|
|
|
void* load_sprite_end(void *opaque, const char *path, uint flags);
|
2018-02-06 07:19:25 +01:00
|
|
|
bool check_sprite_path(const char *path);
|
|
|
|
|
|
|
|
void draw_sprite(float x, float y, const char *name);
|
|
|
|
void draw_sprite_p(float x, float y, Sprite *spr);
|
2018-04-12 16:08:48 +02:00
|
|
|
void draw_sprite_batched(float x, float y, const char *name);
|
|
|
|
void draw_sprite_batched_p(float x, float y, Sprite *spr);
|
|
|
|
void draw_sprite_ex(float x, float y, float scale_x, float scale_y, bool batched, Sprite *spr);
|
2018-02-06 07:19:25 +01:00
|
|
|
|
2018-04-12 16:08:48 +02:00
|
|
|
void begin_draw_sprite(float x, float y, float scale_x, float scale_y, Sprite *spr);
|
2018-02-06 07:19:25 +01:00
|
|
|
void end_draw_sprite(void);
|
|
|
|
|
|
|
|
Sprite* get_sprite(const char *name);
|
|
|
|
Sprite* prefix_get_sprite(const char *name, const char *prefix);
|
|
|
|
|
2018-04-12 16:08:48 +02:00
|
|
|
extern ResourceHandler sprite_res_handler;
|
|
|
|
|
2018-02-06 07:19:25 +01:00
|
|
|
#define SPRITE_PATH_PREFIX "res/gfx/"
|
|
|
|
#define SPRITE_EXTENSION ".spr"
|