Skip to content

Instantly share code, notes, and snippets.

@coronarob
Created February 24, 2015 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coronarob/7239c5a4dac041a657ea to your computer and use it in GitHub Desktop.
Save coronarob/7239c5a4dac041a657ea to your computer and use it in GitHub Desktop.
--
-- Abstract: Hello World sample app.
--
-- Version: 1.2
--
-- Sample code is MIT licensed
-- Copyright (C) 2014 Corona Labs Inc. All Rights Reserved.
--
-- Supports Graphics 2.0
------------------------------------------------------------
local background = display.newImage( "world.jpg", display.contentCenterX, display.contentCenterY )
local function getLoginInfo()
local requestingLoginEvent =
{
name = "requestingLogin",
username = "",
}
print("displatching login event")
Runtime:dispatchEvent(requestingLoginEvent)
end
-- Called when the C# login popup has been closed.
local function retrieveLoginInfo(event)
-- Fetch the login name and password. Do whatever you got to do here.
if event.submitted then
local username = event.username
local password = event.password
print("Retrieved login info", username, password)
else
print("Login was canceled.")
end
end
Runtime:addEventListener("onLoginInfo", retrieveLoginInfo)
local myText = display.newText( "Tap to login!", display.contentCenterX, display.contentHeight / 3, native.systemFont, 40 )
myText:setFillColor( 1.0, 0.4, 0.4 )
myText:addEventListener( "tap", getLoginInfo )
local myUsername = display.newText( "", display.contentCenterX, display.contentHeight / 3 * 2, native.systemFont, 40)
myUsername:setFillColor( 1, 1, 1 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment