Right now, i'm with Introduction to C++ with Game Development: Part 9, Colors and i understand it. The problem is in the assignment:
Load an image, display it, and fade it (slowly) to black.
I don't know if says that the image fade it slowly into black, or the display around the image fade it slowly into black. If is the first option, i need help. With the second option i already made it. The examples in this part use
m\_Screen-\>Clear(x);, but doesn't have relationship with an image, only with the screen.
So, is there a way to modify the colors in a image, apart from Photoshop :lol:??
I believe you are supposed to fade the whole screen, including the images you load, to black.
When you load an image onto your Surface using DirectX, all that's doing is placing each pixel of that image into the large array talked about in Part 8.
"Pixel* address" points to the start of this array, and in that particular appliation, the array is ( 640 * 480 ) elements in size, or 307200 pixels.
So, these images are not their own entity anymore. They've been plastered into this array and now exist just as elements of the array.
You need to use a loop to cycle through each element of the address array and set the Red, Green and Blue bytes increasingly closer to 0.
Keep in mind that on each frame, the image is redrawn (copied) to the array with its original colour values.
I hope this helps, without spelling out the solution.
Thanks Lokked, now i remembered to use
address from the previous part and used. Taking the value from every dot in the screen was easy, but to rewrite it take some time to resolve. At last, i made it after check the code with the debugger and finding the problem.