added change windows
authorTanya <tanya@bookdmitri.oblgaz>
Mon, 12 Apr 2010 23:11:24 +0000 (02:11 +0300)
committerTanya <tanya@bookdmitri.oblgaz>
Mon, 12 Apr 2010 23:11:24 +0000 (02:11 +0300)
applet/src/livewp-home-widget.c

index b2a7c68..951a003 100644 (file)
@@ -514,6 +514,36 @@ change_wind(Actor *actor, AWallpaperPlugin *desktop_plugin)
     fprintf(stderr, "change wind orient = %d angle = %f after = %d\n", scene.wind_orientation, scene.wind_angle, actor->time_start_animation-time(NULL));
 }
 
+void 
+change_window1(Actor * actor, AWallpaperPlugin *desktop_plugin)
+{
+    
+    gint now = time(NULL);
+
+    if (scene.daytime == TIME_DAY){
+        if (actor->visible){
+            actor->visible = FALSE;
+            destroy_hildon_actor(actor);
+        }
+        actor->time_start_animation = 0;
+        return;
+    }else if (actor->time_start_animation == 0){
+        actor->time_start_animation = now + fast_rnd(30);
+        return;
+    }
+
+    if (!actor->visible){
+        actor->visible = TRUE;
+        create_hildon_actor(actor, desktop_plugin);
+        actor->time_start_animation = now + fast_rnd(20) + 10;
+    }else {
+        actor->visible = FALSE;
+        destroy_hildon_actor(actor);
+        actor->time_start_animation = now + fast_rnd(20) + 10;
+    }
+   
+}
+
 void
 create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin) 
 {
@@ -685,7 +715,7 @@ init_scene(AWallpaperPlugin *desktop_plugin)
 
   actor = init_object(desktop_plugin, "sun", "sun.png", 0, 0, 6, 88, 88, 
                       TRUE, 100, 255, (gpointer)&change_sun, &probability_sun);
-  actor->time_start_animation = time(NULL);
+  actor->time_start_animation = now;
   actor->duration_animation = G_MAXINT;
   change_sun(actor, desktop_plugin);
   scene.actors = g_slist_append(scene.actors, actor);
@@ -739,6 +769,56 @@ init_scene(AWallpaperPlugin *desktop_plugin)
   change_wind(actor, desktop_plugin);
   scene.actors = g_slist_append(scene.actors, actor);
 
+    /* windows in 4-th house  */
+    gint winds[13][2];
+    winds[0][0] = 482;
+    winds[0][1] = 180;
+
+    winds[1][0] = 495;
+    winds[1][1] = 179;
+
+    winds[2][0] = 482;
+    winds[2][1] = 191;
+
+    winds[3][0] = 495;
+    winds[3][1] = 190;
+    
+    winds[4][0] = 482;
+    winds[4][1] = 201;
+    
+    winds[5][0] = 495;
+    winds[5][1] = 210;
+    
+    winds[6][0] = 482;
+    winds[6][1] = 222;
+    
+    winds[7][0] = 495;
+    winds[7][1] = 221;
+    
+    winds[8][0] = 459;
+    winds[8][1] = 203;
+    
+    winds[9][0] = 495;
+    winds[9][1] = 241;
+    
+    winds[10][0] = 495;
+    winds[10][1] = 252;
+    
+    winds[11][0] = 482;
+    winds[11][1] = 273;
+    
+    winds[12][0] = 495;
+    winds[12][1] = 303;
+    gint i;
+    for (i=0; i<13; i++){
+        actor = init_object(desktop_plugin, "window1", "window1.png", 
+                            winds[i][0], winds[i][1], 8, 8, 10, 
+                            FALSE, 100, 255, (gpointer)&change_window1, NULL);
+        //change_window1(actor, desktop_plugin);
+        actor->time_start_animation = now + fast_rnd(30);
+        scene.actors = g_slist_append(scene.actors, actor);
+
+    }
 #if 0    
   anim = g_new0(Animation, 1);
   anim->count = 1;