Created
February 24, 2015 01:12
-
-
Save coronarob/7239c5a4dac041a657ea to your computer and use it in GitHub Desktop.
This file contains hidden or 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
-- | |
-- 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