mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Implement getScreenWidth/Height for Cocos2d renderering
This commit is contained in:
@@ -67,9 +67,14 @@ gdjs.RuntimeGameCocosRenderer.prototype.getDirectorManager = function() {
|
||||
return this._directorManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* As Cocos2d is managing the game loop, the Cocos scenes need to call this
|
||||
* function to step the game engine. See RuntimeSceneCocosRenderer.
|
||||
* @method onSceneUpdated
|
||||
*/
|
||||
gdjs.RuntimeGameCocosRenderer.prototype.onSceneUpdated = function() {
|
||||
if (!this._gameLoopFn()) {
|
||||
this._directorManager.end()
|
||||
this._directorManager.end();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,3 +82,11 @@ gdjs.RuntimeGameCocosRenderer.prototype.convertYPosition = function(y) {
|
||||
//Cocos2D Y axis is inverted, with origin at the bottom of the window.
|
||||
return this._currentHeight - y;
|
||||
}
|
||||
|
||||
gdjs.RuntimeGameCocosRenderer.getScreenWidth = function() {
|
||||
return cc.view.getFrameSize().width;
|
||||
}
|
||||
|
||||
gdjs.RuntimeGameCocosRenderer.getScreenHeight = function() {
|
||||
return cc.view.getFrameSize().height;
|
||||
}
|
||||
|
@@ -39,10 +39,16 @@ gdjs.evtTools.window.getWindowTitle = function(runtimeScene) {
|
||||
};
|
||||
|
||||
gdjs.evtTools.window.getWindowWidth = function() {
|
||||
if (gdjs.RuntimeGameRenderer && gdjs.RuntimeGameRenderer.getScreenWidth)
|
||||
return gdjs.RuntimeGameRenderer.getScreenWidth();
|
||||
|
||||
return (typeof window !== "undefined") ? window.innerWidth : 800;
|
||||
};
|
||||
|
||||
gdjs.evtTools.window.getWindowHeight = function() {
|
||||
if (gdjs.RuntimeGameRenderer && gdjs.RuntimeGameRenderer.getScreenHeight)
|
||||
return gdjs.RuntimeGameRenderer.getScreenHeight();
|
||||
|
||||
return (typeof window !== "undefined") ? window.innerHeight : 800;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user