Drawing straight to the screen?

I’ve been trying to draw to the screen to make GUIs without sprites, but whenever I run the program, nothing happens.

1 Like

If you got your screen variable from image.screenImage(), you can’t draw to it. That’s only a reference to the screen, and not the object. Try @jwunderl’s extension instead:

1 Like

I’ll slightly tweak your explanation here because the overall answer is a little subtle – you can draw to that screen, but the default game engine also draw to it all the time, so you have to be careful when drawing so that it doesn’t get immediately erased before it gets the chance to show up (within ~1/30th of a second). If you add my extension he mentioned to your game, it has a few blocks that are useful here because they make it easy to draw to the screen at the right time – in particular

For the most part, the screen you’re using will actually be identical to the parameter in that block; e.g.


are pretty much the same at the moment – (though you should use the parameter instead for cleanliness / in the future we might update the block for multiple cameras for multiplayer in which case the screen parameter could refer to a given user’s screen instead of just player 1’s)