Hi
I am currently trying to write a small card game in Qt 4.
I am using a QWidget with the paint method overidden for drawing.
I want to be able to drag and drop cards. I can use mouseDown and mouseMove and keep painting the card making sure I have the old background to paint back when the card moves. Or is there a better way? Problem: How do I paint from the mousemove event?
I also want to be able to animate the cards moving across the board. Im not sure how to do this as the animation would have to be some kind of loop and I dont know how to paint outside of being in the paint method. Would my loop just update some co-ordinates somewhere and call a repaint and the paint method take care of it?
If everything were to be done in the paint method its going to get pretty large. right?
Thanks.
Mike


Reply With Quote

With paint events you get information which parts of the display changed and you need to redraw only those parts, you can leave the rest untouched.

Bookmarks