Get texturepacking working again
1
.gitignore
vendored
@ -3,3 +3,4 @@
|
|||||||
main
|
main
|
||||||
/*.png
|
/*.png
|
||||||
/texturepacker
|
/texturepacker
|
||||||
|
/texpack
|
||||||
|
2
Makefile
@ -12,7 +12,7 @@ build: clean
|
|||||||
|
|
||||||
.PHONY: texpack
|
.PHONY: texpack
|
||||||
texpack:
|
texpack:
|
||||||
$(CC) $(CFLAGS) -lSDL2 -lm -lcyaml -L objs/ $(INCLUDES) tools/texturepacker.c -o texpack
|
$(CC) $(CFLAGS) -lSDL2 -lm -L objs/ $(INCLUDES) tools/texturepacker.c -o texpack
|
||||||
|
|
||||||
.PHONY: run
|
.PHONY: run
|
||||||
run: build
|
run: build
|
||||||
|
BIN
imports/sprites/player/idle.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
imports/sprites/player/jump.png
Normal file
After Width: | Height: | Size: 1021 B |
BIN
imports/sprites/player/land.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
imports/sprites/player/run.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 680 B |
Before Width: | Height: | Size: 669 B |
Before Width: | Height: | Size: 650 B |
Before Width: | Height: | Size: 567 B |
Before Width: | Height: | Size: 665 B |
Before Width: | Height: | Size: 699 B |
Before Width: | Height: | Size: 690 B |
Before Width: | Height: | Size: 532 B |
@ -13,7 +13,7 @@
|
|||||||
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||||
#include "stb_image_write.h"
|
#include "stb_image_write.h"
|
||||||
|
|
||||||
#include "../libs/libcyaml/include/cyaml/cyaml.h"
|
// #include "../libs/libcyaml/include/cyaml/cyaml.h"
|
||||||
|
|
||||||
typedef struct Image {
|
typedef struct Image {
|
||||||
char* filename;
|
char* filename;
|
||||||
@ -99,11 +99,7 @@ void writeToAtlas(Image images[],
|
|||||||
int buf_idx = (buf_row * maxw + buf_col) * channels;
|
int buf_idx = (buf_row * maxw + buf_col) * channels;
|
||||||
int img_idx = (img_row * rect.w + img_col) * channels;
|
int img_idx = (img_row * rect.w + img_col) * channels;
|
||||||
for (int j = 0; j < channels; j++) {
|
for (int j = 0; j < channels; j++) {
|
||||||
if (images[i].imageData[img_idx + 3] != 0) {
|
|
||||||
buf[buf_idx + j] = images[i].imageData[img_idx + j];
|
buf[buf_idx + j] = images[i].imageData[img_idx + j];
|
||||||
} else {
|
|
||||||
buf[buf_idx + 3] = 0xFF;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
img_col++; buf_col++;
|
img_col++; buf_col++;
|
||||||
if (img_col >= rect.w) {
|
if (img_col >= rect.w) {
|
||||||
|