Last active
March 23, 2019 20:49
-
-
Save nicloay/9b5c105bbdf96e134c55361ed8347ad7 to your computer and use it in GitHub Desktop.
Defold gui button which change scale on press event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local Button = require("main.gui.button") -- change path to your location | |
function another_handler(self) | |
-- do something here | |
end | |
function init(self) | |
-- "facebook" and "another_button" is a nodes on your gui scene | |
self.fb_button = Button.new(self, "facebook", function() sys.open_url("https://www.facebook.com/pipler/") end) | |
self.another_button = Button.new(self, "another_button", another_handler) | |
end | |
function on_input(self, action_id, action) | |
-- make sure that you use ":" colon here, each button required personal on_input call | |
self.fb_button:on_input(action) | |
self.another_button:on_input(action) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Love this implementation, I have some change that play 2 sprite in animation that not always use scale to button for implementation