button.lua
local PRESSED_BUTTON_SCALE = vmath.vector3(1.15)
local NORMAL_BUTTON_SCALE = vmath.vector3(1)
local ANIMATION_TIME = 0.2
local Button = {}
Button.__index = Button
function Button.new(context, node_name, handler)
local self = setmetatable({}, Button)
assert(handler)
This file has been truncated. show original
usage.gui_script
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)
This file has been truncated. show original