[Solved] JS RuntimeGamePixiRenderer Canvas Size

Hey there,
I’m new to GDevelop and I can’t find the way to resize the Canvas (Camera) via JavaScript code.
The JS Runtime Documentation mentions “gdjs.RuntimeGamePixiRenderer” which got a Method setSize to change the size of the current canvas but I simply can’t use the RuntimeGamePixiRenderer somehow.
I tried so far:
gdjs.RuntimeGamePixiRenderer;
var m_canvas = gdjs.RuntimeGamePixiRenderer;
var m_canvas = gdjs.RuntimeGamePixiRenderer();
var m_canvas = gdjs.RuntimeGame; and then on the next line: m_canvas.prototype.setSize();

Here ist the link to the Documentation i mean: Click

I hope someone can help me…

You should try something like this (not sure about syntax)
runtimeScene.getGame(). setDefaultHeight(XXX);
runtimeScene.getGame(). setDefaultWidth(XXX);

That one doesn’t affect the current canvas size, only the canvas size for comming new ones.

The autocompletion is not existing for this method, but it work :
runtimeScene.getGame().getRenderer().setSize(100,100);

2 Likes

That works! Nice, thank you. :smiley: