Files
Pokemon-Firered/tools/gbagfx/gfx.h
T
PikalaxALT d141011e7f Track tools
2018-12-20 20:43:40 -05:00

54 lines
1.2 KiB
C

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