Skip to content

Commit c77f478

Browse files
committed
DFSDL: support lots more SDL
1 parent 9307ad5 commit c77f478

File tree

2 files changed

+344
-25
lines changed

2 files changed

+344
-25
lines changed

library/include/modules/DFSDL.h

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,23 @@
22

33
#include "Export.h"
44
#include "ColorText.h"
5-
5+
// Fix Clang complaining of missing uint32_t type
6+
#include <cstdint>
67
#include <vector>
78

9+
#include <SDL_blendmode.h>
10+
#include <SDL_keycode.h>
11+
812
struct SDL_Surface;
913
struct SDL_Rect;
14+
struct SDL_Renderer;
1015
struct SDL_PixelFormat;
1116
struct SDL_Window;
17+
struct SDL_Texture;
18+
struct SDL_Point;
19+
1220
union SDL_Event;
21+
typedef int (*SDL_EventFilter)(void* userdata, SDL_Event* event);
1322

1423
namespace DFHack
1524
{
@@ -41,6 +50,8 @@ bool init(DFHack::color_ostream &out);
4150
*/
4251
void cleanup();
4352

53+
DFHACK_EXPORT void * lookup_DFSDL_Symbol(const char *name);
54+
DFHACK_EXPORT void * lookup_DFIMG_Symbol(const char *name);
4455
DFHACK_EXPORT SDL_Surface * DFIMG_Load(const char *file);
4556
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);
4657
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);
@@ -55,6 +66,52 @@ DFHACK_EXPORT SDL_PixelFormat* DFSDL_AllocFormat(uint32_t pixel_format);
5566
DFHACK_EXPORT SDL_Surface* DFSDL_CreateRGBSurfaceWithFormat(uint32_t flags, int width, int height, int depth, uint32_t format);
5667
DFHACK_EXPORT int DFSDL_ShowSimpleMessageBox(uint32_t flags, const char *title, const char *message, SDL_Window *window);
5768

69+
DFHACK_EXPORT SDL_Surface* DFSDL_ConvertSurfaceFormat(SDL_Surface* surface, uint32_t format, uint32_t flags);
70+
DFHACK_EXPORT SDL_Renderer* DFSDL_CreateRenderer(SDL_Window* window, int index, uint32_t flags);
71+
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);
72+
DFHACK_EXPORT SDL_Texture* DFSDL_CreateTexture(SDL_Renderer* renderer, uint32_t format, int access, int w, int h);
73+
DFHACK_EXPORT SDL_Texture* DFSDL_CreateTextureFromSurface(SDL_Renderer* renderer, SDL_Surface* surface);
74+
DFHACK_EXPORT SDL_Window* DFSDL_CreateWindow(const char* title, int x, int y, int w, int h, uint32_t flags);
75+
DFHACK_EXPORT void DFSDL_DestroyRenderer(SDL_Renderer* renderer);
76+
DFHACK_EXPORT void DFSDL_DestroyTexture(SDL_Texture* texture);
77+
DFHACK_EXPORT void DFSDL_DestroyWindow(SDL_Window* window);
78+
DFHACK_EXPORT void DFSDL_free(void* mem);
79+
DFHACK_EXPORT void DFSDL_FreeSurface(SDL_Surface* surface);
80+
DFHACK_EXPORT char* DFSDL_GetClipboardText(void);
81+
DFHACK_EXPORT const char* DFSDL_GetError(void);
82+
DFHACK_EXPORT SDL_bool DFSDL_GetEventFilter(SDL_EventFilter* filter, void** userdata);
83+
DFHACK_EXPORT SDL_Keymod DFSDL_GetModState(void);
84+
DFHACK_EXPORT int DFSDL_GetRendererOutputSize(SDL_Renderer* renderer, int* w, int* h);
85+
DFHACK_EXPORT uint32_t DFSDL_GetWindowFlags(SDL_Window* window);
86+
DFHACK_EXPORT uint32_t DFSDL_GetWindowID(SDL_Window* window);
87+
DFHACK_EXPORT void DFSDL_HideWindow(SDL_Window* window);
88+
DFHACK_EXPORT char* DFSDL_iconv_string(const char* tocode, const char* fromcode, const char* inbuf, size_t inbytesleft);
89+
DFHACK_EXPORT int DFSDL_InitSubSystem(uint32_t flags);
90+
DFHACK_EXPORT uint32_t DFSDL_MapRGB(const SDL_PixelFormat* format, uint8_t r, uint8_t g, uint8_t b);
91+
DFHACK_EXPORT void* DFSDL_memset(void* dst, int c, size_t len);
92+
DFHACK_EXPORT int DFSDL_RenderClear(SDL_Renderer* renderer);
93+
DFHACK_EXPORT int DFSDL_RenderCopy(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* srcrect, const SDL_Rect* dstrect);
94+
DFHACK_EXPORT int DFSDL_RenderDrawRect(SDL_Renderer* renderer, const SDL_Rect* rect);
95+
DFHACK_EXPORT int DFSDL_RenderFillRect(SDL_Renderer* renderer, const SDL_Rect* rect);
96+
DFHACK_EXPORT void DFSDL_RenderPresent(SDL_Renderer* renderer);
97+
DFHACK_EXPORT int DFSDL_RenderSetIntegerScale(SDL_Renderer* renderer, SDL_bool enable);
98+
DFHACK_EXPORT int DFSDL_RenderSetViewport(SDL_Renderer* renderer, const SDL_Rect* rect);
99+
DFHACK_EXPORT SDL_bool DFSDL_PointInRect(const SDL_Point* p, const SDL_Rect* r);
100+
DFHACK_EXPORT int DFSDL_SetClipboardText(const char* text);
101+
DFHACK_EXPORT int DFSDL_SetColorKey(SDL_Surface* surface, int flag, uint32_t key);
102+
DFHACK_EXPORT void DFSDL_SetEventFilter(SDL_EventFilter filter, void* userdata);
103+
DFHACK_EXPORT SDL_bool DFSDL_SetHint(const char* name, const char* value);
104+
DFHACK_EXPORT int DFSDL_SetRenderDrawColor(SDL_Renderer* renderer, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
105+
DFHACK_EXPORT int DFSDL_SetTextureBlendMode(SDL_Texture* texture, SDL_BlendMode blendMode);
106+
DFHACK_EXPORT int DFSDL_SetTextureColorMod(SDL_Texture* texture, uint8_t r, uint8_t g, uint8_t b);
107+
DFHACK_EXPORT void DFSDL_SetWindowMinimumSize(SDL_Window* window, int min_w, int min_h);
108+
DFHACK_EXPORT void DFSDL_ShowWindow(SDL_Window* window);
109+
DFHACK_EXPORT void DFSDL_StartTextInput(void);
110+
DFHACK_EXPORT void DFSDL_StopTextInput(void);
111+
DFHACK_EXPORT int DFSDL_UpperBlit(SDL_Surface* src, const SDL_Rect* srcrect, SDL_Surface* dst, SDL_Rect* dstrect);
112+
DFHACK_EXPORT int DFSDL_UpdateTexture(SDL_Texture* texture, const SDL_Rect* rect, const void* pixels, int pitch);
113+
DFHACK_EXPORT void DFSDL_QuitSubSystem(uint32_t flags);
114+
58115
// submitted and returned text is UTF-8
59116
// see wrapper functions below for cp-437 variants
60117
DFHACK_EXPORT char * DFSDL_GetClipboardText();

0 commit comments

Comments
 (0)