_ Learn to debug. Execute step by step, watch the variables, see the exact line where it crashes.
_ Don't abuse dynamic allocation. Your usage of new is not justified, may have leaks too.
_ Don't reinvent the wheel. Use std::vector as an dynamic size array. (¿do you want it dynamic?)
> I already pasted the declaration and iinitialization in this post, didn't I?.
No, you didn't
> ZeroMemory was giving me an error before, so I put the & there and it fixed it
> I changed it from &_displaylist to _displaylist.
> I commented out ZeroMemory because it was just causing problems.
Which usage of new isn't justified?
I don't need the array to be dynamic at this stage, I'd prefer simplicity for now.
If I didn't post the initialization, then what would that look like?
I did read how ZeroMemory works. The first parameter is a pointer to the beginning of the section of memory to zero and second is its size. Using the ampersand seemed to be working and caused no problems that I noticed. I only had problems with it when I changed it according to the advice of others on the forum, and it's current back to what it was originally.
> Which usage of new isn't justified? Renderer* MyRenderer = new Renderer();
> I don't need the array to be dynamic at this stage, I'd prefer simplicity for now. Graphic *_displaylist[_dlistmax]; simple
1 2 3
(¿are you sure that you want a container of pointers?)
> The first parameter is a pointer to the beginning of the section of memory to zero ZeroMemory(&_displaylist, _dlistmax); is equivalent to _displaylist = NULL; (plus accessing memory outside that variable)
> and second is its size.
You need to follow Krzysztof Kawa's advice. Note that your items are pointers.
I didn't have new there at first, there was some reason that I added it but I have no idea what it was now. It's changed to Renderer MyRenderer = Renderer(); now.
I am sure that I want a container of pointers. The order of the items in _displaylist determines the render order, so I need to be able to move them around quickly and easily. Changing a pointer is a lot more efficient than moving arrays of RGB data around.
ZeroMemory is changed to ZeroMemory(_displaylist, _dlistmax * sizeof(Graphic*)); It gives me an access violation because it's accessing something in _displaylist and, for whatever reason, the program doesn't like that.