Define Pixmap and PixmapAtlas to abstract image loading/mgmt #244
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Usage
PixmapAtlas
once and use it when creating image-like shapes (i.e.Image
,Sprite
,Tileset
) to ensure that an image file is loaded only once. For example:Canvas
can drawPixmap
s, which can be created directly, or even better, can be created using aPixmapAtlas
to ensure the same image doesn't get loaded more than once. For example:Changes/commits
Pixmap
which can be used to load an image file and convert toTexture
when neededPixmapAtlas
which can be used to manage loading/cachingPixmap
by name.Canvas#draw_pixmap
method to draw aPixmap
with resizingImage
supports aload_image_as_texture
class method which, given a file path and optionalPixmapAtlas
, will usePixmap
to load the image and track it in the atlas by file path.Sprite
andTileset
modified to use aboveImage
loader method and support optionalatlas
in constructorImage.ext_load_image
class methodPixmap.ext_load_pixmap
I realise this is a "design" change, so I am completely open to changes that better align with the goals of Ruby2D.