Вопрос

I have two classes in my WIP Tetris clone, and one is instantly called by the main function. The .h and .cpp files for this class are here: http://pastebin.com/mDMeqMfV

The second class which the first class has an instance of, can be found here: http://pastebin.com/wG2b0whL The commented section is a set of colors I'm using as overlays to make different colored blocks. Anyway, the problem I'm having is in the instance of the Block class. Despite in the initialize function setting the position of the sprite to the variable position, the sprite does not actually render there. It seems to default to 0, 0 by the time it gets to the Draw function, and will not go to its proper position even when calling the setPosition function as seen in the Draw method. Any help solving this problem would be greatly appreciated.

Это было полезно?

Решение

You have Block b as a member of your class but you have constructed a new one in the constructor of PentrisGame. Perhaps you forgot to do an assignment? As it stands that one you constructed is destroyed and your member is left in its default state.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top