Last active
November 6, 2022 21:04
-
-
Save Lerg/8906864 to your computer and use it in GitHub Desktop.
Take screenshots in simulator with S key
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
if app.isSimulator then | |
Runtime:addEventListener('key', function (event) | |
if event.keyName == 's' and event.phase == 'down' then | |
local scene = storyboard.getScene(storyboard.getCurrentSceneName()) | |
if scene and scene.view then | |
display.save(scene.view, display.pixelWidth .. 'x' .. display.pixelHeight .. '_' .. math.floor(system.getTimer()) .. '.png') | |
return true | |
end | |
end | |
end) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It uses my app.lua
app.isSimulator - just to make sure it doesn't run on devices.
It uses storyboard, you might want to convert it to composer.
Screenshots are saved into the Documents directory.