Jump to content

Function Dgs-dxbutton / IconImage


Recommended Posts

Posted (edited)
Hi, does anyone know how to use the DGS icon Image function?

I ask because I don't quite understand how it works because I don't know where the image is called to put it.

 

--- Function

 

dgsSetProperty(button,"iconImage",{normalImage,hoveringImage,clickedImage})
Edited by FERNANDO-KAISER
  • Moderators
Posted (edited)

dgs-dxbutton/iconImage
Require [texture/shader] that can be used as the icon image of a button.

dgsSetProperty(button,"iconImage",{normalImage,hoveringImage,clickedImage})
  • normalImage: A texture/shader element of the icon image of the button ( neither selected nor clicked by mouse ). ( You can pass a nil value to disable this option )
  • hoveringImage: A texture/shader element of the icon image of the button which is selected. ( You can pass a nil value to disable this option )
  • clickedImage: A texture/shader element of the icon image of the button which is clicked. ( You can pass a nil value to disable this option )

You can use the function dxCreateTexture to create a texture to use on a button. Here's an example:

local button = dgsCreateButton( 0.7, 0.1, 0.2, 0.1, "Output!", true ) -- Create a button with the text "Output!" 

local iconTexture = dxCreateTexture("image1.png") -- Create a texture using the image file "image1.png"
if iconTexture then -- If the texture was successfully created
	dgsSetProperty(button,"iconImage",{iconTexture,iconTexture,iconTexture}) -- Set the button's icon image to be the created texture
	dgsAttachToAutoDestroy(iconTexture,button) -- Attach the texture to the button so that it is automatically destroyed when the button is destroyed.
end
Edited by xLive

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...