Get texturepacking working again

This commit is contained in:
Joseph Ferano 2023-10-25 19:49:52 +07:00
parent ad815adc9f
commit e1e41654e6
15 changed files with 4 additions and 7 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
main main
/*.png /*.png
/texturepacker /texturepacker
/texpack

View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1021 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 680 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 669 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 567 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 665 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 699 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 690 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 532 B

View File

@ -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) {