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 40ef6e9a083f24ff72acc2a52e0902cb35d5a768 (commit) via c1d7712882e1eebc596ebba1dbf597deb66a105a (commit) from 95b8a1898cd06074a268d53022229875e689ed7b (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/40ef6e9a083f24ff72acc2a52e0902cb35d5a...
commit 40ef6e9a083f24ff72acc2a52e0902cb35d5a768 Author: Cyril Hrubis metan@ucw.cz Date: Sun Feb 19 19:41:43 2012 +0100
backends: Add caption parameter.
diff --git a/demos/fbshow/fbshow.c b/demos/fbshow/fbshow.c index 18554f2..96fdf47 100644 --- a/demos/fbshow/fbshow.c +++ b/demos/fbshow/fbshow.c @@ -172,7 +172,7 @@ static void *image_loader(void *ptr) if (rat < 1) { cpu_timer_start(&timer, "Blur"); callback.priv = "Blurring Image"; - if (GP_FilterGaussianBlur(img, img, 0.5/rat, 0.5/rat, &callback) == NULL) + if (GP_FilterGaussianBlur(img, img, 0.3/rat, 0.3/rat, &callback) == NULL) return NULL; cpu_timer_stop(&timer); } @@ -293,7 +293,7 @@ static void sighandler(int signo)
static void init_backend(const char *backend_opts) { - backend = GP_BackendInit(backend_opts, stderr); + backend = GP_BackendInit(backend_opts, "FBshow", stderr); if (backend == NULL) { fprintf(stderr, "Failed to initalize backend '%s'n", backend_opts); diff --git a/demos/particle/particle_demo.c b/demos/particle/particle_demo.c index b258956..82c8e74 100644 --- a/demos/particle/particle_demo.c +++ b/demos/particle/particle_demo.c @@ -51,20 +51,7 @@ static void sighandler(int signo)
static void init_backend(const char *backend_opts) { - if (!strcmp(backend_opts, "fb")) { - fprintf(stderr, "Initalizing framebuffer backendn"); - backend = GP_BackendLinuxFBInit("/dev/fb0"); - } - - if (!strcmp(backend_opts, "SDL")) { - fprintf(stderr, "Initalizing SDL backendn"); - 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); - } + backend = GP_BackendInit(backend_opts, "Particles", stderr);
if (backend == NULL) { fprintf(stderr, "Failed to initalize backend '%s'n", backend_opts); @@ -74,7 +61,7 @@ static void init_backend(const char *backend_opts)
int main(int argc, char *argv[]) { - const char *backend_opts = "fb"; + const char *backend_opts = "SDL"; int opt; int pause_flag = 0;
diff --git a/include/backends/GP_BackendInit.h b/include/backends/GP_BackendInit.h index 3d34687..6fcc997 100644 --- a/include/backends/GP_BackendInit.h +++ b/include/backends/GP_BackendInit.h @@ -39,12 +39,16 @@ * "backend_name:backend_params" * * For example "SDL:FS" is string for fullscreen SDL backend. + * + * The caption parameter may, or may not be used. For example in windowed + * enviroment caption will become caption of a window. When running on + * framebuffer it may be ignored completly. * * Returns initalized backend or NULL in case of failure. * * If initialization has failed or params is NULL and help is not NULL, help * text is printed to a given file. */ -GP_Backend *GP_BackendInit(const char *params, FILE *help); +GP_Backend *GP_BackendInit(const char *params, const char *caption, FILE *help);
#endif /* BACKENDS_GP_BACKEND_INIT_H */ diff --git a/include/backends/GP_SDL.h b/include/backends/GP_SDL.h index bd553b9..514f65d 100644 --- a/include/backends/GP_SDL.h +++ b/include/backends/GP_SDL.h @@ -24,7 +24,7 @@ #define BACKENDS_GP_SDL_H
#include <stdint.h> -#include "GP_Backend.h" +#include "backends/GP_Backend.h"
enum GP_BackendSDLFlags { GP_SDL_FULLSCREEN = 0x01, @@ -57,6 +57,7 @@ enum GP_BackendSDLFlags { * 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, uint8_t flags); + uint8_t bpp, uint8_t flags, + const char *caption);
#endif /* BACKENDS_GP_SDL_H */ diff --git a/include/input/GP_Event.h b/include/input/GP_Event.h index db4166c..8f57588 100644 --- a/include/input/GP_Event.h +++ b/include/input/GP_Event.h @@ -250,7 +250,7 @@ typedef struct GP_Event { /* event */ uint16_t type; uint32_t code; - union GP_EventValue val; + union GP_EventValue val;
/* input device id */ uint32_t dev_id; diff --git a/libs/backends/GP_BackendInit.c b/libs/backends/GP_BackendInit.c index c8224de..7b80816 100644 --- a/libs/backends/GP_BackendInit.c +++ b/libs/backends/GP_BackendInit.c @@ -67,10 +67,11 @@ static int sdl_params_to_flags(const char *param, GP_Size *w, GP_Size *h, return 1; }
-static GP_Backend *backend_sdl_init(const char *params, FILE *help) +static GP_Backend *backend_sdl_init(const char *params, const char *caption, + FILE *help) { if (params == NULL) - return GP_BackendSDLInit(0, 0, 0, 0); + return GP_BackendSDLInit(0, 0, 0, 0, caption); GP_Size w = 0, h = 0; uint8_t flags = 0; @@ -90,7 +91,7 @@ static GP_Backend *backend_sdl_init(const char *params, FILE *help) } } while (*(s++) != '0');
- return GP_BackendSDLInit(w, h, 0, flags); + return GP_BackendSDLInit(w, h, 0, flags, caption); }
static void backend_fb_help(FILE *help, const char *err) @@ -106,11 +107,13 @@ static void backend_fb_help(FILE *help, const char *err) "FB:[/dev/fbX]n"); }
-static GP_Backend *backend_fb_init(const char *params, FILE *help) +static GP_Backend *backend_fb_init(const char *params, const char *caption, + FILE *help) { const char *fb = "/dev/fb0"; (void) help; + (void) caption;
if (params != NULL) fb = params; @@ -124,7 +127,7 @@ static const char *backend_names[] = { NULL, };
-static GP_Backend *(*backend_inits[])(const char *params, FILE *help) = { +static GP_Backend *(*backend_inits[])(const char *, const char *, FILE *) = { backend_sdl_init, backend_fb_init, NULL, @@ -168,7 +171,8 @@ static int get_backend(const char *name) return -1; }
-static GP_Backend *init_backend(const char *name, const char *params, FILE *help) +static GP_Backend *init_backend(const char *name, const char *params, + const char *caption, FILE *help) { int i = get_backend(name);
@@ -178,10 +182,10 @@ static GP_Backend *init_backend(const char *name, const char *params, FILE *help return NULL; }
- return backend_inits[i](params, help); + return backend_inits[i](params, caption, help); }
-GP_Backend *GP_BackendInit(const char *params, FILE *help) +GP_Backend *GP_BackendInit(const char *params, const char *caption, FILE *help) { if (params == NULL) { print_help(help, NULL); @@ -204,5 +208,5 @@ GP_Backend *GP_BackendInit(const char *params, FILE *help)
GP_DEBUG(1, "Have backend name '%s'", buf);
- return init_backend(buf, backend_params, help); + return init_backend(buf, backend_params, caption, help); } diff --git a/libs/backends/GP_SDL.c b/libs/backends/GP_SDL.c index feabc9b..b88b3b5 100644 --- a/libs/backends/GP_SDL.c +++ b/libs/backends/GP_SDL.c @@ -134,7 +134,8 @@ 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, uint8_t flags) +GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h, uint8_t bpp, uint8_t flags, + const char *caption) { /* SDL not yet initalized */ if (backend.context == NULL) { @@ -152,7 +153,10 @@ GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h, uint8_t bpp, uint8_t flags) sdl_flags |= SDL_RESIZABLE;
sdl_surface = SDL_SetVideoMode(w, h, bpp, sdl_flags); - + + if (caption != NULL) + SDL_WM_SetCaption(caption, caption); + if (sdl_surface == NULL) { GP_DEBUG(1, "ERROR: SDL_SetVideoMode: %s", SDL_GetError()); SDL_Quit(); @@ -175,7 +179,8 @@ GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h, uint8_t bpp, uint8_t flags)
#else
-GP_Backend *GP_BackendSDLInit(void) +GP_Backend *GP_BackendSDLInit(GP_Size w, GP_Size h, uint8_t bpp, uint8_t flags, + const char *caption) { return NULL; }
http://repo.or.cz/w/gfxprim.git/commit/c1d7712882e1eebc596ebba1dbf597deb66a1...
commit c1d7712882e1eebc596ebba1dbf597deb66a105a Author: Cyril Hrubis metan@ucw.cz Date: Sun Feb 19 19:38:53 2012 +0100
demos: particle: fix typo.
diff --git a/demos/particle/space.c b/demos/particle/space.c index 030f2e4..928798a 100644 --- a/demos/particle/space.c +++ b/demos/particle/space.c @@ -131,7 +131,7 @@ static void central_gravity(struct space *space, int time) unsigned int i;
for (i = 0; i < space->particle_count; i++) { - space->particles[i].vy += space->gax * time; + space->particles[i].vx += space->gax * time; space->particles[i].vy += space->gay * time; } }
-----------------------------------------------------------------------
Summary of changes: demos/fbshow/fbshow.c | 4 ++-- demos/particle/particle_demo.c | 17 ++--------------- demos/particle/space.c | 2 +- include/backends/GP_BackendInit.h | 6 +++++- include/backends/GP_SDL.h | 5 +++-- include/input/GP_Event.h | 2 +- libs/backends/GP_BackendInit.c | 22 +++++++++++++--------- libs/backends/GP_SDL.c | 11 ++++++++--- 8 files changed, 35 insertions(+), 34 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.