dfhack/library/include/modules/Textures.h

106 lines
2.5 KiB
C

#pragma once
2023-08-11 12:40:41 -06:00
#include <vector>
#include <string>
2023-08-11 00:14:05 -06:00
#include "Export.h"
#include "ColorText.h"
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
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.
*/
DFHACK_EXPORT std::vector<TexposHandle> loadTileset(const std::string& file, int tile_px_w, int tile_px_h);
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
/**
* Call this on DFHack init and on every viewscreen change so we can reload
* and reindex textures as needed.
*/
2023-08-11 12:40:41 -06:00
void init(DFHack::color_ostream& out);
/**
* Call this on DFHack init just once to setup interposed handlers.
*/
void initDynamic(DFHack::color_ostream& out);
/**
* Call this when DFHack is being unloaded.
*
*/
void cleanup();
/**
* Get first texpos for the DFHack logo. This texpos and the next 11 make up the
* 4x3 grid of logo textures that can be displayed on the UI layer.
*/
DFHACK_EXPORT long getDfhackLogoTexposStart();
/**
* Get the first texpos for the UI pin tiles. Each are 2x2 grids.
*/
DFHACK_EXPORT long getGreenPinTexposStart();
DFHACK_EXPORT long getRedPinTexposStart();
/**
* Get the first texpos for the DFHack icons. It's a 5x2 grid.
*/
DFHACK_EXPORT long getIconsTexposStart();
/**
* Get the first texpos for the on and off icons. It's a 2x1 grid.
*/
DFHACK_EXPORT long getOnOffTexposStart();
/**
* Get the first texpos for the pathable 32x32 sprites. It's a 2x1 grid.
*/
2023-06-18 01:22:30 -06:00
DFHACK_EXPORT long getMapPathableTexposStart();
2023-06-18 01:55:55 -06:00
/**
2023-07-31 18:20:38 -06:00
* Get the first texpos for the unsuspend 32x32 sprites. It's a 5x1 grid.
2023-06-18 01:55:55 -06:00
*/
DFHACK_EXPORT long getMapUnsuspendTexposStart();
2023-02-01 00:52:30 -07:00
/**
* Get the first texpos for the control panel icons. 10x2 grid.
*/
DFHACK_EXPORT long getControlPanelTexposStart();
/**
* Get the first texpos for the DFHack borders. Each is a 7x3 grid.
*/
DFHACK_EXPORT long getThinBordersTexposStart();
DFHACK_EXPORT long getMediumBordersTexposStart();
DFHACK_EXPORT long getBoldBordersTexposStart();
DFHACK_EXPORT long getPanelBordersTexposStart();
DFHACK_EXPORT long getWindowBordersTexposStart();
}
2023-08-11 00:50:51 -06:00
}