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, generate has been updated via cc8d797431865afe675e257b7f06513adcb7fac4 (commit) via 90cc2e75e5a3c5f7e2f4d007313bb998b9117406 (commit) from 64255c5b0947d3e9153a8e157b41c1ceb0de3a2b (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/cc8d797431865afe675e257b7f06513adcb7f...
commit cc8d797431865afe675e257b7f06513adcb7fac4 Author: Cyril Hrubis metan@ucw.cz Date: Tue Aug 16 15:55:27 2011 +0200
Fix the exit to call SDL_Exit() and show keys.
diff --git a/tests/SDL/input.c b/tests/SDL/input.c index 509bc54..b956e62 100644 --- a/tests/SDL/input.c +++ b/tests/SDL/input.c @@ -41,7 +41,7 @@ SDL_TimerID timer; SDL_UserEvent timer_event;
/* Values for color pixels in display format. */ -GP_Pixel red_pixel, green_pixel, blue_pixel, white_pixel; +GP_Pixel black_pixel, red_pixel, green_pixel, blue_pixel, white_pixel;
Uint32 timer_callback(__attribute__((unused)) Uint32 interval, __attribute__((unused)) void *param) @@ -57,30 +57,19 @@ void draw_pixel(void) int x = random() % 320; int y = random() % 240;
-// pixel = GP_GetPixel(&context, x, y);
GP_PutPixel(&context, x, y, green_pixel); +}
- /* TODO: we cannot switch like this - we need either to convert blue - and others into Context format - at the very beginning, or make - a copy to convert it and match - agains what we get from GP_GetPixel +void draw_event(GP_Event *ev) +{ + if (ev->type != GP_EV_KEY) + return;
- if (pixel == blue) { - GP_PutPixel(&context, x, y, green); - } - else if (pixel == red) { - GP_PutPixel(&context, x, y, white); - } - else { - if (x < 160) { - GP_PutPixel(&context, x, y, blue); - } else { - GP_PutPixel(&context, x, y, red); - } - } */ + GP_FillRect(&context, 0, 0, 200, 20, black_pixel); + GP_Text(&context, NULL, 0, 0, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, + GP_EventKeyName(ev->val.key.key), white_pixel); + SDL_Flip(display); }
void draw_pixels(void) @@ -110,9 +99,13 @@ void event_loop(void)
switch (ev.type) { case GP_EV_KEY: + draw_event(&ev); + switch (ev.val.key.key) { case GP_KEY_ESC: + SDL_Quit(); exit(0); + break; case GP_BTN_LEFT: GP_PutPixel(&context, ev.cursor_x, ev.cursor_y, red_pixel); @@ -158,13 +151,13 @@ int main(int argc, char **argv) }
/* Create a window with a software back surface */ - display = SDL_SetVideoMode(320, 240, display_bpp, SDL_SWSURFACE); + display = SDL_SetVideoMode(480, 640, display_bpp, SDL_SWSURFACE); if (display == NULL) { fprintf(stderr, "Could not open display: %sn", SDL_GetError()); goto fail; }
- GP_EventSetScreenSize(320, 240); + GP_EventSetScreenSize(480, 640);
/* Print basic information about the surface */ printf("Display surface properties:n"); @@ -184,6 +177,7 @@ int main(int argc, char **argv) green_pixel = GP_ColorToPixel(&context, GP_COL_GREEN); blue_pixel = GP_ColorToPixel(&context, GP_COL_BLUE); white_pixel = GP_ColorToPixel(&context, GP_COL_WHITE); + black_pixel = GP_ColorToPixel(&context, GP_COL_BLACK);
/* Set up the refresh timer */ timer = SDL_AddTimer(30, timer_callback, NULL);
http://repo.or.cz/w/gfxprim.git/commit/90cc2e75e5a3c5f7e2f4d007313bb998b9117...
commit 90cc2e75e5a3c5f7e2f4d007313bb998b9117406 Author: Cyril Hrubis metan@ucw.cz Date: Tue Aug 16 15:54:48 2011 +0200
Move the asserts in text where they belong.
diff --git a/libs/text/GP_Text.c b/libs/text/GP_Text.c index 43bf6ed..073561d 100644 --- a/libs/text/GP_Text.c +++ b/libs/text/GP_Text.c @@ -39,13 +39,14 @@ GP_RetCode GP_Text_Raw(GP_Context *context, const GP_TextStyle *style, const char *str, GP_Pixel pixel) { GP_CHECK_CONTEXT(context); - GP_CHECK_TEXT_STYLE(style);
if (str == NULL) return GP_ENULLPTR;
if (style == NULL) style = &DefaultStyle; + + GP_CHECK_TEXT_STYLE(style);
int width = GP_TextWidth(style, str); int height = GP_TextHeight(style); @@ -94,13 +95,14 @@ GP_RetCode GP_Text(GP_Context *context, const GP_TextStyle *style, const char *str, GP_Pixel pixel) { GP_CHECK_CONTEXT(context); - GP_CHECK_TEXT_STYLE(style); if (str == NULL) return GP_ENULLPTR;
if (style == NULL) style = &DefaultStyle; + + GP_CHECK_TEXT_STYLE(style);
int width = GP_TextWidth(style, str); int height = GP_TextHeight(style); @@ -145,13 +147,14 @@ GP_RetCode GP_BoxCenteredText_Raw(GP_Context *context, const GP_TextStyle *style const char *str, GP_Pixel pixel) { GP_CHECK_CONTEXT(context); - GP_CHECK_TEXT_STYLE(style);
if (str == NULL) return GP_ENULLPTR;
if (style == NULL) style = &DefaultStyle; + + GP_CHECK_TEXT_STYLE(style);
const int mid_x = x + w/2; const int mid_y = y + h/2; @@ -168,13 +171,14 @@ GP_RetCode GP_BoxCenteredText(GP_Context *context, const GP_TextStyle *style, const char *str, GP_Pixel pixel) { GP_CHECK_CONTEXT(context); - GP_CHECK_TEXT_STYLE(style);
if (str == NULL) return GP_ENULLPTR;
if (style == NULL) style = &DefaultStyle; + + GP_CHECK_TEXT_STYLE(style);
const int mid_x = x + w/2; const int mid_y = y + h/2;
-----------------------------------------------------------------------
Summary of changes: libs/text/GP_Text.c | 12 ++++++++---- tests/SDL/input.c | 40 +++++++++++++++++----------------------- 2 files changed, 25 insertions(+), 27 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.