daytime = get_daytime();
name = g_object_get_data(G_OBJECT(actor), "name");
- snprintf(newfile, 2047, "%s/%s/%s%i.png", THEME_PATH, desktop_plugin->priv->theme, name, daytime);
+ snprintf(newfile, 2047, "%s/%s/%s%d.png", THEME_PATH, desktop_plugin->priv->theme, name, daytime);
pixbuf = gdk_pixbuf_new_from_file_at_size (newfile,
g_object_get_data(G_OBJECT(actor), "width"),
x = path_line(x0, x1, t);
y = path_line(y0, y1, t);
scale = path_line(scale0, scale1, t);
- fprintf(stderr, "path tram: t=%f, x=%i, y=%i, scale=%i\n", t, x, y, scale);
+ fprintf(stderr, "path tram: t=%f, x=%d, y=%d, scale=%d\n", t, x, y, scale);
actor_set_position_full(actor, x, y, g_object_get_data(G_OBJECT(actor), "z"));
hildon_animation_actor_set_scale(actor, (double)scale/100, (double)scale/100);
}
init_scene1(desktop_plugin);
}
-Animation anim;
-
void
anim_tram(GtkWidget *actor, Animation * an)
{
gint x, y;
GSList * list = NULL;
gchar str[256];
+ Animation *anim = NULL;
-fprintf(stderr, "init scene \n");
+fprintf(stderr, "init scene modern\n");
scene.daytime = get_daytime();
scene.dynamic_actors = NULL;
scene.static_actors = NULL;
//actor = init_object("tram", "tram.png", -300, 191, 25, 350, 210, 1, 100, 255, NULL);
actor = init_object(desktop_plugin, "tram", "tram_dark.png", -300, 225, 25, 350, 210, 1, 100, 255, NULL);
//scene.dynamic_actors = g_slist_append(scene.dynamic_actors, G_OBJECT(actor));
- anim.count = 2;
- anim.actor = actor;
- anim.func_change = &change_tram;
- anim.func_time = NULL;
- anim.timestart = time(NULL);
- anim.timeall = 20;
+
+ anim = g_new0(Animation, 1);
+ anim->count = 1;
+ anim->actor = actor;
+ anim->func_change = &change_tram;
+ anim->func_time = NULL;
+ anim->timestart = time(NULL);
+ anim->timeall = 10;
+
+ scene.dynamic_actors = g_slist_append(scene.dynamic_actors, anim);
+
}
static void
init_scene1(AWallpaperPlugin *desktop_plugin)
GSList * tmp;
gchar * name;
void (*pfunc)(gpointer, gpointer);
-
- if (scene.daytime == daytime){
- /* Change dynamic actors */
- tmp = scene.dynamic_actors;
- }else {
- /* Change static actors */
+ time_t now;
+ gint t;
+ Animation *anim = NULL;
+
+ if (scene.daytime != daytime){
tmp = scene.static_actors;
- }
- while (tmp != NULL){
- //change_actor(tmp->data);
- pfunc = g_object_get_data(G_OBJECT(tmp->data), "func");
- name = g_object_get_data(G_OBJECT(tmp->data), "name");
- if (name == "tram"){
- if (pfunc)
- (*pfunc)(tmp->data, ttt);
- ttt = get_time(ttt+1);
- if (ttt >= 100) ttt = 0;
- }else
- if (pfunc){
- (*pfunc)(tmp->data, NULL);
+ while (tmp != NULL){
+ //change_actor(tmp->data);
+ pfunc = g_object_get_data(G_OBJECT(tmp->data), "func");
+ /*name = g_object_get_data(G_OBJECT(tmp->data), "name");
+ if (name == "tram"){
+ if (pfunc)
+ (*pfunc)(tmp->data, ttt);
+ ttt = get_time(ttt+1);
+ if (ttt >= 100) ttt = 0;
+ }else*/
+ if (pfunc){
+ (*pfunc)(tmp->data, NULL);
+ }
+ tmp = g_slist_next(tmp);
}
- tmp = g_slist_next(tmp);
- }
-
- // if (anim){
- time_t now;
- now = time(NULL);
- gint t = now - anim.timestart;
- if (t > anim.timeall){
- anim.timestart = now;
- if (anim.count != -1) anim.count--;
- if (anim.count == 0) return;
+ }
+ tmp = scene.dynamic_actors;
+ now = time(NULL);
+
+ while (tmp != NULL)
+ {
+ anim = tmp->data;
+ if (anim == NULL) fprintf(stderr, "get anim\n");
+ t = now - anim->timestart;
+ if (t > anim->timeall){
+ anim->timestart = now;
+ if (anim->count != -1) anim->count--;
+
}
- if (anim.count != 0) {
- if (anim.func_time ) t = (*anim.func_time)(t);
- if (anim.func_change) (*anim.func_change)(anim.actor, (double)t/anim.timeall);
+ if (anim->count == 0){
+ g_free(anim);
+ scene.dynamic_actors = g_slist_remove(scene.dynamic_actors, anim);
+ //tmp->data = NULL;
+ tmp = scene.dynamic_actors;
+ fprintf(stderr, "delete anim %d\n", g_slist_length(tmp));
+
+ }else {
+ if (anim->func_time ) t = (*anim->func_time)(t);
+ if (anim->func_change) (*anim->func_change)(anim->actor, (double)t/anim->timeall);
+ tmp = g_slist_next(tmp);
}
- // }
+ }
+
scene.daytime = daytime;
//double azm, alt;