Closed lstrzebinczyk closed 5 years ago
Great question, unfortunately nothing like this currently exists. This is quite similar to the blitting conversation we had in Gitter. One idea is to use an OpenGL texture — you can see how they are created here. We could create a generic texture concept in Simple 2D with a convenient API to draw to it, even manipulate individual pixels. Only downside is that it could potentially be a significant amount of work. Another pure Ruby idea is to create your own pixel array and figure out how to write it to a .bmp
or .png
file, then read it back in as an Image
.
potentially be a significant amount of work.
Do you mean, to implement it, or to use it? I'm happy to move this issue to much, much later. I wouldn't abandon the idea completely, though.
Well, to implement. I think it could be simple to use. In Ruby, maybe we'd create a new Texture
class and expose its pixels through an array, and provide convenient methods for drawing on it (like with shapes and even other textures). You essentially could have a "painting" effect here. I'll think on this a bit, maybe prototype something in Simple 2D as a start.
Painting pixels or creating custom textures programmatically is a really cool idea, but going to close this until we have a specific strategy or implementation in mind.
I'm thinking about writing a maze/cave generator for my game. Check this link: https://gamedevelopment.tutsplus.com/tutorials/generate-random-cave-levels-using-cellular-automata--gamedev-9664
For the generation, I would like to see a big overview of the result, like available on that link. However, if I were to construct it from squares or rectangles, it would have very poor performance.
Is there an option to have a sort of a bitmap, where I would be able to decide bitmap pixel size, which pixels are on, which off, and what the color of pixels off is? Or is there another solution for doing this efficiently?