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 95b8a1898cd06074a268d53022229875e689ed7b (commit) from 2988715637a4e169cf766abe2f777c76600180c7 (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/95b8a1898cd06074a268d53022229875e689e...
commit 95b8a1898cd06074a268d53022229875e689ed7b Author: Cyril Hrubis metan@ucw.cz Date: Sun Feb 19 18:45:10 2012 +0100
backends: Add more opts for SDL Backend Init.
diff --git a/libs/backends/GP_BackendInit.c b/libs/backends/GP_BackendInit.c index a544600..c8224de 100644 --- a/libs/backends/GP_BackendInit.c +++ b/libs/backends/GP_BackendInit.c @@ -38,20 +38,59 @@ static void backend_sdl_help(FILE *help, const char *err)
fprintf(help, "libSDL backendn" "--------------n" - "SDL:[FS]n"); + "SDL:[FS]:[WxH]n" + " FS - Full Screen moden" + " WxH - Display Sizen"); +} + +static int sdl_params_to_flags(const char *param, GP_Size *w, GP_Size *h, + uint8_t *flags, FILE *help) +{ + if (!strcasecmp(param, "FS")) { + *flags |= GP_SDL_FULLSCREEN; + return 0; + } + + /* + * Accepts only string with format "intxint" or "intXint" + */ + int sw, sh; + unsigned int n; + + if (sscanf(param, "%i%*[xX]%i%n", &sw, &sh, &n) == 2 && n == strlen(param)) { + *w = sw; + *h = sh; + return 0; + } + + backend_sdl_help(help, "SDL: Invalid parameters"); + return 1; }
static GP_Backend *backend_sdl_init(const char *params, FILE *help) { if (params == NULL) return GP_BackendSDLInit(0, 0, 0, 0); + + GP_Size w = 0, h = 0; + uint8_t flags = 0; + + const char *s = params; + + do { + switch (*s) { + case ':': + s = '0'; + case '0': + if (sdl_params_to_flags(params, &w, &h, &flags, help)) + return NULL; + s++; + params = s; + break; + } + } while (*(s++) != '0');
- if (!strcasecmp(params, "FS")) - return GP_BackendSDLInit(0, 0, 0, GP_SDL_FULLSCREEN); - - backend_sdl_help(help, "SDL: Invalid parameters"); - - return NULL; + return GP_BackendSDLInit(w, h, 0, flags); }
static void backend_fb_help(FILE *help, const char *err)
-----------------------------------------------------------------------
Summary of changes: libs/backends/GP_BackendInit.c | 51 +++++++++++++++++++++++++++++++++++---- 1 files changed, 45 insertions(+), 6 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.