]> git.cworth.org Git - kub/commitdiff
Add some cairo drawing (just a solid, red rectangle)
authorCarl Worth <cworth@cworth.org>
Wed, 14 Feb 2007 17:26:08 +0000 (09:26 -0800)
committerCarl Worth <cworth@cworth.org>
Wed, 14 Feb 2007 17:26:08 +0000 (09:26 -0800)
This is the minimal necessary code to be able to start drawing
with cairo.

kub.c

diff --git a/kub.c b/kub.c
index cf3c8958872d90d99df54dc78abd18ebc51ab723..326856bfc326d954394e55a27169b93728ef17c8 100644 (file)
--- a/kub.c
+++ b/kub.c
@@ -303,7 +303,15 @@ static void game_init(game_t *game)
 
 static gboolean on_expose_event (GtkWidget *widget, GdkEventExpose *event, game_t *game)
 {
-    printf ("I should be drawing something here\n");
+    cairo_t *cr;
+
+    cr = gdk_cairo_create (widget->window);
+
+    cairo_set_source_rgb (cr, 1, 0, 0); /* red */
+    cairo_rectangle (cr, 86, 66, 74, 103);
+    cairo_fill (cr);
+
+    cairo_destroy (cr);
 
     return TRUE;
 }