Restructure things for yaml config management
8
assets/character_sprites.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
animations:
|
||||||
|
- name: run_cycle
|
||||||
|
x_pos: 0
|
||||||
|
y_pos: 0
|
||||||
|
rows: 1
|
||||||
|
cols: 8
|
||||||
|
width: 384
|
||||||
|
height: 48
|
BIN
assets/idle.png
Before Width: | Height: | Size: 1.4 KiB |
BIN
assets/jump.png
Before Width: | Height: | Size: 1021 B |
BIN
assets/land.png
Before Width: | Height: | Size: 1.5 KiB |
BIN
assets/run.png
Before Width: | Height: | Size: 3.2 KiB |
BIN
assets/walk.png
Before Width: | Height: | Size: 2.4 KiB |
BIN
imports/sprites/player/run_cycle/1.png
Normal file
After Width: | Height: | Size: 680 B |
BIN
imports/sprites/player/run_cycle/2.png
Normal file
After Width: | Height: | Size: 669 B |
BIN
imports/sprites/player/run_cycle/3.png
Normal file
After Width: | Height: | Size: 650 B |
BIN
imports/sprites/player/run_cycle/4.png
Normal file
After Width: | Height: | Size: 567 B |
BIN
imports/sprites/player/run_cycle/5.png
Normal file
After Width: | Height: | Size: 665 B |
BIN
imports/sprites/player/run_cycle/6.png
Normal file
After Width: | Height: | Size: 699 B |
BIN
imports/sprites/player/run_cycle/7.png
Normal file
After Width: | Height: | Size: 690 B |
BIN
imports/sprites/player/run_cycle/8.png
Normal file
After Width: | Height: | Size: 532 B |
12
main.c
@ -6,6 +6,7 @@
|
|||||||
#include "cglm/cglm.h"
|
#include "cglm/cglm.h"
|
||||||
#include "lib.h"
|
#include "lib.h"
|
||||||
#include "stb_image.h"
|
#include "stb_image.h"
|
||||||
|
#include "libcyaml/include/cyaml/cyaml.h"
|
||||||
|
|
||||||
#define PI 3.14159f
|
#define PI 3.14159f
|
||||||
|
|
||||||
@ -19,6 +20,17 @@ typedef struct State {
|
|||||||
float py;
|
float py;
|
||||||
} State;
|
} State;
|
||||||
|
|
||||||
|
typedef struct Animation {
|
||||||
|
char* name;
|
||||||
|
u16 x_pos;
|
||||||
|
u16 y_pos;
|
||||||
|
u16 rows;
|
||||||
|
u16 cols;
|
||||||
|
u16 width;
|
||||||
|
u16 height;
|
||||||
|
} SpriteSheet;
|
||||||
|
|
||||||
|
|
||||||
void framebuffer_size_callback(GLFWwindow* window, int width, int height) {
|
void framebuffer_size_callback(GLFWwindow* window, int width, int height) {
|
||||||
(void)window;
|
(void)window;
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
|