2023-01-03 02:01:30 -07:00
|
|
|
#pragma once
|
|
|
|
|
2023-08-11 12:40:41 -06:00
|
|
|
#include <string>
|
2023-08-12 07:11:42 -06:00
|
|
|
#include <vector>
|
2023-08-11 00:14:05 -06:00
|
|
|
|
2023-01-03 02:01:30 -07:00
|
|
|
#include "ColorText.h"
|
2023-08-12 07:11:42 -06:00
|
|
|
#include "Export.h"
|
2023-01-03 02:01:30 -07:00
|
|
|
|
2023-08-11 00:14:05 -06:00
|
|
|
#include <SDL_surface.h>
|
|
|
|
|
2023-08-11 12:40:41 -06:00
|
|
|
typedef typename void* TexposHandle;
|
2023-08-11 00:14:05 -06:00
|
|
|
|
2023-01-03 02:01:30 -07:00
|
|
|
namespace DFHack {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The Textures module - loads and provides access to DFHack textures
|
|
|
|
* \ingroup grp_modules
|
|
|
|
* \ingroup grp_textures
|
|
|
|
*/
|
|
|
|
namespace Textures {
|
|
|
|
|
2023-08-11 00:14:05 -06:00
|
|
|
/**
|
|
|
|
* Load texture and get handle.
|
|
|
|
* Keep it to obtain valid texpos.
|
|
|
|
*/
|
|
|
|
DFHACK_EXPORT TexposHandle loadTexture(SDL_Surface* surface);
|
|
|
|
|
2023-08-11 12:40:41 -06:00
|
|
|
/**
|
|
|
|
* Load tileset from image file.
|
|
|
|
* Return vector of handles to obtain valid texposes.
|
|
|
|
*/
|
2023-08-12 07:11:42 -06:00
|
|
|
DFHACK_EXPORT std::vector<TexposHandle> loadTileset(const std::string& file, int tile_px_w,
|
|
|
|
int tile_px_h);
|
2023-08-11 12:40:41 -06:00
|
|
|
|
2023-08-11 00:14:05 -06:00
|
|
|
/**
|
|
|
|
* Get texpos by handle.
|
|
|
|
* Always use this function, if you need to get valid texpos for your texure.
|
|
|
|
* Texpos can change on game textures reset, but handle will be the same.
|
|
|
|
*/
|
2023-08-11 12:40:41 -06:00
|
|
|
DFHACK_EXPORT long getTexposByHandle(TexposHandle handle);
|
2023-08-11 00:14:05 -06:00
|
|
|
|
2023-01-03 02:01:30 -07:00
|
|
|
/**
|
2023-08-12 07:11:42 -06:00
|
|
|
* Get texpos for static asset with index in tileset.
|
2023-01-03 02:01:30 -07:00
|
|
|
*/
|
2023-08-12 07:11:42 -06:00
|
|
|
DFHACK_EXPORT long getAsset(const std::string asset, size_t index = 0);
|
2023-08-11 12:40:41 -06:00
|
|
|
|
|
|
|
/**
|
2023-08-12 07:11:42 -06:00
|
|
|
* Call this on DFHack init just once to setup interposed handlers and
|
|
|
|
* init static assets.
|
2023-08-11 12:40:41 -06:00
|
|
|
*/
|
2023-08-12 07:11:42 -06:00
|
|
|
void init(DFHack::color_ostream& out);
|
2023-01-03 02:01:30 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Call this when DFHack is being unloaded.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void cleanup();
|
|
|
|
|
2023-08-12 07:11:42 -06:00
|
|
|
} // namespace Textures
|
|
|
|
} // namespace DFHack
|