Error: GetCanvasHeight() is not a function

I think it a bug. I’m trying to get actual canvas height and width using SceneWindowHeight() and SceneWindowWidth() expressions, but the preview stops at 90% and I get this error message in the consol:

TypeError: gdjs.evtTools.window.getCanvasHeight is not a function code0.js:30

This is the full content of the console if needed:

"pre-main prep time: 246 ms" libGD.js:119 "Initializing GDJS platform" libGD.js:116 "* Loading builtin extensions... BuiltinObject, Sprite, BuiltinCommonInstructions, BuiltinCommonConversions, BuiltinVariables, BuiltinMouse, BuiltinKeyboard, BuiltinJoystick, BuiltinScene, BuiltinTime, BuiltinMathematicalTools, BuiltinCamera, BuiltinAudio, BuiltinFile, BuiltinNetwork, BuiltinWindow, BuiltinStringInstructions, BuiltinAdvanced, BuiltinExternalLayouts, done." libGD.js:116 "PlatformAutomatism, DestroyOutsideAutomatism, TiledSpriteObject, DraggableAutomatism, TopDownMovementAutomatism, TextObject, Platform initialization ended." libGD.js:116 "fade" "/preview" "/preview" contact.js:8 "Serialized project is being sent to the server..." gameService.js:126 "fade" "/home" "/home" contact.js:8 "fade" "/sceneeditor" "/sceneeditor" contact.js:8 "Pixi.js v1.6.1 - http://www.pixijs.com/" pixi.js:12 "fade" "/eventseditor" "/eventseditor" contact.js:8 "fade" "/preview" "/preview" contact.js:8 "Serialized project is being sent to the server..." gameService.js:126 "Pixi.js v1.6.1 - http://www.pixijs.com/" pixi.js:12 TypeError: gdjs.evtTools.window.getCanvasHeight is not a function code0.js:30

You can watch here.
Method : getCurrentHeight();

I’m not sure if I can use actual JS code in GDevApp can’t find such action or event. I think the SceneWindowHeight() expression should work but I get this TypeError in the console.

Thanks anyway :slight_smile:

This is the GDevApp forum, ddabrahim is (surely) talking about the expression, GDevApp doesn’t support JavaScript events :wink:

ddabrahim, I don’t know why, but in GDevApp “ScreenWidth()” and “ScreenHeight()” return the size of the game canvas (just in case you need them now) :slight_smile:

By the way, there is a little math problem in the functions or in the canvas: ScreenWidth() and ScreenHeight() return 2 less pixels than the project size :neutral_face:

Thanks Lizard it worked :slight_smile:

There seems to be a bug involving outdated files for the game engine in GDevApp, I’ll check that now I’ve almost finished working on creating a PPA for GDevelop on Ubuntu :slight_smile:

Should be fixed, the core of GDevApp has been upgraded to GD 3.6.76 :slight_smile: