#define ARENA_WIDTH 25
#define ARENA_HEIGHT 12
-const int amount_of_random_stuff = 1;
+const int amount_of_random_stuff = 15;
typedef enum {
STATE_PROLOGUE,
r = random() % nki_count;
}
while (used[r]);
-
used[r] = TRUE;
+
return g_slist_nth_data (nki, r);
}
}
fclose (nki_file);
-
- used = g_malloc0 (nki_count);
}
void
gboolean animation_running = FALSE;
+/*
+static gboolean
+love_animation_draw
+*/
static gboolean
ending_animation_quit (gpointer data)
{
static GdkGC *gc = NULL;
const int stepsize = 3;
+ static int love_size = 40;
if (!kitten_x)
{
-1, -1,
GDK_RGB_DITHER_NONE, 0, 0);
- cycle_count++;
- robot_x += stepsize;
- kitten_x -= stepsize;
-
- if (robot_x+robot_stop >= kitten_x)
+ if (robot_x+robot_stop < kitten_x)
+ {
+ cycle_count++;
+ robot_x += stepsize;
+ kitten_x -= stepsize;
+ }
+ else
{
+ GdkPixbuf *scaled_love_pic =
+ gdk_pixbuf_scale_simple (love_pic,
+ love_size,
+ love_size,
+ GDK_INTERP_BILINEAR);
+
gdk_draw_pixbuf (GDK_DRAWABLE(widget->window),
gc,
- love_pic, 0, 0,
+ scaled_love_pic, 0, 0,
robot_x + gdk_pixbuf_get_width (robot_pic), all_y,
-1, -1,
GDK_RGB_DITHER_NONE, 0, 0);
- animation_running = FALSE;
-
- g_timeout_add (2000, ending_animation_quit, NULL);
+ love_size ++;
- gdk_gc_unref (gc);
- cycle_count = 0;
- robot_x = 0;
- robot_stop = 0;
- kitten_x = 0;
- all_y = 0;
- gc = NULL;
+ if (love_size >= gdk_pixbuf_get_width (love_pic))
+ {
+ animation_running = FALSE;
+
+ g_timeout_add (2000, ending_animation_quit, NULL);
+
+ gdk_gc_unref (gc);
+ love_size = 40;
+ cycle_count = 0;
+ robot_x = 0;
+ robot_stop = 0;
+ kitten_x = 0;
+ all_y = 0;
+ gc = NULL;
+ }
}
return TRUE;
}
}
+ if (keyval=='d' && event->state & GDK_CONTROL_MASK)
+ {
+ /* secret debugging key */
+ show_message (gtk_label_get_text (GTK_LABEL (kitten)));
+ }
+
return FALSE;
}
{
/* make everything new */
+ g_free (used);
+ used = g_malloc0 (nki_count * sizeof(gboolean));
+
robot = gtk_label_new ("#");
g_object_ref (robot);
kitten = random_character ("You found kitten! Way to go, robot!");