Create a gist now

Instantly share code, notes, and snippets.

@Lerg /main.lua
Last active Aug 29, 2015

What would you like to do?
Take screenshots in simulator with S key
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.pixelWidth .. 'x' .. display.pixelHeight .. '_' .. math.floor(system.getTimer()) .. '.png')
return true

Lerg commented Feb 9, 2014

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment