- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample.lua
More file actions
Latest commit
60 lines (51 loc) · 4.1 KB
/
Copy pathsample.lua
File metadata and controls
60 lines (51 loc) · 4.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
--
-- Abstract: device Library Plugin Test Project
--
-- Sample code is MIT licensed, see http://www.coronalabs.com/links/code/license
-- Copyright (C) 2015 Corona Labs Inc. All Rights Reserved.
--
------------------------------------------------------------
-- Load plugin library
localdevice=require"plugin.device"
-------------------------------------------------------------------------------
-- BEGIN (Insert your sample test starting here)
-------------------------------------------------------------------------------
-- Create a label for each property in the device plugin
localisAndroidLabel=display.newText("Android: " ..tostring(device.isAndroid), 150, 25, 200, 50, native.systemFont, 12)
localisAppleLabel=display.newText("Apple: " ..tostring(device.isApple), 150, 50, 200, 50, native.systemFont, 12)
localisGoogleLabel=display.newText("Google: " ..tostring(device.isGoogle), 150, 75, 200, 50, native.systemFont, 12)
localis_iPadLabel=display.newText("iPad: " ..tostring(device.is_iPad), 150, 100, 200, 50, native.systemFont, 12)
localis_iPhoneLabel=display.newText("iPhone: " ..tostring(device.is_iPhone), 150, 125, 200, 50, native.systemFont, 12)
localis_iPodLabel=display.newText("iPod: " ..tostring(device.is_iPod), 150, 150, 200, 50, native.systemFont, 12)
localisKindleLabel=display.newText("Kindle: " ..tostring(device.isKindleFire), 150,175, 200, 50, native.systemFont, 12)
localisNookLabel=display.newText("Nook: " ..tostring(device.isNook), 150, 200, 200, 50, native.systemFont, 12)
localisSimulatorLabel=display.newText("Simulator: " ..tostring(device.isSimulator), 150, 225, 200, 50, native.systemFont, 12)
localisTallLabel=display.newText("Tall: " ..tostring(device.isTall), 150, 250, 200, 50, native.systemFont, 12)
localisWindowsLabel=display.newText("Windows: " ..tostring(device.isWindows), 150, 275, 200, 50, native.systemFont, 12)
-- Display properties
localxdpiLabel=display.newText("xdpi: " ..device.xdpi, 150, 300, 200, 50, native.systemFont, 12)
localydpiLabel=display.newText("ydpi: " ..device.ydpi, 150, 325, 200, 50, native.systemFont, 12)
localorientationLabel=display.newText("Orientation: " ..device.orientation, 150,350, 200, 50, native.systemFont, 12)
-- Check device support for event listeners
localsupportsAccelerometerLabel=display.newText("accelerometer: " ..tostring(device.supportsAccelerometer), 150, 375, 200, 50, native.systemFont, 12)
localsupportsGyroscopeLabel=display.newText("gyroscope: " ..tostring(device.supportsGyroscope), 150, 400, 200, 50, native.systemFont, 12)
localsupportsHeadingLabel=display.newText("heading: " ..tostring(device.supportsHeading), 150, 425, 200, 50, native.systemFont, 12)
localsupportsInputDeviceStateLabel=display.newText("inputDeviceState: " ..tostring(device.supportsInputDeviceState), 150, 450, 200, 50, native.systemFont, 12)
localsupportsKeyLabel=display.newText("key: " ..tostring(device.supportsKey), 150, 475, 200, 50, native.systemFont, 12)
localsupportsLocationLabel=display.newText("location: " ..tostring(device.supportsLocation), 150, 500, 200, 50, native.systemFont, 12)
localsupportsMouseLabel=display.newText("mouse: " ..tostring(device.supportsMouse), 300, 25, 200, 50, native.systemFont, 12)
localsupportsMultitouchLabel=display.newText("multitouch: " ..tostring(device.supportsMultitouch), 300, 50, 200, 50, native.systemFont, 12)
localsupportsOrientationLabel=display.newText("orientation: " ..tostring(device.supportsOrientation), 300, 75, 200, 50, native.systemFont, 12)
-- App store
localstoreLabel=display.newText("Store: " ..device.store, 300, 100, 200, 50, native.systemFont, 12)
-- Refresh the DPI when there is an orientation event
functiononOrientationChange(event)
device.refreshDpi()
xdpiLabel.text="xdpi: " ..device.xdpi
ydpiLabel.text="ydpi: " ..device.ydpi
orientationLabel.text="Orientation: " ..device.orientation
end
Runtime:addEventListener("orientation", onOrientationChange)
-------------------------------------------------------------------------------
-- END
-------------------------------------------------------------------------------