Black areas in game when resizing on a few Android Chrome versions

Đang mở
#229 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript
Lĩnh vực
frontend, game-dev

Hướng nghiên cứu

The report includes a runnable example and test code that resizes the game with game.scale.setGameSize and game.scale.refresh using WebGL with antialiasing enabled. Start by reproducing it on Android 6.0.1 with Chrome 58 while changing orientation, then compare with antialiasing disabled. Done means resizing no longer leaves black areas or causes blinking on the affected browser versions.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

This issue is about resizing the game. Tested it on Android 6.0.1 with Chrome 58.0.3029.83.
I guess the problem is with PIXI, because when antialiasing is enabled in WEBGL mode and the new size of the game is bigger than the old size, the new size has black areas by the amount exactly how much it is bigger than the old size. Tried a workaround to create a bigger initial game size (so the new dimension can only be smaller), but after resizing the game screen starts to blink on the affected browser.
When the antialiasing is disabled there is no issue. The problem appeared on Android 6.0.1 with Chrome 58, on other browsers it worked fine (Windows Phone Edge browser, IOS Safari, Andoid 5 with Chrome).

Phaser versions affected: all! Tested from 2.4.6 up to 2.7.9
Live example with antialising on:
http://icedevel.com/phaser-bug/antialias-yes/index.html
Antialiasing off:
http://icedevel.com/phaser-bug/antialias-no/index.html
In the example a simple image is stretched on the screen. Turn the orientation on mobile to see the resizing.
Here is the simple test code:

var game;
var imgTest;

function preload() {

	game.scale.fullScreenScaleMode = Phaser.ScaleManager.SHOW_ALL;
	game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
	game.scale.pageAlignHorizontally = true;
	game.scale.pageAlignVertically = true;
	window.addEventListener("resize", function(){
		game.scale.setGameSize(window.innerWidth, window.innerHeight);
		game.scale.refresh();
	});
	game.load.image("testimage", "test.png");
}
function create() {
	imgTest = game.add.image(game.width / 2, game.height / 2, 'testimage');
	imgTest.anchor.setTo(0.5, 0.5);
	imgTest.width = game.width;
	imgTest.height = game.height;
}

function update() {
	imgTest.x = game.width / 2;
	imgTest.y = game.height / 2;
	imgTest.width = game.width;
	imgTest.height = game.height;
}


window.onload = function(){
	var config = {
		width: 400,
		height: 400,
		renderer: Phaser.WEBGL,
		antialias: true,
		state: {
			preload: preload,
			create: create,
			update: update
		}
	}

	game = new Phaser.Game(config);
};
Ngôn ngữ chính
JavaScript
Star
1.4k
Fork
485
Merge trung bình
1 ngày 2 giờ
Pull request đã merge (30 ngày)
9

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của phaserjs/phaser-ce

Tất cả issue của phaserjs/phaser-ce

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.