[英]Cordova Phaser app game not utilizing full screen after resume
我正在使用Cordova和Phaser進行游戲。 我遇到了應用程序/游戲恢復時出現的布局問題。 我開始使用Yeoman模板並將其粘貼到自動生成的Cordova項目中。
我的ViewPort定義如下:
<meta name="viewport" content="user-scalable=no, maximum-scale=1, initial-scale=1, minimum-scale=1
,width=device-width">
在OnDeviceReady事件中,我這樣做:
height = window.screen.height;
width = window.screen.width;
game = new Phaser.Game(width, height, Phaser.AUTO, 'artillery');
我還將一些屏幕截圖與我的Nexus4相關聯。 這是第一次啟動應用程序時顯示的內容。 所有游戲州都展示了這一點,但“游戲”狀態是該問題的一個引人注目的證明: http : //imgur.com/J5efVHW
簡歷之后: http : //imgur.com/fEAPLUa
我想在暫停或恢復時殺死游戲並讓整個事情重新開始。 但是當我正在閱讀文檔和不同的論壇時,似乎不允許或非常不滿意。
您應該使用Phaser ScaleManager。
例如,您可以在啟動狀態的create函數中使用EXACT_FIT或SHOW_ALL;
create: function(){
game.scale.scaleMode = Phaser.ScaleManager.EXACT_FIT;
game.scale.pageAlignHorizontally = true;
game.scale.pageAlignVertically = true;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.