PDA

View Full Version : a simple game, much trouble



kennethadammiller
9th July 2010, 02:50
I've been trying for the life of me to get started making a simple game using the QGraphicsView and going off of what I can see from the Mouse example included in the package, but I just can't do it.

So far, this is how it goes. The code that I'm trying to include is fledgling; it has no capability to compile at all, and even if it did, it wouldn't do anything but display some meaningless circle (if that) because I haven't even connected the spinboxes to the necessary functions and what not...

ok ok, so here's what I had planned.
on the large scale, I've been trying to make a simple game. I got caught up when I was trying to add an item (Human class) to the QGraphicsScene.
1: I couldn't figure out how the painter.drawEllipse(x,x,x,x) or painter.drawRect(x,x,x,x) functions worked. every time i would set new values, the object would be draw in a very different manner, as in, so different i couldn't figure out what values i wanted to use in there.
2: setting the coordinates for each object, like a head, then a body, then legs and then going into each object and resetting them and recompiling every time was just stupid and slow...

so I decided that I would put spinboxes in there and make the object redraw itself each time it was clicked, and take the coordinates from the spinboxes and use them to draw first the ellipse, then the rectangle, then the... whatever. Each time I wanted to add something to the character, i would go in and put painter.drawEllipse/Rect and then use the spinbox values. after I got the shape and positions I wanted, I would go back and hard code those values in there. get what I mean?

Then while I was going down that side track, I got caught up with a compile error. Something about the Human class is making it hang! I included the project folder in this post, you can grab it and build it for yourself to see what's wrong.

the compiler says: undefined reference to `vtable for Human'

Thanks in advance. This has been very frustrating.

kennethadammiller
9th July 2010, 04:07
I actually found the answer to this question right after posting it. I wanted to be able to pass arguments to the advance function of an overloaded QGraphicsItem. Can't do that. hahaha