Skip to content

Instantly share code, notes, and snippets.

@meeech
Last active December 21, 2015 04:09
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save meeech/6247267 to your computer and use it in GitHub Desktop.
UI = {}
local FONT = 'OCRAStd'
function UI.counter(label, counter)
local group = display.newGroup()
local lText, lSize = label.text, label.size or 25
local cText, cSize = counter.text, counter.size or lSize
local l = display.newText(
lText
, 0
, 0
, FONT
, lSize
)
local c = display.newText(
cText
, 40
, 0
, FONT
, cSize
)
group:insert(l)
group:insert(c)
-- So we have a hook to update the value in counter
group.counter = c
return group
end
return UI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment