diff --git a/src/overlay.cpp b/src/overlay.cpp index e0860fc..4f6d054 100644 --- a/src/overlay.cpp +++ b/src/overlay.cpp @@ -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 diff --git a/wups_include/wups/utils.h b/wups_include/wups/utils.h index a6614e8..935cf30 100644 --- a/wups_include/wups/utils.h +++ b/wups_include/wups/utils.h @@ -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