Drawing Part of an Image Corrupting

BlitzMax Forums/BlitzMax Programming/Drawing Part of an Image Corrupting

Rico(Posted 2010) [#1]
Hi in my game i have made a door which opens by sliding up into the ceiling. I animated this by drawing part of the image to the screen (DrawSubImageRect command) and drawing successively less of the door as it goes up into the ceiling.

i added an 'if statement' around the door drawing code and bizarrely this made the door leave a trail of corrupted graphics as it opened. i removed the if statement and readded it and it was fine again. however its now happened again as ive written more to the program. can anyone help with this problem?

i am wondering if maybe i am not deleteing things properly and that this might be causing it. if you remove an item from a list say. do you need to explicity free the memory it took up? and if so how do you do this. thank you :)


GfK(Posted 2010) [#2]
I've never used DrawSubImageRect and as you haven't posted any specific code I thought this might be worth mentioning.

If you create a pixmap, its filled with whatever garbage was in that bit of memory before. You can call myPixmap.ClearPixels() to solve that. So if you're doing any pixmap trickery - that's why. Or maybe its DrawSubImageRect thats trying to perform pixmap witchcraft.


Rico(Posted 2010) [#3]
ahh its ok i fixed it, i didnt change the height parameter for the source rectangle when the door was moving up. - i was just changing the value of the top left y coord of the source rectangle. it was starnge how it worked until i changed some other parts of the program though. guess that bit of memory must of got filled in by something else. anyway thank you for the help gfk, much appreciated :)