ZFFramework
 
Loading...
Searching...
No Matches
ZFImpl_sys_SDL_ZF_impl.h
1#ifndef _ZFI_ZFImpl_sys_SDL_ZF_impl_h_
2#define _ZFI_ZFImpl_sys_SDL_ZF_impl_h_
3
4#include "../ZFImpl_ZF_impl.h"
5#include "ZFImpl_sys_SDL.h"
6
7#if ZF_ENV_sys_SDL
8#include "SDL3/SDL.h"
9#endif
10
11#include "ZFCore.h"
12
13#if ZF_ENV_sys_SDL
15
22extern ZFLIB_ZF_impl SDL_IOStream *ZFImpl_sys_SDL_ZFInputToSDL_IOStream(ZF_IN const ZFInput &callback);
29extern ZFLIB_ZF_impl SDL_IOStream *ZFImpl_sys_SDL_ZFOutputToSDL_IOStream(ZF_IN const ZFOutput &callback);
30
31// ============================================================
35#define ZFImpl_sys_SDL_zfblockedDestroySurface(sdlSurface) \
36 _ZFP_ZFImpl_sys_SDL_zfblockedDestroySurface ZFUniqueName(sdl_surface)(sdlSurface)
37zfclassNotPOD ZFLIB_ZF_impl _ZFP_ZFImpl_sys_SDL_zfblockedDestroySurface {
38public:
39 _ZFP_ZFImpl_sys_SDL_zfblockedDestroySurface(ZF_IN SDL_Surface *sdlSurface)
40 : d(sdlSurface)
41 {
42 }
43 ~_ZFP_ZFImpl_sys_SDL_zfblockedDestroySurface(void) {
44 if(d) {
45 SDL_DestroySurface(d);
46 }
47 }
48private:
49 SDL_Surface *d;
50};
51
55#define ZFImpl_sys_SDL_zfblockedDestroyTexture(sdlTexture) \
56 _ZFP_ZFImpl_sys_SDL_zfblockedDestroyTexture ZFUniqueName(sdl_texture)(sdlTexture)
57zfclassNotPOD ZFLIB_ZF_impl _ZFP_ZFImpl_sys_SDL_zfblockedDestroyTexture {
58public:
59 _ZFP_ZFImpl_sys_SDL_zfblockedDestroyTexture(ZF_IN SDL_Texture *sdlTexture)
60 : d(sdlTexture)
61 {
62 }
63 ~_ZFP_ZFImpl_sys_SDL_zfblockedDestroyTexture(void) {
64 if(d) {
65 SDL_DestroyTexture(d);
66 }
67 }
68private:
69 SDL_Texture *d;
70};
71
75#define ZFImpl_sys_SDL_zfblockedRenderTarget(success, sdlRenderer, sdlTexture) \
76 _ZFP_ZFImpl_sys_SDL_zfblockedRenderTarget success(sdlRenderer, sdlTexture)
77zfclassNotPOD ZFLIB_ZF_impl _ZFP_ZFImpl_sys_SDL_zfblockedRenderTarget {
78public:
79 _ZFP_ZFImpl_sys_SDL_zfblockedRenderTarget(
80 ZF_IN SDL_Renderer *sdlRenderer
81 , ZF_IN SDL_Texture *sdlTexture
82 )
83 : _sdlRenderer(sdlRenderer)
84 , _sdlTextureSaved(SDL_GetRenderTarget(sdlRenderer))
85 {
86 _success = SDL_SetRenderTarget(sdlRenderer, sdlTexture);
87 }
88 ~_ZFP_ZFImpl_sys_SDL_zfblockedRenderTarget(void) {
89 if(_success) {
90 SDL_SetRenderTarget(_sdlRenderer, _sdlTextureSaved);
91 }
92 }
93 operator zfbool (void) const {
94 return _success;
95 }
96private:
97 zfbool _success;
98 SDL_Renderer *_sdlRenderer;
99 SDL_Texture *_sdlTextureSaved;
100};
101
103#endif // #if ZF_ENV_sys_SDL
104#endif // #ifndef _ZFI_ZFImpl_sys_SDL_ZF_impl_h_
105
header file for ZFCore module
#define ZF_IN
dummy macro that shows the param used as required input
Definition ZFCoreTypeDef_ClassType.h:180
#define zfclassNotPOD
shows the class is not a POD type, you should not memset it or declare it in stack or copy value by c...
Definition ZFCoreTypeDef_ClassType.h:48
_ZFT_t_zfbool zfbool
bool type
Definition ZFCoreTypeDef_CoreType.h:103
global header for ZF_impl module
#define ZFLIB_ZF_impl
used to export symbols
Definition ZFImpl_ZF_impl.h:15
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
general input callback
Definition ZFIOCallback_input.h:37
general output callback
Definition ZFIOCallback_output.h:37