Add "DrawTexture" function to overlay hook

This commit is contained in:
Maschell 2019-03-01 19:15:31 +01:00
parent 6a775c1f89
commit 94fe01eaf7
2 changed files with 14 additions and 1 deletions

View File

@ -27,10 +27,12 @@ void OSScreenPutPixelEx(uint32_t bufferNum, uint32_t posX, uint32_t posY, uint32
static OverlayOpenFunction overlayfunction_ptr __attribute__((section(".data"))) = NULL;
static ConvertTextureFunction textureconvertfunction_ptr __attribute__((section(".data"))) = NULL;
static DrawTextureFunction drawtexturefunction_ptr __attribute__((section(".data"))) = NULL;
void WUPS_InitOverlay(wups_loader_init_overlay_args_t args) {
overlayfunction_ptr = args.overlayfunction_ptr;
textureconvertfunction_ptr = args.textureconvertfunction_ptr;
drawtexturefunction_ptr = args.drawtexturefunction_ptr;
}
void WUPS_Overlay_PrintTextOnScreen(wups_overlay_options_type_t screen, int x,int y, const char * msg, ...) {
@ -93,6 +95,13 @@ bool WUPS_ConvertImageToTexture(const uint8_t *img, int32_t imgSize, void * text
}
return false;
}
void WUPS_DrawTexture(void * texture, void * sampler, float x, float y, int32_t width, int32_t height, float alpha = 1.0f) {
if(drawtexturefunction_ptr != NULL) {
drawtexturefunction_ptr(texture, sampler, x, y, width, height, alpha);
}
}
#ifdef __cplusplus
}
#endif

View File

@ -37,10 +37,12 @@ typedef void (*overlay_callback)(wups_overlay_options_type_t, void*);
typedef void (*OverlayOpenFunction)(wups_overlay_options_type_t screen, overlay_callback callback, void*);
typedef bool (*ConvertTextureFunction)(const uint8_t *img, int32_t imgSize, void * texture);
typedef void (*DrawTextureFunction)(void * texture, void* sampler, float x, float y, int32_t width, int32_t height, float alpha);
typedef struct wups_loader_init_overlay_args_t {
OverlayOpenFunction overlayfunction_ptr;
ConvertTextureFunction textureconvertfunction_ptr;
DrawTextureFunction drawtexturefunction_ptr;
} wups_loader_init_overlay_args_t;
typedef int (*OpenFunction) (const char *pathname, int flags);
@ -93,7 +95,7 @@ typedef struct wups_loader_init_vid_mem_args_t_ {
/**
Sets the pointer for wrapping the fs functions.
If NULL pointers are provided, the original function will be called.
The whole point of replacing the fs functions is to inherit SD/USB access.
The whole point of replacing the fs functions is to inherit SD/USB access.
The argument of the ON_APPLICATION_START hook provides information on the state of SD or USB access.
**/
void WUPS_InitFS(wups_loader_init_fs_args_t args);
@ -157,6 +159,8 @@ void * WUPS_VideoMemMemalign(uint32_t size, int32_t align);
void WUPS_VideoMemFree(void *addr);
void WUPS_DrawTexture(void * texture, void* sampler, float x, float y, int32_t width, int32_t height, float alpha);
#ifdef __cplusplus
}
#endif