Gui Tutorial
4. Using an Image
Using an image
For this section we’ll use this image as the texture for our button.
It’s dimensions are 64
x72
pixels.
For this example we'll be saving the image to
~/images
however you can put it wherever you like.To make this change we can replace this line
local button = myGui.newRectangle(5,5,20,12)
button.setColor( 0xFFFFFFFF ) --opaque white, 0x FF FF FF FF
with this
local button = myGui.newImage("~/images/upThink.png",5,5,20,12)
If you're following along in REPL, you can do
button.remove()
to remove the current rectangle before making the image.and if we open it now… We can see
64 / 72 * 20 = 17.7
button.setSize(20,17)
We can see our image on the button.