PDA

View Full Version : Qt3 Memory game



rjk
6th December 2007, 17:59
Can anyone help how to code a memory game in qt using c++.
Game is, there are 30 pics closed. when you click one of them it open(shows the pic) then another one is clicked to open. if they are the same they left open. otherwise closed.

wysota
6th December 2007, 18:07
Have you already tried anything? Is using Qt3 a requirement or can you use Qt4? Is it a school assignment?

rjk
6th December 2007, 18:14
I tried to put a pushbutton with the image and hide the image. then show it when it is clicked. it does not work.
actually it is a school assigment.
i am using qt3, not allowed to use qt4

wysota
6th December 2007, 22:05
If it is a school assignment, we can't help you too much with it or else you will not learn anything. I can advise you to consider using QCanvas to visualize your game board or create a custom widget that will handle the board. If you override proper events, you'll be able to react on mouse clicks, changing the images the way you want.

You can also use a minimalistic approach and have 30 buttons inside a layout and change pixmaps associated with those buttons when the user clicks one of them.