On 10/8/06, Kim Jongha <[EMAIL PROTECTED]> wrote: > Greeting, > I want to move a picture with gdkpixbuf when I press some key. > > It's hard to explain , but when I press some key, I want some image to > move from position 1 to position 2, just like a motion picture . > > ----- ------ > | 2 | | 1 | > ----- ------- > > Anyway I moved the image to position 2, but It's not a motion picture. > As time goes by, The image was just moved from 1 to 2 > > core part of my code below: > > da = gtk_drawing_area_new(); > while(i<50) > { > gdk_pixbuf_copy_area(background, 0,0,back_width, back_height, frame, 0,0); > /*of course r1.x value is decrease by 1 */ > if(gdk_rectangle_intersect(&r1, &r2, &dest); > { > gdk_pixbuf_composite(....) > } > > gtk_widget_queue_draw(da); > > g_usleep(50); > } > > Does somebody help me?
I'm assuming this is in a key-pressed callback - in that case, you would have to use gdk_threads_enter ()and gdk_threads_leave() (I think...). However, a much cleaner solution (instead of the while loop) would be to add a timeout function that moves the image... Samuel _______________________________________________ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list > _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list