From 3d7e9c1744a5042f4e5eaaf41d2c539c865aea7a Mon Sep 17 00:00:00 2001 From: octospacc Date: Sun, 7 Aug 2022 00:38:18 +0200 Subject: [PATCH] New function, cleaner code --- LibMultiSpacc/MultiSpacc.h | 8 ++++++++ LibMultiSpacc/SDL12/SDL.c | 10 +++++----- LibMultiSpacc/SDL12/SDL.h | 9 +++------ LibMultiSpacc/SDL20/SDL.c | 10 +++++----- LibMultiSpacc/SDL20/SDL.h | 9 +++------ 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/LibMultiSpacc/MultiSpacc.h b/LibMultiSpacc/MultiSpacc.h index ea1a1ce..e981e82 100644 --- a/LibMultiSpacc/MultiSpacc.h +++ b/LibMultiSpacc/MultiSpacc.h @@ -9,3 +9,11 @@ #ifdef MultiSpacc_Target_SDL20 #include "SDL20/SDL.h" #endif + +MultiSpacc_Window *MultiSpacc_SetWindow( int Width, int Height, int Bits, Uint32 Flags ); +MultiSpacc_Surface *MultiSpacc_GetWindowSurface( MultiSpacc_Window *Window ); + +void MultiSpacc_SetAppTitle( MultiSpacc_Window *Window, const char *Title ); +void MultiSpacc_SetAppIcon( MultiSpacc_Window *Window, MultiSpacc_Surface *Icon ); + +int MultiSpacc_SetColorKey( MultiSpacc_Surface *Surface, bool Flag, Uint32 Key ); diff --git a/LibMultiSpacc/SDL12/SDL.c b/LibMultiSpacc/SDL12/SDL.c index 4ccb61a..8e852a6 100644 --- a/LibMultiSpacc/SDL12/SDL.c +++ b/LibMultiSpacc/SDL12/SDL.c @@ -4,21 +4,21 @@ #include "SDL/SDL_mixer.h" #include "SDL/SDL_ttf.h" -SDL_Surface *MultiSpacc_GetWindow( int Width, int Height, int Bits, Uint32 Flags ) { +MultiSpacc_Window *MultiSpacc_SetWindow( int Width, int Height, int Bits, Uint32 Flags ) { return SDL_SetVideoMode( Width, Height, Bits, Flags ); } -SDL_Surface *MultiSpacc_GetWindowSurface( SDL_Surface *Window ) { +MultiSpacc_Surface *MultiSpacc_GetWindowSurface( MultiSpacc_Window *Window ) { return Window; } -void MultiSpacc_SetAppTitle( SDL_Surface *Window, const char *Title ) { +void MultiSpacc_SetAppTitle( MultiSpacc_Window *Window, const char *Title ) { SDL_WM_SetCaption( Title, NULL ); } -void MultiSpacc_SetAppIcon( SDL_Surface *Window, SDL_Surface *Icon ) { +void MultiSpacc_SetAppIcon( MultiSpacc_Window *Window, MultiSpacc_Surface *Icon ) { SDL_WM_SetIcon( Icon, NULL ); } -int MultiSpacc_SetColorKey( SDL_Surface *Surface, bool Flag, Uint32 Key ) { +int MultiSpacc_SetColorKey( MultiSpacc_Surface *Surface, bool Flag, Uint32 Key ) { if ( Flag ) { return SDL_SetColorKey( Surface, SDL_SRCCOLORKEY, Key ); } diff --git a/LibMultiSpacc/SDL12/SDL.h b/LibMultiSpacc/SDL12/SDL.h index b978034..3cd5099 100644 --- a/LibMultiSpacc/SDL12/SDL.h +++ b/LibMultiSpacc/SDL12/SDL.h @@ -10,10 +10,7 @@ #include "SDL/SDL_mixer.h" #include "SDL/SDL_ttf.h" -SDL_Surface *MultiSpacc_GetWindow( int Width, int Height, int Bits, Uint32 Flags ); -SDL_Surface *MultiSpacc_GetWindowSurface( SDL_Surface *Window ); +#define MultiSpacc_Window SDL_Surface +#define MultiSpacc_Surface SDL_Surface -void MultiSpacc_SetAppTitle( SDL_Surface *Window, const char *Title ); -void MultiSpacc_SetAppIcon( SDL_Surface *Window, SDL_Surface *Icon ); - -int MultiSpacc_SetColorKey( SDL_Surface *Surface, bool Flag, Uint32 Key ); +#define MultiSpacc_UpdateWindowSurface SDL_Flip diff --git a/LibMultiSpacc/SDL20/SDL.c b/LibMultiSpacc/SDL20/SDL.c index 6fc013c..42e5447 100644 --- a/LibMultiSpacc/SDL20/SDL.c +++ b/LibMultiSpacc/SDL20/SDL.c @@ -4,21 +4,21 @@ #include "SDL2/SDL_mixer.h" #include "SDL2/SDL_ttf.h" -SDL_Window *MultiSpacc_GetWindow( int Width, int Height, int Bits, Uint32 Flags ) { +MultiSpacc_Window *MultiSpacc_SetWindow( int Width, int Height, int Bits, Uint32 Flags ) { return SDL_CreateWindow(NULL, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, Width, Height, Flags); } -SDL_Surface *MultiSpacc_GetWindowSurface( SDL_Surface *Window ) { +MultiSpacc_Surface *MultiSpacc_GetWindowSurface( MultiSpacc_Window *Window ) { return SDL_GetWindowSurface( Window ); } -void MultiSpacc_SetAppTitle( SDL_Surface *Window, const char *Title ) { +void MultiSpacc_SetAppTitle( MultiSpacc_Window *Window, const char *Title ) { SDL_SetWindowTitle( Window, Title ); } -void MultiSpacc_SetAppIcon( SDL_Surface *Window, SDL_Surface *Icon ) { +void MultiSpacc_SetAppIcon( MultiSpacc_Window *Window, MultiSpacc_Surface *Icon ) { SDL_SetWindowIcon( Window, Icon ); } -int MultiSpacc_SetColorKey( SDL_Surface *Surface, bool Flag, Uint32 Key ) { +int MultiSpacc_SetColorKey( MultiSpacc_Surface *Surface, bool Flag, Uint32 Key ) { if ( Flag ) { return SDL_SetColorKey( Surface, SDL_TRUE, Key ); } diff --git a/LibMultiSpacc/SDL20/SDL.h b/LibMultiSpacc/SDL20/SDL.h index f16aaeb..7081dd9 100644 --- a/LibMultiSpacc/SDL20/SDL.h +++ b/LibMultiSpacc/SDL20/SDL.h @@ -10,10 +10,7 @@ #include "SDL2/SDL_mixer.h" #include "SDL2/SDL_ttf.h" -SDL_Window *MultiSpacc_GetWindow( int Width, int Height, int Bits, Uint32 Flags ); -SDL_Surface *MultiSpacc_GetWindowSurface( SDL_Surface *Window ); +#define MultiSpacc_Window SDL_Window +#define MultiSpacc_Surface SDL_Surface -void MultiSpacc_SetAppTitle( SDL_Surface *Window, const char *Title ); -void MultiSpacc_SetAppIcon( SDL_Surface *Window, SDL_Surface *Icon ); - -int MultiSpacc_SetColorKey( SDL_Surface *Surface, bool Flag, Uint32 Key ); +#define MultiSpacc_UpdateWindowSurface SDL_UpdateWindowSurface