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

Related posts:

2 thoughts on “GameMaker: Surfaces and scrollable content

  1. “”I just wanted to thank you so much for posting this example!
    it’s helped me so much in understanding scrollable content on surfaces.””

    I cant said it better. Thank you for this example.

  2. I just wanted to thank you so much for posting this example!
    it’s helped me so much in understanding scrollable content on surfaces.

Leave a Reply to Adam Mawby Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.