GameMaker: Taking screenshot of area larger than screen


Above: in-game view. Below: taken screenshot of entire room

This is an example that I've actually made a long time ago, but apparently it remains a common unresolved problem.
For multiple cases you may need to take a screenshot (or copy to surface) entire room, while only portion of it can be seen at once (window/screen size limitations).
A perfect work-around for this is to force screen drawing into a surface of chosen size, after adjusting view settings.

Download GMK

GameMaker: Surfaces and scrollable content

In some cases, a moment comes when you need to display specific content in a area smaller than itself, thus requiring scrolling.

GameMaker does not support 'clip rectangle' type of command for its reasons, however it is easy to 'clip' area to be drawn by using an 'buffer' surface to draw content in, before drawing that to screen.
Attached example illustrates sample implementation of such.

Most often, content of such would be text. And maybe an image. Or two.

Since images would require a bit more code, example does simple and efficient - long long text is rendered into a surface, which is later drawn into an other 'buffer' surface to display it as part of window on screen.
Also there is a scrollbar, which obviously can be improved, if it needs to serve purposes other than displaying position of 'window'.

Download