void
change_moon(Actor * actor, AWallpaperPlugin *desktop_plugin)
{
- gint daytime, phase;
+ gint phase;
char *newfile;
if (actor){
- daytime = get_daytime();
- if (daytime == TIME_NIGHT){
+ if (scene.daytime == TIME_NIGHT){
if (!actor->visible){
actor->visible = TRUE;
phase = get_moon_phase();
change_sun(Actor * actor, AWallpaperPlugin *desktop_plugin)
{
double alt, azm;
- gint x, y, daytime;
+ gint x, y;
if (actor){
- daytime = get_daytime();
- if (daytime != TIME_NIGHT){
+ if (scene.daytime != TIME_NIGHT){
if (!actor->visible){
actor->visible = TRUE;
}
}
+
static void
change_tram(Actor * actor, AWallpaperPlugin *desktop_plugin)
{
suseconds_t ms;
long sec;
double t;
- gint daytime = get_daytime();
gettimeofday(&tvb, NULL);
if (!actor->visible){
actor->visible = TRUE;
- if (daytime == TIME_NIGHT)
+ if (scene.daytime == TIME_NIGHT)
actor->filename = g_strdup("tram_dark.png");
else
actor->filename = g_strdup("tram.png");
suseconds_t ms;
long sec;
double t;
- gint daytime = get_daytime();
gettimeofday(&tvb, NULL);
if (!actor->visible){
actor->visible = TRUE;
- if (daytime == TIME_NIGHT)
+ if (scene.daytime == TIME_NIGHT)
actor->filename = g_strdup("tu154.png");
else
actor->filename = g_strdup("tu154.png");
suseconds_t ms;
long sec;
double t;
- gint daytime = get_daytime();
gettimeofday(&tvb, NULL);
if (!actor->visible){
actor->visible = TRUE;
- if (daytime == TIME_NIGHT)
+ if (scene.daytime == TIME_NIGHT)
actor->filename = g_strdup("plane3.png");
else
actor->filename = g_strdup("plane3.png");
}
void
+change_cloud(Actor *actor, AWallpaperPlugin *desktop_plugin)
+{
+ gint x0, y0 = 300, scale0 = 100,
+ x1, y1 = -actor->height, scale1 = 150,
+ x, y, scale;
+ struct timeval tvb;
+ suseconds_t ms;
+ long sec;
+ double t;
+
+ gettimeofday(&tvb, NULL);
+
+ ms = tvb.tv_usec;
+ sec = tvb.tv_sec;
+// fprintf(stderr, "1 %f - %d\n", sec+(double)ms/100000, now);
+
+ if (!actor->visible){
+ actor->visible = TRUE;
+ if (scene.daytime == TIME_NIGHT)
+ actor->filename = actor->filename;
+ else
+ actor->filename = actor->filename;
+ create_hildon_actor(actor, desktop_plugin);
+ }
+ t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
+
+ if (scene.wind_orientation == 1){
+ x0 = -actor->width;
+ x1 = 800;
+ }
+ else {
+ x0 = 800;
+ x1 = -actor->width;
+ }
+
+ x = path_line(x0, x1, t);
+ y = -scene.wind_angle * (x - x0) + actor->y;
+ scale = path_line(scale0, scale1, (double)(y - y0)/(y1 - y0));
+
+ //fprintf(stderr, "change cloud t=%f x=%d y=%d scale=%d\n", t, x, y, scale);
+ actor_set_position_full(actor->widget, x, y, actor->z);
+ hildon_animation_actor_set_scale(HILDON_ANIMATION_ACTOR(actor->widget), (double)scale/100, (double)scale/100);
+ if ((y < y1 || y > y0) || t >= 1){
+ /* stop animation */
+ actor->visible = FALSE;
+ destroy_hildon_actor(actor);
+ actor->time_start_animation = sec + 5*60;
+ }
+
+}
+
+void
create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin)
{
GtkWidget *ha = NULL;
scene.daytime = get_daytime();
scene.actors = NULL;
+ scene.wind_orientation = -1;
+ scene.wind_angle = 0.3;
actor = init_object(desktop_plugin, "sky", "sky.png", 0, 0, 5, 800, 480,
TRUE, 100, 255, (gpointer)&change_static_actor, NULL);
scene.actors = g_slist_append(scene.actors, actor);
- actor = init_object(desktop_plugin, "dot", "dot1.png", 0, 0, 10, 50, 50,
+ actor = init_object(desktop_plugin, "dot", "dot1.png", 0, 0, 11, 50, 50,
TRUE, 100, 255, NULL, NULL);
scene.actors = g_slist_append(scene.actors, actor);
- actor = init_object(desktop_plugin, "town", "town.png", 0, 0, 9, 800, 480,
+ actor = init_object(desktop_plugin, "town", "town.png", 0, 0, 10, 800, 480,
TRUE, 100, 255, (gpointer)&change_static_actor, NULL);
change_static_actor(actor, desktop_plugin);
scene.actors = g_slist_append(scene.actors, actor);
change_moon(actor, desktop_plugin);
scene.actors = g_slist_append(scene.actors, actor);
- actor = init_object(desktop_plugin, "plane2", "plane3.png", 0, 45, 7, 160, 50,
+ 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->duration_animation = 60;
scene.actors = g_slist_append(scene.actors, actor);
- actor = init_object(desktop_plugin, "plane1", "tu154_small.png", 620, 233, 8, 300, 116,
+ 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->duration_animation = 30;
scene.actors = g_slist_append(scene.actors, actor);
+ actor = init_object(desktop_plugin, "cloud1", "cloud2.png", 0, 50, 11, 188, 75,
+ FALSE, 100, 255, (gpointer)&change_cloud, NULL);
+ actor->time_start_animation = time(NULL) + 5;
+ actor->duration_animation = 5*60;
+ scene.actors = g_slist_append(scene.actors, actor);
+
}