New function, cleaner code

This commit is contained in:
octospacc 2022-08-07 00:38:18 +02:00
parent 270ae8baa0
commit 3d7e9c1744
5 changed files with 24 additions and 22 deletions

View File

@ -9,3 +9,11 @@
#ifdef MultiSpacc_Target_SDL20 #ifdef MultiSpacc_Target_SDL20
#include "SDL20/SDL.h" #include "SDL20/SDL.h"
#endif #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 );

View File

@ -4,21 +4,21 @@
#include "SDL/SDL_mixer.h" #include "SDL/SDL_mixer.h"
#include "SDL/SDL_ttf.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 ); return SDL_SetVideoMode( Width, Height, Bits, Flags );
} }
SDL_Surface *MultiSpacc_GetWindowSurface( SDL_Surface *Window ) { MultiSpacc_Surface *MultiSpacc_GetWindowSurface( MultiSpacc_Window *Window ) {
return 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 ); 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 ); 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 ) { if ( Flag ) {
return SDL_SetColorKey( Surface, SDL_SRCCOLORKEY, Key ); return SDL_SetColorKey( Surface, SDL_SRCCOLORKEY, Key );
} }

View File

@ -10,10 +10,7 @@
#include "SDL/SDL_mixer.h" #include "SDL/SDL_mixer.h"
#include "SDL/SDL_ttf.h" #include "SDL/SDL_ttf.h"
SDL_Surface *MultiSpacc_GetWindow( int Width, int Height, int Bits, Uint32 Flags ); #define MultiSpacc_Window SDL_Surface
SDL_Surface *MultiSpacc_GetWindowSurface( SDL_Surface *Window ); #define MultiSpacc_Surface SDL_Surface
void MultiSpacc_SetAppTitle( SDL_Surface *Window, const char *Title ); #define MultiSpacc_UpdateWindowSurface SDL_Flip
void MultiSpacc_SetAppIcon( SDL_Surface *Window, SDL_Surface *Icon );
int MultiSpacc_SetColorKey( SDL_Surface *Surface, bool Flag, Uint32 Key );

View File

@ -4,21 +4,21 @@
#include "SDL2/SDL_mixer.h" #include "SDL2/SDL_mixer.h"
#include "SDL2/SDL_ttf.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); 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 ); 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 ); 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 ); 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 ) { if ( Flag ) {
return SDL_SetColorKey( Surface, SDL_TRUE, Key ); return SDL_SetColorKey( Surface, SDL_TRUE, Key );
} }

View File

@ -10,10 +10,7 @@
#include "SDL2/SDL_mixer.h" #include "SDL2/SDL_mixer.h"
#include "SDL2/SDL_ttf.h" #include "SDL2/SDL_ttf.h"
SDL_Window *MultiSpacc_GetWindow( int Width, int Height, int Bits, Uint32 Flags ); #define MultiSpacc_Window SDL_Window
SDL_Surface *MultiSpacc_GetWindowSurface( SDL_Surface *Window ); #define MultiSpacc_Surface SDL_Surface
void MultiSpacc_SetAppTitle( SDL_Surface *Window, const char *Title ); #define MultiSpacc_UpdateWindowSurface SDL_UpdateWindowSurface
void MultiSpacc_SetAppIcon( SDL_Surface *Window, SDL_Surface *Icon );
int MultiSpacc_SetColorKey( SDL_Surface *Surface, bool Flag, Uint32 Key );