gint xapplet = 0, yapplet = 0;
Scene scene;
+gint hour=8;
+gint min=0;
+gint ttt = 0;
static void
lw_applet_realize (GtkWidget *widget)
gint
probability_plane()
{
- return (fast_rnd(10) + 1) * 60;
+ return (fast_rnd(60));
// return 0;
}
actor->visible = TRUE;
create_hildon_actor(actor, desktop_plugin);
}
- get_sun_pos(&alt, &azm);
+ get_sun_pos(hour, min, &alt, &azm);
get_sun_screen_pos(alt, azm, &x, &y);
actor->x = x;
actor->y = y;
actor_set_position_full(actor->widget, x, y, actor->z);
//probability_sun(actor);
- actor->time_start_animation = time(NULL) + probability_sun();
+ actor->time_start_animation = time(NULL);
}else if (actor->visible){
actor->visible = FALSE;
destroy_hildon_actor(actor);
suseconds_t ms;
long sec;
double t;
+ gchar *newfile;
//fprintf(stderr, "change tram\n");
gettimeofday(&tvb, NULL);
if (!actor->visible){
actor->visible = TRUE;
- if (scene.daytime == TIME_NIGHT){
+ if (scene.daytime == TIME_NIGHT || (hour > 20 || hour < 6)){
if (actor->filename)
g_free(actor->filename);
actor->filename = g_strdup("tram_dark.png");
}
create_hildon_actor(actor, desktop_plugin);
}
+ if (scene.daytime == TIME_NIGHT || (hour > 20 || hour < 6)){
+ newfile = g_strdup("tram_dark.png");
+ }else{
+ newfile = g_strdup("tram.png");
+ }
+ if (strcmp(actor->filename, newfile)){
+ if (actor->filename)
+ g_free(actor->filename);
+ actor->filename = newfile;
+
+
+ change_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);
/* stop animation */
actor->visible = FALSE;
destroy_hildon_actor(actor);
- actor->time_start_animation = sec + fast_rnd(300);
+ actor->time_start_animation = sec + 20;
}
}
suseconds_t ms;
long sec;
double t;
+ gchar *newfile;
gettimeofday(&tvb, NULL);
actor->visible = TRUE;
create_hildon_actor(actor, desktop_plugin);
}
+if (scene.daytime == TIME_NIGHT || (hour > 20 || hour < 6)){
+ newfile = g_strdup("dot1.png");
+ }else{
+ newfile = g_strdup("tu154.png");
+ }
+ if (strcmp(actor->filename, newfile)){
+ if (actor->filename)
+ g_free(actor->filename);
+ actor->filename = newfile;
+
+
+ change_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);
+ //scale 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 (scene.daytime == TIME_NIGHT)
actor->time_start_animation = 0;
else
- actor->time_start_animation = sec + probability_plane();
+ actor->time_start_animation = sec + 10;
}
}
suseconds_t ms;
long sec;
double t;
+ gchar * newfile;
gettimeofday(&tvb, NULL);
actor->visible = TRUE;
create_hildon_actor(actor, desktop_plugin);
}
+if (scene.daytime == TIME_NIGHT || (hour > 20 || hour < 6)){
+ newfile = g_strdup("dot1.png");
+ }else{
+ newfile = g_strdup("plane3.png");
+ }
+ if (strcmp(actor->filename, newfile)){
+ if (actor->filename)
+ g_free(actor->filename);
+ actor->filename = newfile;
+
+
+ change_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);
if (scene.daytime == TIME_NIGHT)
actor->time_start_animation = 0;
else
- actor->time_start_animation = sec + probability_plane();
+ actor->time_start_animation = sec + 15;
}
}
if (!actor->visible){
actor->visible = TRUE;
- if (scene.daytime == TIME_NIGHT){
+ if (scene.daytime == TIME_NIGHT || (hour > 20 || hour < 6)){
newfile = g_strdup_printf("%s_dark.png", actor->name);
}else{
newfile = g_strdup_printf("%s.png", actor->name);
create_hildon_actor(actor, desktop_plugin);
}
+ if (scene.daytime == TIME_NIGHT || (hour > 20 || hour < 6)){
+ newfile = g_strdup_printf("%s_dark.png", actor->name);
+ }else{
+ newfile = g_strdup_printf("%s.png", actor->name);
+ }
+ if (strcmp(actor->filename, newfile)){
+ if (actor->filename)
+ g_free(actor->filename);
+ actor->filename = newfile;
+
+
+ change_hildon_actor(actor, desktop_plugin);
+ }
+
t = (double)((double)sec+(double)ms/1000000 - actor->time_start_animation) / actor->duration_animation;
if (scene.wind_orientation == 1){
/* stop animation */
actor->visible = FALSE;
destroy_hildon_actor(actor);
- actor->time_start_animation = sec + fast_rnd(300);
+ actor->time_start_animation = sec + 10;
actor->y = fast_rnd(300);
}
if (!actor->visible){
actor->visible = TRUE;
create_hildon_actor(actor, desktop_plugin);
- actor->time_start_animation = now + fast_rnd(60) + 10;
+ actor->time_start_animation = now + 10;
}else {
actor->visible = FALSE;
destroy_hildon_actor(actor);
- actor->time_start_animation = now + fast_rnd(60) + 10;
+ actor->time_start_animation = now + 10;
}
}
g_free(actor->filename);
actor->filename = newfile;
change_hildon_actor(actor, desktop_plugin);
- actor->time_start_animation = now + fast_rnd(30) + 10;
+ actor->time_start_animation = now + 5;
}
void
gint winds[13][2];
/* fprintf(stderr, "init scene \n");*/
- scene.daytime = get_daytime();
+ scene.daytime = get_daytime(hour, min);
scene.actors = NULL;
scene.wind_orientation = -1;
scene.wind_angle = 0.3;
// TRUE, 100, 255, NULL, NULL);
//scene.actors = g_slist_append(scene.actors, actor);
- actor = init_object(desktop_plugin, "cloud1", "cloud1.png", 0, fast_rnd(300)-97, 7, 150, 97,
+ actor = init_object(desktop_plugin, "cloud1", "cloud1.png", 0, 0, 7, 150, 97,
FALSE, 100, 255, (gpointer)&change_cloud, NULL);
- actor->time_start_animation = now + fast_rnd(180);
- actor->duration_animation = 3*60;
+ actor->time_start_animation = now;
+ actor->duration_animation = 1*60;
scene.actors = g_slist_append(scene.actors, actor);
- actor = init_object(desktop_plugin, "cloud2", "cloud2.png", 0, fast_rnd(300)-75, 7, 188, 75,
+ actor = init_object(desktop_plugin, "cloud2", "cloud2.png", 0, 80, 7, 188, 75,
FALSE, 100, 255, (gpointer)&change_cloud, NULL);
- actor->time_start_animation = now + fast_rnd(180);
- actor->duration_animation = 3*60;
+ actor->time_start_animation = now + 20;
+ actor->duration_animation = 1*60;
scene.actors = g_slist_append(scene.actors, actor);
- actor = init_object(desktop_plugin, "cloud4", "cloud4.png", 0, fast_rnd(300)-75, 7, 150, 75,
+ actor = init_object(desktop_plugin, "cloud4", "cloud4.png", 0, 30, 7, 150, 75,
FALSE, 100, 255, (gpointer)&change_cloud, NULL);
- actor->time_start_animation = now + fast_rnd(180);
- actor->duration_animation = 5*60;
+ actor->time_start_animation = now + 40;
+ actor->duration_animation = 1*60;
scene.actors = g_slist_append(scene.actors, actor);
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(10);
- actor->duration_animation = 60;
+ actor->time_start_animation = now;
+ actor->duration_animation = 40;
scene.actors = g_slist_append(scene.actors, actor);
actor = init_object(desktop_plugin, "border", "border0.png", 0, 480-79, 10, 800, 79,
FALSE, 100, 255, (gpointer)&change_moon, NULL);
change_moon(actor, desktop_plugin);
scene.actors = g_slist_append(scene.actors, actor);
-
+/*
actor = init_object(desktop_plugin, "wind", "", 0, 0, 5, 0, 0,
FALSE, 100, 255, (gpointer)&change_wind, NULL);
change_wind(actor, desktop_plugin);
scene.actors = g_slist_append(scene.actors, actor);
-
+*/
/* windows in 4-th house */
winds[0][0] = 482;
gint i;
gint winds[13][2];
- scene.daytime = get_daytime();
+ scene.daytime = get_daytime(hour, min);
scene.actors = NULL;
- scene.wind_orientation = -1;
+ scene.wind_orientation = 1;
scene.wind_angle = 0.3;
/* init value for random */
scene.seed = time(NULL);
change_moon(actor, desktop_plugin);
scene.actors = g_slist_append(scene.actors, actor);
- actor = init_object(desktop_plugin, "cloud1", "cloud1.png", 0, fast_rnd(300)-97, 7, 150, 97,
+ actor = init_object(desktop_plugin, "cloud1", "cloud1.png", 0, 300, 7, 150, 97,
FALSE, 100, 255, (gpointer)&change_cloud, NULL);
- actor->time_start_animation = now + fast_rnd(180);
- actor->duration_animation = 3*60;
+ actor->time_start_animation = now + 20;
+ actor->duration_animation = 1*60;
scene.actors = g_slist_append(scene.actors, actor);
- actor = init_object(desktop_plugin, "cloud2", "cloud2.png", 0, fast_rnd(300)-75, 7, 188, 75,
+ actor = init_object(desktop_plugin, "cloud2", "cloud2.png", 0, 100, 7, 188, 75,
FALSE, 100, 255, (gpointer)&change_cloud, NULL);
- actor->time_start_animation = now + fast_rnd(180);
- actor->duration_animation = 3*60;
+ actor->time_start_animation = now;
+ actor->duration_animation = 1*60;
scene.actors = g_slist_append(scene.actors, actor);
- actor = init_object(desktop_plugin, "cloud4", "cloud4.png", 0, fast_rnd(300)-75, 7, 150, 75,
+ actor = init_object(desktop_plugin, "cloud4", "cloud4.png", 0, 200, 7, 150, 75,
FALSE, 100, 255, (gpointer)&change_cloud, NULL);
- actor->time_start_animation = now + fast_rnd(180);
- actor->duration_animation = 5*60;
+ actor->time_start_animation = now + 40;
+ actor->duration_animation = 1*60;
scene.actors = g_slist_append(scene.actors, actor);
- actor = init_object(desktop_plugin, "plane2", "plane3.png", 0, 45, 8, 160, 50,
+ actor = init_object(desktop_plugin, "plane3", "plane3.png", 0, 45, 8, 160, 50,
FALSE, 100, 255, (gpointer)&change_plane2, NULL);
- actor->time_start_animation = now + probability_plane();
- actor->duration_animation = 60;
+ actor->time_start_animation = now + 20;
+ actor->duration_animation = 40;
scene.actors = g_slist_append(scene.actors, actor);
- actor = init_object(desktop_plugin, "plane1", "tu154.png", 620, 233, 9, 300, 116,
+ actor = init_object(desktop_plugin, "tu154", "tu154.png", 620, 233, 9, 300, 116,
FALSE, 100, 255, (gpointer)&change_plane1, NULL);
- actor->time_start_animation = now + probability_plane();
- actor->duration_animation = 30;
+ actor->time_start_animation = now;
+ actor->duration_animation = 20;
scene.actors = g_slist_append(scene.actors, actor);
actor = init_object(desktop_plugin, "town", "town.png", 0, 0, 10, 800, 480,
TRUE, 100, 255, (gpointer)&change_static_actor_with_corner, NULL);
change_static_actor_with_corner(actor, desktop_plugin);
scene.actors = g_slist_append(scene.actors, actor);
-
+/*
actor = init_object(desktop_plugin, "wind", "", 0, 0, 5, 0, 0,
FALSE, 100, 255, (gpointer)&change_wind, NULL);
change_wind(actor, desktop_plugin);
scene.actors = g_slist_append(scene.actors, actor);
-
+*/
actor = init_object(desktop_plugin, "signal", "red.png", 486, 425, 10, 18, 38,
TRUE, 100, 255, (gpointer)&change_signal, NULL);
- actor->time_start_animation = now + fast_rnd(30) + 10;
+ actor->time_start_animation = now;
scene.actors = g_slist_append(scene.actors, actor);winds[0][0] = 717;
winds[0][0] = 389;
static gboolean
short_timeout (AWallpaperPlugin *desktop_plugin)
{
- gint daytime = get_daytime();
+ //gint daytime = get_daytime();
GSList * tmp;
void (*pfunc)(gpointer, gpointer);
time_t now;
Actor *actor;
gboolean stop_flag = TRUE;
-
+
+ if (ttt == 1){
+ min ++;
+ if (min == 60){
+ hour ++;
+ min = 0;
+ if (hour == 23) hour = 0;
+ }
+ ttt = 0;
+ }else ttt ++;
if (!desktop_plugin->priv->visible || !desktop_plugin->priv->rich_animation){
desktop_plugin->priv->short_timer = 0;
return FALSE;
void
run_long_timeout(AWallpaperPlugin *desktop_plugin){
- gint daytime = get_daytime();
+ gint daytime = get_daytime(hour, min);
GSList * tmp;
void (*pfunc)(gpointer, gpointer);
time_t now;
Actor *actor;
+ //hour = hour + 1;
+ //min = 0;
+ //if (hour == 24) hour = 0;
+ fprintf(stderr, "---- %d:%d\n", hour, min);
+
//fprintf(stderr, "timer daytime=%d\n", daytime);
if (scene.daytime != daytime){