-- for example 1 bitmap and 2 textures (I name it texture_1 and texture_2
texture_1 = Texture.new('images/button.png')
texture_2 = TextureRegion.new(Texture.new('images/button.png'), 0, 0, 50, 50)
bmp = Bitmap.new(texture_1)-- then I want to update bmp texture anytime in the gamefunction update_image(texture_name)
bmp:setTexture(texture_name)-- bmp:setTextureRegion() end
update_image(texture_1)--> this works
update_image(texture_2)--> this is an error. So I need to use bmp:setTextureRegion()--[[ Is there a way to feed both normal texture and textureRegion to a Bitmap in a single function?
Why I need this? :
My graphics assets are composed of texture atlas and single frame images. Sometimes I need to use the single
frame image and sometimes I need to use the atlas for a single Bitmap.
]]
@hgy29 nice trick, didn't think of that - the beauty of Luau...
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Comments
Likes: keszegh, koeosstudio, MoKaLux, SinisterSoft
Likes: MoKaLux
https://deluxepixel.com