41 lines
940 B
C
41 lines
940 B
C
#pragma once
|
|
|
|
#include "raylib.h"
|
|
#include "texture_manager.h"
|
|
#include "utils/arena.h"
|
|
#include "utils/defs.h"
|
|
|
|
typedef struct Animation {
|
|
u8 frame_count;
|
|
u8 current_frame;
|
|
u8 fps;
|
|
float current_time;
|
|
} Animation;
|
|
|
|
typedef struct Sprite {
|
|
Texture2D tex;
|
|
Vector2 anchor;
|
|
Rectangle source;
|
|
Color color;
|
|
Animation* animation;
|
|
} Sprite;
|
|
|
|
Sprite* sprite_from_texture(Texture2D tex,
|
|
Vector2* anchor,
|
|
Rectangle* source,
|
|
Color* color,
|
|
Arena* arena);
|
|
|
|
Sprite* sprite_new(const char* path,
|
|
Vector2* anchor,
|
|
Rectangle* source,
|
|
Color* color,
|
|
Arena* arena,
|
|
TextureManager* tm);
|
|
|
|
void sprite_draw(Sprite* sprite, Vector2 pos);
|
|
|
|
void sprite_free(Sprite* sprite);
|
|
|
|
void animation_update(Animation* a, float dt);
|