Initial commit
This commit is contained in:
49
src/game/sprites.h
Normal file
49
src/game/sprites.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef JNR_SPRITES_H
|
||||
#define JNR_SPRITES_H
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "engine/animation.h"
|
||||
|
||||
/* Sprite sheet layout:
|
||||
* Each sprite cell is 16x16 pixels.
|
||||
* The sheet is organized in rows:
|
||||
*
|
||||
* Row 0: Player idle (2 frames), run (4 frames), jump (1), fall (1)
|
||||
* Row 1: Grunt idle (2 frames), walk (4 frames), death (2 frames)
|
||||
* Row 2: Flyer idle (2 frames), fly (4 frames), death (2 frames)
|
||||
* Row 3: Projectiles: bullet (2 frames), impact (3 frames), enemy bullet (2)
|
||||
*/
|
||||
|
||||
#define SPRITE_CELL 16
|
||||
|
||||
/* Generate the spritesheet texture (call after renderer is ready) */
|
||||
SDL_Texture *sprites_generate(SDL_Renderer *renderer);
|
||||
|
||||
/* ── Player animations ─────────────────────────── */
|
||||
extern AnimDef anim_player_idle;
|
||||
extern AnimDef anim_player_run;
|
||||
extern AnimDef anim_player_jump;
|
||||
extern AnimDef anim_player_fall;
|
||||
|
||||
/* ── Grunt animations ──────────────────────────── */
|
||||
extern AnimDef anim_grunt_idle;
|
||||
extern AnimDef anim_grunt_walk;
|
||||
extern AnimDef anim_grunt_death;
|
||||
|
||||
/* ── Flyer animations ──────────────────────────── */
|
||||
extern AnimDef anim_flyer_idle;
|
||||
extern AnimDef anim_flyer_fly;
|
||||
extern AnimDef anim_flyer_death;
|
||||
|
||||
/* ── Projectile animations ─────────────────────── */
|
||||
extern AnimDef anim_bullet;
|
||||
extern AnimDef anim_bullet_impact;
|
||||
extern AnimDef anim_enemy_bullet;
|
||||
|
||||
/* Initialize all animation definitions */
|
||||
void sprites_init_anims(void);
|
||||
|
||||
/* The global spritesheet texture */
|
||||
extern SDL_Texture *g_spritesheet;
|
||||
|
||||
#endif /* JNR_SPRITES_H */
|
||||
Reference in New Issue
Block a user