One of the neat “tricks” with the Windows simulator when used with an Android device is that you can listen for key events and potentially use them for taking screen shots and/or toggling various debug features.
For instance, I like to put something like this in main.lua to make taking screenshots easier:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
local onKeyEvent = function(event) local phase = event.phase local keyname = event.keyName if (system.getInfo("environment")=="simulator") then if (keyname == "printScreen") and (phase == "up") then local filename = os.date("%Y%m%d_%H%M%S.png") display.save(display.getCurrentStage(), filename) return true end end return false end Runtime:addEventListener("key", onKeyEvent) |
Unfortunately, that trick won’t work with simulated iOS devices – the simulator won’t send the key events to iOS devices.
So, borrowing the technique from this post we can mimic an iOS device’s resolution, but tell the simulator it’s an Android device.
For example, here I’ve copied the skin “iPad.lua” into “Android iPad.lua”, in order to create a 4:3 aspect device that the simulator will treat as Android (and thus provide key events through the simulator).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
simulator = { device = "android-tablet", -- CHANGED screenOriginX = 116, screenOriginY = 124, screenWidth = 768, screenHeight = 1024, deviceImage = "iPad.png", displayName = "Android iPad", -- CHANGED statusBarDefault = "iPadStatusBarBlack.png", statusBarTranslucent = "iPadStatusBarBlack.png", statusBarBlack = "iPadStatusBarBlack.png", windowTitleBarName = "Android iPad", -- CHANGED } |
Repeat for other iOS devices if/as desired.