DigiPen-Faculty / CProcessing

MIT License
29 stars 4 forks source link

Modified CP_Image to have image vector, and added a free image queue. #14

Open NovaSmoof opened 2 years ago

NovaSmoof commented 2 years ago

The change to make CP_Image have a vector of images was because it made the dynamic allocations of arrays more unified across the entire of c processing's internal implementation. Please cautiously inspect these changes, they are in f3e5a73ff9dacd594cdd3702b27697a0cd63fd48 and should be examined carefully to make sure I did not screw anything up.

The second large change is a queue for free images that only frees at the end of frames. This was done to further solve the screenshot not working fully #10. An error could occur where if one tried to take a screenshot and then render and then they freed the image all on the same frame, then nanovg would render the freed data which was not great and didn't display what they were trying to do. Delaying the freeing until the end of the frame allows for people to call free mid frame while still deleting the given image and still rendering the image.

NovaSmoof commented 2 years ago

Fixed the one thing @Polkm105 commented on in person, where the active image vector just keeps pushing back even when there are empty images in it.