]> git.cworth.org Git - wordgame/blobdiff - demo-item.c
Add back randomization
[wordgame] / demo-item.c
index 99aaf4afa856a24213c2ea26841e323fe625d6e8..4a9bbfdd6b43320db6d7fc3e3f83f31efadbe39c 100644 (file)
@@ -32,6 +32,17 @@ goo_demo_item_move_to (GooCanvasItem *item,
     goo_canvas_item_set_transform (item, &matrix);
 }
 
+void
+goo_demo_item_glide_to (GooCanvasItem  *item,
+                       gdouble          x,
+                       gdouble          y)
+{
+    goo_canvas_item_animate (item, x, y,
+                            1.0, 0,
+                            1000, 40,
+                            GOO_CANVAS_ANIMATE_FREEZE);
+}
+
 /* The convenience function to create new items. This should start with a 
    parent argument and end with a variable list of object properties to fit
    in with the standard canvas items. */
@@ -104,6 +115,7 @@ goo_demo_item_paint (GooCanvasItemSimple *simple,
     int rad = (int) (item->size / 2);
     int cx = item->size / 2;
     int cy = cx;
+    int tx, ty;
     double spot_angle = M_PI / 4.0;
     double spot_rad = rad / 2.0;
     char string[2];
@@ -135,11 +147,19 @@ goo_demo_item_paint (GooCanvasItemSimple *simple,
     string[0] = item->letter;
     string[1] = '\0';
     cairo_text_extents (cr, string, &extents);
-    cairo_move_to (cr,
-                  cx - extents.width / 2 - extents.x_bearing,
-                  cy - extents.height / 2 - extents.y_bearing);
+    tx = cx - extents.width / 2 - extents.x_bearing;
+    ty = cy - extents.height / 2 - extents.y_bearing;
+
+    cairo_set_source_rgb (cr, 0.7, 0.7, 0.7);
+    cairo_move_to (cr, tx + 1, ty + 1);
+    cairo_show_text (cr, string);
+               
+    cairo_set_source_rgb (cr, 0.33, 0.33, 0.33);
+    cairo_move_to (cr, tx - 1, ty - 1);
+    cairo_show_text (cr, string);
 
     cairo_set_source_rgb (cr, 0.2, 0.3, 0.8);
+    cairo_move_to (cr, tx, ty);
     cairo_show_text (cr, string);
 
     cairo_restore (cr);