screenshot.

This commit is contained in:
Christopher Jeffrey 2015-04-26 02:40:39 -07:00
parent 3d8dfd0db4
commit edf22cd6cd
1 changed files with 8 additions and 1 deletions

View File

@ -253,8 +253,15 @@ button.on('press', function() {
screen.append(button);
screen.key('S-s', function() {
var rand = function(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
};
var xi = rand(0, screen.cols - (stext.width - stext.iwidth));
var xl = xi + stext.width - stext.iwidth;
var yi = rand(0, screen.rows - (stext.height - stext.iheight));
var yl = yi + stext.height - stext.iheight;
stext.wrap = false;
stext.setContent(screen.screenshot());
stext.setContent(screen.screenshot(xi, xl, yi, xl));
screen.render();
});