added plane in Berlin
[livewp] / applet / src / livewp-home-widget.c
index 40efb0a..5918eba 100644 (file)
@@ -293,14 +293,13 @@ change_tram(Actor * actor, AWallpaperPlugin *desktop_plugin)
     struct timeval tvb;     
     suseconds_t ms;
     long sec;
+    double t;
+    gint daytime = get_daytime();
 
     gettimeofday(&tvb, NULL);
     
-    gint daytime = get_daytime();
     ms = tvb.tv_usec;
     sec = tvb.tv_sec;
-    time_t now = time(NULL);
-    double t;
 //    fprintf(stderr, "1 %f - %d\n", sec+(double)ms/100000, now);
    
     if (!actor->visible){
@@ -322,9 +321,52 @@ change_tram(Actor * actor, AWallpaperPlugin *desktop_plugin)
         /* stop animation */
         actor->visible = FALSE;
         destroy_hildon_actor(actor);
-        actor->time_start_animation = now + 5*60;
+        actor->time_start_animation = sec + 5*60;
+    }
+}
+
+void
+change_plane(Actor *actor, AWallpaperPlugin *desktop_plugin)
+{
+    gint x0 = 620, y0 = 233, scale0 = 100,
+         x1 = 79, y1 = -146, scale1 = 100, 
+         x, y, scale;
+    struct timeval tvb;     
+    suseconds_t ms;
+    long sec;
+    double t;
+    gint daytime = get_daytime();
+
+    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 (daytime == TIME_NIGHT)
+            actor->filename = g_strdup("tu154.png");
+        else
+            actor->filename = g_strdup("tu154.png");
+        create_hildon_actor(actor, desktop_plugin);
+    }
+    t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
+    x = path_line(x0, x1, t);
+    y = path_line(y0, y1, t);
+    //scale = path_line(scale0, scale1, t);
+    //fprintf(stderr, "change tram 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 (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) 
 {
@@ -547,35 +589,28 @@ init_scene1(AWallpaperPlugin *desktop_plugin)
   actor->duration_animation = G_MAXINT;
   change_sun(actor, desktop_plugin);
   scene.actors = g_slist_append(scene.actors, actor);
+
+#if 0
   actor = init_object(desktop_plugin, "dot", "dot1.png", 0, 0, 9, 50, 50, 
                       TRUE, 100, 255, NULL, NULL);
   scene.actors = g_slist_append(scene.actors, actor);
+#endif
 
-
-  actor = init_object(desktop_plugin, "town", "town.png", 0, 0, 7, 800, 480, 
+  actor = init_object(desktop_plugin, "town", "town.png", 0, 0, 8, 800, 480, 
                       TRUE, 100, 255, (gpointer)&change_static_actor, NULL);
   change_static_actor(actor, desktop_plugin);
   scene.actors = g_slist_append(scene.actors, actor);
 
-  actor = init_object(desktop_plugin, "moon", "moon1.png", 400, 15, 8, 60, 60, 
+  actor = init_object(desktop_plugin, "moon", "moon1.png", 400, 15, 6, 60, 60, 
                       FALSE, 100, 255, (gpointer)&change_moon, NULL);
   change_moon(actor, desktop_plugin);
   scene.actors = g_slist_append(scene.actors, actor);
-  //scene.dynamic_actors = g_slist_append(scene.dynamic_actors, G_OBJECT(actor));
-   /*
-  actor = init_object("cloud1", 400, 150, 2, 200, 150, NULL);
-  scene.dynamic_actors = g_slist_append(scene.dynamic_actors, G_OBJECT(actor));
-
-  actor = init_object("sun", 10, 10, 50, 88, 88, NULL);
-  list = g_slist_append(list, G_OBJECT(actor));
-  actor = init_object("cloud1", 50, 50, 49, 150, 100, NULL);
-  list = g_slist_append(list, G_OBJECT(actor));
-
-  ma1 = multiactor_init("multi", list, 0, 0, 50, 1.0, TRUE);
-  //objects_list = g_slist_append(objects_list, G_OBJECT(ma)); 
-  */
+  
+  actor = init_object(desktop_plugin, "plane1", "tu154.png", 620, 233, 7, 379, 146, 
+                      FALSE, 100, 255, (gpointer)&change_plane, NULL);
+  actor->time_start_animation = time(NULL) + 10;
+  actor->duration_animation = 60;
+  scene.actors = g_slist_append(scene.actors, actor);
 
 }