diff options
author | Swastik Baranwal <swstkbaranwal@gmail.com> | 2018-12-27 16:00:22 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-27 16:00:22 +0530 |
commit | 95c3652551aacf612a19336e17ce00a2ec1046d2 (patch) | |
tree | 882caaf9875700cccb73e391a7a014a782e579fa /tools/gbagfx/gfx.h | |
parent | 2ed26ab8fcd4e302ab4aac6bb01dba7b5c985914 (diff) | |
parent | d5de7960a330953b3a7d7684122997c0d8aedcf1 (diff) |
Merge pull request #2 from pret/master
Taking files
Diffstat (limited to 'tools/gbagfx/gfx.h')
-rw-r--r-- | tools/gbagfx/gfx.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tools/gbagfx/gfx.h b/tools/gbagfx/gfx.h new file mode 100644 index 000000000..15a3c6a6c --- /dev/null +++ b/tools/gbagfx/gfx.h @@ -0,0 +1,53 @@ +// Copyright (c) 2015 YamaArashi + +#ifndef GFX_H +#define GFX_H + +#include <stdint.h> +#include <stdbool.h> + +struct Color { + unsigned char red; + unsigned char green; + unsigned char blue; +}; + +struct Palette { + struct Color colors[256]; + int numColors; +}; + +struct __attribute__((packed)) Tile { + unsigned short index:10; + unsigned short xflip:1; + unsigned short yflip:1; + unsigned short palno:4; +}; + +struct Tilemap { + struct Tile *data; + int numTiles; +}; + +struct Image { + int width; + int height; + int bitDepth; + unsigned char *pixels; + bool hasPalette; + struct Palette palette; + bool hasTransparency; + struct Tilemap tileMap; + bool hasTilemap; + +}; + +void ReadImage(char *path, int tilesWidth, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors); +void WriteImage(char *path, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors); +void FreeImage(struct Image *image); +void ReadGbaPalette(char *path, struct Palette *palette); +void WriteGbaPalette(char *path, struct Palette *palette); +void ReadGbaTilemap(char *path, struct Tilemap *tileMap); +void WriteGbaTilemap(char *path, struct Tilemap *tileMap); + +#endif // GFX_H |