2023-01-04 18:15:32 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Export.h"
|
|
|
|
#include "ColorText.h"
|
|
|
|
|
2023-05-22 16:07:19 -06:00
|
|
|
struct SDL_Surface;
|
|
|
|
struct SDL_Rect;
|
|
|
|
struct SDL_PixelFormat;
|
2023-09-20 23:10:52 -06:00
|
|
|
struct SDL_Window;
|
2023-05-22 16:07:19 -06:00
|
|
|
union SDL_Event;
|
|
|
|
|
2023-01-04 18:15:32 -07:00
|
|
|
namespace DFHack
|
|
|
|
{
|
|
|
|
struct DFTileSurface
|
|
|
|
{
|
|
|
|
bool paintOver; // draw over original tile?
|
2023-05-22 16:07:19 -06:00
|
|
|
SDL_Surface* surface; // from where it should be drawn
|
|
|
|
SDL_Rect* rect; // from which coords (NULL to draw whole surface)
|
|
|
|
SDL_Rect* dstResize; // if not NULL dst rect will be resized (x/y/w/h will be added to original dst)
|
2023-01-04 18:15:32 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The DFSDL module - provides access to SDL functions without actually
|
|
|
|
* requiring build-time linkage to SDL
|
|
|
|
* \ingroup grp_modules
|
|
|
|
* \ingroup grp_dfsdl
|
|
|
|
*/
|
|
|
|
namespace DFSDL
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Call this on DFHack init so we can load the SDL functions. Returns false on
|
|
|
|
* failure.
|
|
|
|
*/
|
|
|
|
bool init(DFHack::color_ostream &out);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Call this when DFHack is being unloaded.
|
|
|
|
*/
|
|
|
|
void cleanup();
|
|
|
|
|
2023-05-22 16:07:19 -06:00
|
|
|
DFHACK_EXPORT SDL_Surface * DFIMG_Load(const char *file);
|
|
|
|
DFHACK_EXPORT SDL_Surface * DFSDL_CreateRGBSurface(uint32_t flags, int width, int height, int depth, uint32_t Rmask, uint32_t Gmask, uint32_t Bmask, uint32_t Amask);
|
|
|
|
DFHACK_EXPORT SDL_Surface * DFSDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, uint32_t Rmask, uint32_t Gmask, uint32_t Bmask, uint32_t Amask);
|
|
|
|
DFHACK_EXPORT int DFSDL_UpperBlit(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect);
|
|
|
|
DFHACK_EXPORT SDL_Surface * DFSDL_ConvertSurface(SDL_Surface *src, const SDL_PixelFormat *fmt, uint32_t flags);
|
|
|
|
DFHACK_EXPORT void DFSDL_FreeSurface(SDL_Surface *surface);
|
|
|
|
// DFHACK_EXPORT int DFSDL_SemWait(SDL_sem *sem);
|
|
|
|
// DFHACK_EXPORT int DFSDL_SemPost(SDL_sem *sem);
|
|
|
|
DFHACK_EXPORT int DFSDL_PushEvent(SDL_Event *event);
|
2023-07-05 13:08:18 -06:00
|
|
|
DFHACK_EXPORT void DFSDL_free(void *ptr);
|
2023-08-28 01:00:39 -06:00
|
|
|
DFHACK_EXPORT SDL_PixelFormat* DFSDL_AllocFormat(uint32_t pixel_format);
|
|
|
|
DFHACK_EXPORT SDL_Surface* DFSDL_CreateRGBSurfaceWithFormat(uint32_t flags, int width, int height, int depth, uint32_t format);
|
2023-09-20 23:10:52 -06:00
|
|
|
DFHACK_EXPORT int DFSDL_ShowSimpleMessageBox(uint32_t flags, const char *title, const char *message, SDL_Window *window);
|
2023-01-04 18:15:32 -07:00
|
|
|
|
2023-07-03 12:05:58 -06:00
|
|
|
// submitted and returned text is UTF-8
|
2023-07-05 13:08:18 -06:00
|
|
|
// see wrapper functions below for cp-437 variants
|
|
|
|
DFHACK_EXPORT char * DFSDL_GetClipboardText();
|
|
|
|
DFHACK_EXPORT int DFSDL_SetClipboardText(const char *text);
|
2023-07-02 19:04:06 -06:00
|
|
|
|
2023-01-04 18:15:32 -07:00
|
|
|
}
|
|
|
|
|
2023-07-05 13:08:18 -06:00
|
|
|
// System clipboard -- submitted and returned text must be in CP437
|
|
|
|
DFHACK_EXPORT std::string getClipboardTextCp437();
|
|
|
|
DFHACK_EXPORT bool setClipboardTextCp437(std::string text);
|
|
|
|
|
2023-01-04 18:15:32 -07:00
|
|
|
}
|