Page 1 of 2

Doozy of a problem ..anyone can help?(arrays of classes etc)

PostPosted: Aug 26, 2003 @ 7:01pm
by Codejoy

PostPosted: Aug 26, 2003 @ 7:25pm
by Pejo Software - Per

Ya

PostPosted: Aug 26, 2003 @ 7:30pm
by Codejoy
Ya I figured it was that somewhere, and no I dont like these errors :)

The worse part is, line for line, every piece looks right, even the implementation of the classes, it just so happens that one element on that one array doesnt work (I could see it even if it was like the final element, but the 0th element getting overwritten...how!?)

Like I said, I use to many languages to keep anyone straight, does C++ explicitly require you have a constructor /destructor for your classes, if so I dont know what id put in my constructor for the class...and once code goes out of scope is the destructor called?

plus is there any sort of class memory allocation that needs to be done on an array of instantiated objects?

-Shane

This is too rich.

PostPosted: Aug 26, 2003 @ 7:40pm
by Codejoy

PostPosted: Aug 26, 2003 @ 8:05pm
by Pam

Yes

PostPosted: Aug 26, 2003 @ 8:09pm
by Codejoy
according to my own code return values, yes indeed the Create and Load are working just fine, they both return success...again in the links at first post is where you can see the inner workings of thsoe methods (they are relativly simple).

The funny thing is after the load, and before the draw i do nothing with m_piece[0]. So somehow is the draw trouncing it? or is there some way for other code to trounce that specific element somehow...this is maddeling frustratingly strange.

-Shane

PostPosted: Aug 26, 2003 @ 8:21pm
by Pam
It seems likely it is some other piece of data overwriting part of the m_piece[0] data.

Are you using the GapiApplication class, and if so are you creating and loading the sprites in InitInstance() or in CreateSurfaces()?

If you step through the code, does the Draw fail the very first time the sprite is drawn or after a few times through ProcessNextFrame()?

Pam

PostPosted: Aug 26, 2003 @ 8:23pm
by Pejo Software - Per

ya

PostPosted: Aug 26, 2003 @ 8:49pm
by Codejoy

PostPosted: Aug 26, 2003 @ 8:53pm
by Pam

*sigh*

PostPosted: Aug 26, 2003 @ 9:08pm
by Codejoy

PostPosted: Aug 26, 2003 @ 9:12pm
by Pam

PostPosted: Aug 27, 2003 @ 4:20am
by mlepage

Thanks

PostPosted: Aug 27, 2003 @ 2:33pm
by Codejoy
hey thanks for that book title, I am new to STL in such a way that basically ive been putting it off for as long as possible, and now with me getting all "classy" I realize that I shouldn't put off the power of it anymore, plus im tired of writing my own linked lists, trees etc :)

I am going to check out that book thanks for the nfo

-Shane

PostPosted: Aug 27, 2003 @ 2:59pm
by Presto
Might I recommend:
http://www.pocketmatrix.com/forums/view ... hp?t=10367

And there's an excellent STL tutorial:
http://echellon.hybd.net/issues/5/artic ... part1.html
(as referenced in the thread above)

-John