#include <gconf/gconf-client.h>
#include "livewp-rules.h"
#include <sys/time.h>
+#include <stdlib.h>
#define PLUGIN_NAME "livewp-home-widget.desktop-0"
#define GCONF_KEY_POSITION "/apps/osso/hildon-desktop/applets/%s/position"
return actor;
}
+gint
+rnd(gint max)
+{
+ srand(time(NULL));
+ return rand() % max;
+}
+gint seed = 0;
+gint fast_rnd(gint max)
+{
+ gint offset = 12923;
+ gint multiplier = 4079;
+
+ seed = seed * multiplier + offset;
+ return (gint)(seed % max);
+}
+
+
+gint
+probability_plane()
+{
+ gint t = (fast_rnd(10) + 1) * 60;
+ fprintf(stderr, "probability_plane %d\n", t);
+ return t;
+}
+
void
change_moon(Actor * actor, AWallpaperPlugin *desktop_plugin)
{
/* stop animation */
actor->visible = FALSE;
destroy_hildon_actor(actor);
- actor->time_start_animation = sec + 5*60;
+ actor->time_start_animation = sec + probability_plane();
}
}
/* stop animation */
actor->visible = FALSE;
destroy_hildon_actor(actor);
- actor->time_start_animation = sec + 5*60;
+ actor->time_start_animation = sec + probability_plane();
}
}
actor->time_start_animation += 20 * 1;
actor->duration_animation = G_MAXINT;
}
+
+
/* Init Modern Scene */
static void
init_scene(AWallpaperPlugin *desktop_plugin)
init_scene1(AWallpaperPlugin *desktop_plugin)
{
Actor *actor;
+ gint now = time(NULL);
+
+ seed = time(NULL)%10;
scene.daytime = get_daytime();
scene.actors = NULL;
actor = init_object(desktop_plugin, "plane2", "plane3.png", 0, 45, 8, 160, 50,
FALSE, 100, 255, (gpointer)&change_plane2, NULL);
- actor->time_start_animation = time(NULL) + 5;
+ actor->time_start_animation = now + probability_plane();
actor->duration_animation = 60;
scene.actors = g_slist_append(scene.actors, actor);
actor = init_object(desktop_plugin, "plane1", "tu154_small.png", 620, 233, 9, 300, 116,
FALSE, 100, 255, (gpointer)&change_plane1, NULL);
- actor->time_start_animation = time(NULL) + 60;
+ actor->time_start_animation = now + probability_plane();
actor->duration_animation = 30;
scene.actors = g_slist_append(scene.actors, actor);
actor = init_object(desktop_plugin, "cloud1", "cloud2.png", 0, 50, 7, 188, 75,
FALSE, 100, 255, (gpointer)&change_cloud, NULL);
- actor->time_start_animation = time(NULL) + 5;
+ actor->time_start_animation = now + 5;
actor->duration_animation = 5*60;
scene.actors = g_slist_append(scene.actors, actor);
priv->short_timer = 0;
/* TODO Move scene to priv */
scene.timer_type = LONG_TIMER_TYPE;
-
+
//sleep(2);
}