Source:NetHack 5.0.0/include/tileset.h
Jump to navigation
Jump to search
Below is the full text to tileset.h from the source code of NetHack 5.0.0. To link to a particular line, write [[Source:NetHack 5.0.0/include/tileset.h#line12]], for example.
The NetHack General Public License applies to screenshots, source code and other content from NetHack.
This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.
1. /* NetHack 5.0 tileset.h $NHDT-Date: 1596498564 2020/08/03 23:49:24 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.2 $ */ 2. /* Copyright (c) Ray Chason, 2016. */ 3. /* NetHack may be freely redistributed. See license for details. */ 4. 5. #ifndef TILESET_H 6. #define TILESET_H 7. 8. struct Pixel { 9. unsigned char r, g, b, a; 10. }; 11. 12. struct TileImage { 13. /* Image data */ 14. unsigned width, height; 15. struct Pixel *pixels; /* for direct color */ 16. unsigned char *indexes; /* for paletted images */ 17. }; 18. 19. boolean read_tiles(const char *filename, boolean true_color); 20. const struct Pixel *get_palette(void); 21. void set_tile_type(boolean true_color); 22. void free_tiles(void); 23. const struct TileImage *get_tile(unsigned tile_index); 24. 25. /* For resizing tiles */ 26. struct TileImage *stretch_tile(const struct TileImage *, unsigned, 27. unsigned); 28. void free_tile(struct TileImage *); 29. 30. /* Used internally by the tile set code */ 31. struct TileSetImage { 32. /* Image data */ 33. unsigned width, height; 34. struct Pixel *pixels; /* for direct color */ 35. unsigned char *indexes; /* for paletted images */ 36. struct Pixel palette[256]; 37. 38. /* Image description from the file */ 39. char *image_desc; 40. 41. /* Tile dimensions */ 42. unsigned tile_width, tile_height; 43. }; 44. 45. boolean read_bmp_tiles(const char *filename, struct TileSetImage *image); 46. boolean read_gif_tiles(const char *filename, struct TileSetImage *image); 47. boolean read_png_tiles(const char *filename, struct TileSetImage *image); 48. 49. #endif