mirror of
https://github.com/boxgaming/qbjs.git
synced 2024-09-19 20:14:58 +00:00
restored scroll background mode
This commit is contained in:
parent
9a95a4ab1b
commit
f793c77e8f
1 changed files with 12 additions and 1 deletions
13
gx/gx.js
13
gx/gx.js
|
@ -601,6 +601,16 @@ var GX = new function() {
|
|||
_ctx.drawImage(_image(_bg[bi].image), 0, 0, _scene.width, _scene.height); // __gx_scene.image
|
||||
}
|
||||
|
||||
else if (_bg[bi].mode == GX.BG_SCROLL) {
|
||||
var img = _image(_bg[bi].image);
|
||||
var factor = GX.sceneWidth() / GX.sceneHeight();
|
||||
var h = img.height;
|
||||
var w = h * factor;
|
||||
var xfactor = GX.sceneX() / (GX.mapColumns() * GX.tilesetWidth())
|
||||
var x = xfactor * (img.width - w);
|
||||
_ctx.drawImage(img, x, 0, w, h, 0, 0, GX.sceneWidth(), GX.sceneHeight());
|
||||
}
|
||||
|
||||
else if (_bg[bi].mode == GX.BG_WRAP) {
|
||||
_backgroundDrawWrap(bi);
|
||||
}
|
||||
|
@ -2559,7 +2569,8 @@ var GX = new function() {
|
|||
this.ANIMATE_SINGLE = 1;
|
||||
|
||||
this.BG_STRETCH = 1;
|
||||
this.BG_WRAP = 2;
|
||||
this.BG_SCROLL = 2;
|
||||
this.BG_WRAP = 3;
|
||||
|
||||
this.KEY_ESC = 'Escape';
|
||||
this.KEY_1 = 'Digit1';
|
||||
|
|
Loading…
Reference in a new issue