This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via 7bc428fa520fa1091b43319121322378951a347d (commit) from b549f66c9fc9e0ccb125692a7a2570bbe2016cdc (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/7bc428fa520fa1091b43319121322378951a3...
commit 7bc428fa520fa1091b43319121322378951a347d Author: Cyril Hrubis metan@ucw.cz Date: Tue Jan 17 12:25:28 2012 +0100
backends: Add options for SDL fulscreen && docs.
diff --git a/demos/fbshow/fbshow.c b/demos/fbshow/fbshow.c index fe8a372..c7363fd 100644 --- a/demos/fbshow/fbshow.c +++ b/demos/fbshow/fbshow.c @@ -278,7 +278,12 @@ static void init_backend(const char *backend_opts) if (!strcmp(backend_opts, "SDL")) { fprintf(stderr, "Initalizing SDL backendn"); - backend = GP_BackendSDLInit(800, 600, 0); + backend = GP_BackendSDLInit(800, 600, 0, 0); + } + + if (!strcmp(backend_opts, "SDL:FS")) { + fprintf(stderr, "Initalizing SDL fullscreenn"); + backend = GP_BackendSDLInit(0, 0, 0, GP_SDL_FULLSCREEN); }
if (backend == NULL) { diff --git a/include/backends/GP_SDL.h b/include/backends/GP_SDL.h index 2b3541b..bd553b9 100644 --- a/include/backends/GP_SDL.h +++ b/include/backends/GP_SDL.h @@ -26,11 +26,37 @@ #include <stdint.h> #include "GP_Backend.h"
+enum GP_BackendSDLFlags { + GP_SDL_FULLSCREEN = 0x01, + GP_SDL_RESIZABLE = 0x02, +}; + /* * Initalize SDL as drawing backend. * + * * SDL doesn't expose file descriptors. + * + * * The backend is thread safe (the critical parts are guarded with a mutex) + * + * * The backend is singleton, you can't have two SDL backends running at the + * same time. + * + * * When backend is allready initalized, this function ignores it's parameters + * and returns pointer to allready initalized SDL backend. + * + * * The SDL backends (upon calling GP_BackendPoll()) feeds keyboard and mouse + * events into global GP event queue (see input/GP_Event.h). + * + * + * The parameters w h and bpp are directly passed to SDL_SetVideoMode(). + * + * * If w, h and/or bpp are set to zero, SDL tries to do best fit. + * + * * The GP_BackendSDLFlags are converted into SDL equivalents. + * * Upon failure, or if SDL wasn't compiled in, NULL is returned. */ -GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h, uint8_t bpp); +GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h, + uint8_t bpp, uint8_t flags);
#endif /* BACKENDS_GP_SDL_H */ diff --git a/libs/backends/GP_SDL.c b/libs/backends/GP_SDL.c index f50cfed..7bf7cb0 100644 --- a/libs/backends/GP_SDL.c +++ b/libs/backends/GP_SDL.c @@ -28,6 +28,7 @@ #include "core/GP_Debug.h" #include "input/GP_InputDriverSDL.h" #include "GP_Backend.h" +#include "GP_SDL.h"
#ifdef HAVE_LIBSDL
@@ -60,15 +61,6 @@ static void sdl_update_rect(struct GP_Backend *self __attribute__((unused)), SDL_mutexV(mutex); }
-static void sdl_exit(struct GP_Backend *self __attribute__((unused))) -{ - SDL_mutexP(mutex); - - SDL_Quit(); - - SDL_DestroyMutex(mutex); -} - static void sdl_poll(struct GP_Backend *self __attribute__((unused))) { SDL_Event ev; @@ -81,6 +73,8 @@ static void sdl_poll(struct GP_Backend *self __attribute__((unused))) SDL_mutexV(mutex); }
+static void sdl_exit(struct GP_Backend *self __attribute__((unused))); + static struct GP_Backend backend = { .name = "SDL", .context = NULL, @@ -91,6 +85,17 @@ static struct GP_Backend backend = { .Poll = sdl_poll, };
+static void sdl_exit(struct GP_Backend *self __attribute__((unused))) +{ + SDL_mutexP(mutex); + + SDL_Quit(); + + SDL_DestroyMutex(mutex); + + backend.context = NULL; +} + int context_from_surface(GP_Context *context, SDL_Surface *surf) { /* sanity checks on the SDL surface */ @@ -129,7 +134,7 @@ int context_from_surface(GP_Context *context, SDL_Surface *surf) return 0; }
-GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h, uint8_t bpp) +GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h, uint8_t bpp, uint8_t flags) { /* SDL not yet initalized */ if (backend.context == NULL) { @@ -138,7 +143,15 @@ GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h, uint8_t bpp) return NULL; }
- sdl_surface = SDL_SetVideoMode(w, h, bpp, SDL_SWSURFACE|SDL_DOUBLEBUF); + uint32_t sdl_flags = SDL_SWSURFACE; + + if (flags & GP_SDL_FULLSCREEN) + sdl_flags |= SDL_FULLSCREEN; + + if (flags & GP_SDL_RESIZEABLE) + sdl_flags |= SDL_RESIZABLE; + + sdl_surface = SDL_SetVideoMode(w, h, bpp, sdl_flags); if (sdl_surface == NULL) { GP_DEBUG(1, "ERROR: SDL_SetVideoMode: %s", SDL_GetError());
-----------------------------------------------------------------------
Summary of changes: demos/fbshow/fbshow.c | 7 ++++++- include/backends/GP_SDL.h | 28 +++++++++++++++++++++++++++- libs/backends/GP_SDL.c | 35 ++++++++++++++++++++++++----------- 3 files changed, 57 insertions(+), 13 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.