Pratanjali64
Member
Is it possible for my code to pick a small region of a larger sprite and turn that into a surface? Bonus if it can do this for several overlapping sprites in the same region (just taking the part that is visible).
I'm building a system that encodes terrain data onto a surface, which then affects the movement of my character. After finding out that surfaces ought to have dimensions that are relatively small and a power of two, it occurred to me that I ought to sub-divide my maps into squares. This brings up two issues: 1 - there will be a lot of time spent cropping and individually saving dozens of sprites from my larger map images, and 2 - it will make edits to the maps much more cumbersome.
My idea is to have my code select a small region of the larger image and generate a surface from that. When the character gets to the end of that region, do the same operation on the next region. What would be even better would be if the code could capture the top-level image of several overlapping sprites instead of being restricted to just one. This would allow me to build my maps up from more modular pieces.
I'm building a system that encodes terrain data onto a surface, which then affects the movement of my character. After finding out that surfaces ought to have dimensions that are relatively small and a power of two, it occurred to me that I ought to sub-divide my maps into squares. This brings up two issues: 1 - there will be a lot of time spent cropping and individually saving dozens of sprites from my larger map images, and 2 - it will make edits to the maps much more cumbersome.
My idea is to have my code select a small region of the larger image and generate a surface from that. When the character gets to the end of that region, do the same operation on the next region. What would be even better would be if the code could capture the top-level image of several overlapping sprites instead of being restricted to just one. This would allow me to build my maps up from more modular pieces.