nothing
[livewp] / applet / src / livewp-home-widget.c
index 643d9ee..3cde353 100644 (file)
@@ -463,6 +463,7 @@ change_cloud(Actor *actor, AWallpaperPlugin *desktop_plugin)
     suseconds_t ms;
     long sec;
     double t;
+    gchar *newfile;
 
     //fprintf(stderr, "change cloud\n");
     gettimeofday(&tvb, NULL);
@@ -473,10 +474,16 @@ change_cloud(Actor *actor, AWallpaperPlugin *desktop_plugin)
    
     if (!actor->visible){
         actor->visible = TRUE;
-        if (scene.daytime == TIME_NIGHT)
-            actor->filename = actor->filename;
-        else
-            actor->filename = actor->filename;
+        if (scene.daytime == TIME_NIGHT){
+            newfile = g_strdup_printf("%s_dark.png", actor->name);
+        }else{
+            newfile = g_strdup_printf("%s.png", actor->name);
+        } 
+        if (actor->filename)
+            g_free(actor->filename);
+        actor->filename = newfile;
+         
+
         create_hildon_actor(actor, desktop_plugin);
     }
     t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
@@ -686,6 +693,16 @@ change_static_actor_with_corner(Actor * actor, AWallpaperPlugin *desktop_plugin)
 
 }
 
+void
+change_layer1(Actor * actor, AWallpaperPlugin *desktop_plugin)
+{
+    gint y;
+    y = actor->y + 20;
+    if (y > 480) y = -480;
+    //fprintf(stderr, "!! %s - %d\n", actor->name, y);
+    actor_set_position_full(actor->widget, actor->x, y, actor->z);
+    actor->y = y;
+}
 
 /*
 static gint 
@@ -724,9 +741,50 @@ reload_scene(AWallpaperPlugin *desktop_plugin)
         init_scene(desktop_plugin);
     else if (!strcmp(desktop_plugin->priv->theme,"Berlin")) 
         init_scene1(desktop_plugin);
+    else if (!strcmp(desktop_plugin->priv->theme,"Modern")) 
+        init_scene1(desktop_plugin);
+
 }
 
+static void
+init_scene2(AWallpaperPlugin *desktop_plugin)
+{
+  Actor *actor;
+  gint now = time(NULL);
 
+  /* fprintf(stderr, "init scene \n");*/
+  scene.daytime = get_daytime();
+  scene.actors = NULL;
+  scene.wind_orientation = -1;
+  scene.wind_angle = 0.3;
+  /* init value for random */
+  scene.seed = time(NULL);
+
+  
+
+  actor = init_object(desktop_plugin, "background", "33.png", 0, 0, 5, 800, 480, 
+                      TRUE, 100, 255, NULL, NULL);
+  scene.actors = g_slist_append(scene.actors, actor);
+
+  actor = init_object(desktop_plugin, "layer1", "11.png", 0, -480, 6, 800, 1920, 
+                      TRUE, 100, 255, (gpointer)&change_layer1, NULL);
+  actor->time_start_animation = now;
+  actor->duration_animation = G_MAXINT;
+  scene.actors = g_slist_append(scene.actors, actor);
+
+  actor = init_object(desktop_plugin, "layer2", "111.png", 0, -480 - 480, 6, 800, 1920, 
+                      TRUE, 100, 255, (gpointer)&change_layer1, NULL);
+  actor->time_start_animation = now;
+  actor->duration_animation = G_MAXINT;
+  scene.actors = g_slist_append(scene.actors, actor);
+
+  actor = init_object(desktop_plugin, "symbols", "22.png", 0, 0, 7, 800, 480, 
+                      TRUE, 100, 255, NULL, NULL);
+  scene.actors = g_slist_append(scene.actors, actor);
+  
+
+    run_long_timeout(desktop_plugin);
+}
 /* Init Modern Scene */
 static void
 init_scene(AWallpaperPlugin *desktop_plugin)
@@ -788,7 +846,7 @@ init_scene(AWallpaperPlugin *desktop_plugin)
 
   actor = init_object(desktop_plugin, "tram", "tram.png", -300, 225, 9, 350, 210, 
                       FALSE, 100, 255, (gpointer)&change_tram, NULL);
-  actor->time_start_animation = time(NULL) + fast_rnd(60);
+  actor->time_start_animation = time(NULL) + fast_rnd(10); 
   actor->duration_animation = 60;
   scene.actors = g_slist_append(scene.actors, actor);
 
@@ -885,7 +943,7 @@ init_scene(AWallpaperPlugin *desktop_plugin)
     for (i=0; i<8; i++){
         actor = init_object(desktop_plugin, "window2", "window2.png", 
                             winds[i][0], winds[i][1], 8, 8, 10, 
-                            TRUE, 100, 255, (gpointer)&change_window1, NULL);
+                            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);
@@ -997,6 +1055,7 @@ init_scene(AWallpaperPlugin *desktop_plugin)
 
     }
 
+    run_long_timeout(desktop_plugin);
 #if 0    
   anim = g_new0(Animation, 1);
   anim->count = 1;
@@ -1145,6 +1204,8 @@ init_scene1(AWallpaperPlugin *desktop_plugin)
         scene.actors = g_slist_append(scene.actors, actor);
 
     }
+    
+    run_long_timeout(desktop_plugin);
 
 }
 
@@ -1417,6 +1478,8 @@ animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin)
         init_scene(desktop_plugin);
     else if (!strcmp(priv->theme,"Berlin")) 
         init_scene1(desktop_plugin);
+    else if (!strcmp(priv->theme, "Matrix"))
+        init_scene2(desktop_plugin);
     priv->long_timer = g_timeout_add(LONG_TIMER, (GtkFunction)long_timeout, desktop_plugin);
     priv->short_timer = 0;
     /* TODO Move scene to priv */