Re: [gtkmm] Forcing widget repaints after key event



Kevin Hremeviuc <kevin hremeviuc tbwil ch> writes:
> I am translating a java program I wrote a while ago ( it's a crappy game 
> ) into c++ (which I am only learning) using gtkmm-2.0. I am capturing key 
> events and then changing the position of the user's bat on the screen. 
> How do I force a repaint ( I am using a DrawingArea object ) to show the 
> new bat position? I have looked in the documentation but can't an 
> obvious, correct way of doing this.

This is really somewhat orthogonal - but instead of doing the drawing
yourself, another solution would be to use a Gnome::Canvas. With a
canvas you simply add a canvas pixbuf object and move it around inside
the canvas, and then the canvas takes care of refreshing when needed.
Pretty nice.

> Ps. I have found this library pretty easy to learn. It certainly beats 
> trying to use the C version. I looked at this ages ago, but after so much 
> oo programming just wasn't interested. Nice work!

I agree.

-- 
Ole Laursen
http://www.cs.auc.dk/~olau/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]