[cairo-commit] cairo-demo/svgspacewar ChangeLog, 1.9, 1.10 svgspacewar.c, 1.7, 1.8

Behdad Esfahbod commit at pdx.freedesktop.org
Fri Jan 12 13:46:19 PST 2007


Committed by: behdad

Update of /cvs/cairo/cairo-demo/svgspacewar
In directory kemper:/tmp/cvs-serv20141

Modified Files:
	ChangeLog svgspacewar.c 
Log Message:
2007-01-12  Behdad Esfahbod  <behdad at behdad.org>

        From Nigel Tao <nigel.tao at myrealbox.com>:

        * svgspacewar.c (draw_turning_flare): Update to latest cairo API
        semantics, to work again.

        * svgspacewar.c (on_key_event): Make it work with arrow keys, not
        keypad.



Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-demo/svgspacewar/ChangeLog,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ChangeLog	20 Aug 2005 01:44:08 -0000	1.9
+++ ChangeLog	12 Jan 2007 21:46:14 -0000	1.10
@@ -1,3 +1,13 @@
+2007-01-12  Behdad Esfahbod  <behdad at behdad.org>
+
+	From Nigel Tao <nigel.tao at myrealbox.com>:
+
+	* svgspacewar.c (draw_turning_flare): Update to latest cairo API
+	semantics, to work again.
+
+	* svgspacewar.c (on_key_event): Make it work with arrow keys, not
+	keypad.
+
 2005-08-19  Behdad Esfahbod  <behdad at behdad.org>
 
 	* README: Added.  Noted that gtk+ >= 2.7.0 is required.

Index: svgspacewar.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/svgspacewar/svgspacewar.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- svgspacewar.c	12 Aug 2005 04:57:27 -0000	1.7
+++ svgspacewar.c	12 Jan 2007 21:46:14 -0000	1.8
@@ -544,25 +544,26 @@
 draw_turning_flare (cairo_t * cr, RGB_t color, int right_hand_side)
 {
   cairo_pattern_t *pat;
-
   cairo_save (cr);
-  pat = cairo_pattern_create_radial (0, 0, 1, 0, 0, 7);
 
+  cairo_translate (cr, -23 * right_hand_side, 28);
+  pat = cairo_pattern_create_radial (0, 0, 1, 0, 0, 7);
   cairo_pattern_add_color_stop_rgba (pat, 0.0, 1, 1, 1, 1);
   cairo_pattern_add_color_stop_rgba (pat, 1.0, color.r, color.g, color.b, 0);
   cairo_set_source (cr, pat);
-
-  cairo_save (cr);
-  cairo_translate (cr, -23 * right_hand_side, 28);
   cairo_arc (cr, 0, 0, 7, 0, TWO_PI);
   cairo_fill (cr);
-  cairo_restore (cr);
+  cairo_pattern_destroy (pat);
 
-  cairo_translate (cr, 19 * right_hand_side, 7);
+  cairo_translate (cr, 42 * right_hand_side, -22);
+  pat = cairo_pattern_create_radial (0, 0, 1, 0, 0, 7);
+  cairo_pattern_add_color_stop_rgba (pat, 0.0, 1, 1, 1, 1);
+  cairo_pattern_add_color_stop_rgba (pat, 1.0, color.r, color.g, color.b, 0);
+  cairo_set_source (cr, pat);
   cairo_arc (cr, 0, 0, 5, 0, TWO_PI);
   cairo_fill (cr);
-
   cairo_pattern_destroy (pat);
+
   cairo_restore (cr);
 }
 
@@ -1099,15 +1100,19 @@
       player1.is_firing = key_is_on;
       break;
 
+    case GDK_Left:
     case GDK_KP_Left:
       player2.is_turning_left = key_is_on;
       break;
+    case GDK_Right:
     case GDK_KP_Right:
       player2.is_turning_right = key_is_on;
       break;
+    case GDK_Up:
     case GDK_KP_Up:
       player2.is_thrusting = key_is_on;
       break;
+    case GDK_Control_R:
     case GDK_KP_Insert:
       player2.is_firing = key_is_on;
       break;



More information about the cairo-commit mailing list