2
« on: July 05, 2011, 07:14:31 pm »
Hey all,
I'm trying to create a simple program that creates a 'fairy trail' of green pixels on a black background generated by the mouse. From another topic I learnt that I can't turn individual pixels on or off and so I'd instead need to use sprites for each pixel. However, when drawing so many sprites every time I call Display() the screen (understandably) flashes because it's drawing so many sprites at one go.
My current approach is creating a 2D vector the same size as the window with each cell storing the sprite to be drawn. I know this is a far from an efficient way of going about it, but it would be convenient for future purposes. So my question is, is there any cleaner way to do this while keeping some kind of map with all pixels?
If I'm guessing a good way to do it is to just have some kind of hashed container with all the cells the mouse has visited within some time frame and draw those on and kill cells that haven't been visited in a while.
Thanks so much!