Need help creating unique Surfaces in a For loop
Hey, thanks for reading!
I'm making a level selector that shows a mini preview of my level files, and I've got it working, but it's far too laggy with the current method (just draw a section of each level, but mini). So to minimise the draw calls I'm trying to just draw the level once to a surface named after each level on processing, and then draw those surfaces instead.
My issue is trying to use surface_create(); in a for loop, to make a surface for each level file. I'm not sure what to do to make a uniquely named surface.
I thought I could do something like this:
Inside a For loop, as each level file is processed
("surf_" + string(level_name))=surface_create(width,height)
surface_set_target( "surf_" + string(level_name))
//draw etc
But the Compile Errors return: Cannot set a constant as a value, which makes sense but I can't crack it.
I haven't used Surfaces a lot, but I'm sure what I'm missing is something basic I'm overlooking.
Any help or explanation on proper surface use would be great, thanks!
Posted May 5, 2016, 10:49 AM UTC