Last active
December 21, 2015 04:09
-
-
Save meeech/6247267 to your computer and use it in GitHub Desktop.
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
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