From 113c2ea17d0bf0e3ccd7582ab0f25ec0b0234342 Mon Sep 17 00:00:00 2001 From: octospacc Date: Sat, 6 Aug 2022 13:57:49 +0200 Subject: [PATCH] Add README, some work on SDL 1.2 --- MultiSpacc.h => LibMultiSpacc/MultiSpacc.h | 0 LibMultiSpacc/SDL12/SDL.c | 31 ++++++++++++++++++++++ LibMultiSpacc/SDL12/SDL.h | 18 +++++++++++++ {SDL20 => LibMultiSpacc/SDL20}/SDL.h | 0 README.md | 14 ++++++++++ SDL12/SDL.c | 5 ---- SDL12/SDL.h | 13 --------- 7 files changed, 63 insertions(+), 18 deletions(-) rename MultiSpacc.h => LibMultiSpacc/MultiSpacc.h (100%) create mode 100644 LibMultiSpacc/SDL12/SDL.c create mode 100644 LibMultiSpacc/SDL12/SDL.h rename {SDL20 => LibMultiSpacc/SDL20}/SDL.h (100%) create mode 100644 README.md delete mode 100644 SDL12/SDL.c delete mode 100644 SDL12/SDL.h diff --git a/MultiSpacc.h b/LibMultiSpacc/MultiSpacc.h similarity index 100% rename from MultiSpacc.h rename to LibMultiSpacc/MultiSpacc.h diff --git a/LibMultiSpacc/SDL12/SDL.c b/LibMultiSpacc/SDL12/SDL.c new file mode 100644 index 0000000..20c856c --- /dev/null +++ b/LibMultiSpacc/SDL12/SDL.c @@ -0,0 +1,31 @@ +#include +#include "../MultiSpacc.h" +#include "SDL/SDL.h" +#include "SDL/SDL_image.h" +#include "SDL/SDL_mixer.h" +#include "SDL/SDL_ttf.h" + +void MultiSpacc_SetAppTitle( const char *Title ) { + SDL_WM_SetCaption( Title, NULL ); +} + +void MultiSpacc_SetAppIcon( SDL_Surface *Icon ) { + SDL_WM_SetIcon( Icon, NULL ); +} + +int MultiSpacc_SetColorKey( SDL_Surface *Surface, bool Flag, Uint32 Key ) { + if ( Flag ) { + return SDL_SetColorKey( Surface, SDL_SRCCOLORKEY, Key ); + } + else { + return SDL_SetColorKey( Surface, 0, Key ); + } +} + +SDL_Surface *MultiSpacc_GetWindow( int Width, int Height, int Bits, Uint32 Flags ) { + return SDL_SetVideoMode( Width, Height, Bits, Flags ); +} + +SDL_Surface *MultiSpacc_GetWindowSurface( SDL_Surface *Window ) { + return Window; +} diff --git a/LibMultiSpacc/SDL12/SDL.h b/LibMultiSpacc/SDL12/SDL.h new file mode 100644 index 0000000..161f639 --- /dev/null +++ b/LibMultiSpacc/SDL12/SDL.h @@ -0,0 +1,18 @@ +#pragma once + +#ifndef MultiSpacc_Target_SDL12 + #define MultiSpacc_Target_SDL12 +#endif + +#include +#include "../MultiSpacc.h" +#include "SDL/SDL.h" +#include "SDL/SDL_image.h" +#include "SDL/SDL_mixer.h" +#include "SDL/SDL_ttf.h" + +void MultiSpacc_SetAppTitle( const char *Title ); +void MultiSpacc_SetAppIcon( SDL_Surface *Icon ); +int MultiSpacc_SetColorKey( SDL_Surface *Surface, bool Flag, Uint32 Key ); +SDL_Surface *MultiSpacc_GetWindow( int Width, int Height, int Bits, Uint32 Flags ); +SDL_Surface *MultiSpacc_GetWindowSurface( SDL_Surface *Window ); diff --git a/SDL20/SDL.h b/LibMultiSpacc/SDL20/SDL.h similarity index 100% rename from SDL20/SDL.h rename to LibMultiSpacc/SDL20/SDL.h diff --git a/README.md b/README.md new file mode 100644 index 0000000..c138283 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# LibMultiSpacc + +LibMultiSpacc is a library aiming to provide cross-platform abstractions for a number of less-cross-platform libraries. + +The list of backend libraries supported follows: + +- SDL 1.2 (WIP) +- SDL 2.0 (planned) + +Example programs (and makefiles) will come soon. + +### Licensing + +I have yet to choose a license for this. I would like for the library to be usable by as many people as possible (and, for that, the Unlicense o zlib license would be the best), but I have yet to understand legal compatibility with all the different libraries mine is made to work on top of. diff --git a/SDL12/SDL.c b/SDL12/SDL.c deleted file mode 100644 index 79d0d99..0000000 --- a/SDL12/SDL.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -void MultiSpacc_SetAppTitle( const char *Title ) { - SDL_WM_SetCaption( Title, NULL ); -} diff --git a/SDL12/SDL.h b/SDL12/SDL.h deleted file mode 100644 index ceb661b..0000000 --- a/SDL12/SDL.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#ifndef MultiSpacc_Target_SDL12 - #define MultiSpacc_Target_SDL12 -#endif - -#include "../MultiSpacc.h" -#include "SDL/SDL.h" -#include "SDL/SDL_image.h" -#include "SDL/SDL_mixer.h" -#include "SDL/SDL_ttf.h" - -void MultiSpacc_SetAppTitle( const char *Title );