Fix some bugs.
This commit is contained in:
parent
e6f084346a
commit
7e0c2825c3
3 changed files with 25 additions and 15 deletions
|
@ -67,10 +67,13 @@
|
|||
Module.setStatus('Loading...');
|
||||
|
||||
window.onerror = function (event) {
|
||||
document.documentElement.innerHTML = event;
|
||||
};
|
||||
|
||||
Module.print(document.documentElement.clientWidth, document.documentElement.clientHeight);
|
||||
canvas.height = document.documentElement.clientHeight;
|
||||
if (true) {
|
||||
var rect = canvas.getBoundingClientRect();
|
||||
canvas.height = Math.max(document.documentElement.clientHeight - rect.top, 420);
|
||||
}
|
||||
|
||||
var angle = 0;
|
||||
var drawLoading = function () {
|
||||
|
|
23
lib.js
23
lib.js
|
@ -240,25 +240,28 @@ var LibraryDLM = {
|
|||
}
|
||||
}
|
||||
|
||||
var check_touch = function (t, x1, y1, x2, y2) {
|
||||
return (t.clientX > x1 && t.clientX < x2 &&
|
||||
t.clientY > y1 && t.clientY < y2);
|
||||
var check_touch = function (x, y, x1, y1, x2, y2) {
|
||||
return (x > x1 && x < x2 && y > y1 && y < y2);
|
||||
}
|
||||
|
||||
var touch_callback = function (e) {
|
||||
e.preventDefault();
|
||||
var touch = 0;
|
||||
var centerY = 420 + (Module['canvas'].height - 420) / 2;
|
||||
var centerY = 420 + (canvas.height - 420) / 2;
|
||||
var rect = canvas.getBoundingClientRect();
|
||||
|
||||
for (var i = 0; i < e.touches.length; i++) {
|
||||
var t = e.touches.item(i);
|
||||
if (check_touch(t, 140 - 40, centerY + 20, 140 + 40, centerY + 100)) touch |= 4;
|
||||
else if (check_touch(t, 140 - 40, centerY - 100, 140 + 40, centerY - 40)) touch |= 8;
|
||||
else if (check_touch(t, 140 - 100, centerY - 40, 140, centerY + 40)) touch |= 1;
|
||||
else if (check_touch(t, 140, centerY - 40, 140 + 100, centerY + 40)) touch |= 2;
|
||||
var x = (t.clientX - rect.left) / (rect.right - rect.left) * canvas.width;
|
||||
var y = (t.clientY - rect.top) / (rect.bottom - rect.top) * canvas.height;
|
||||
|
||||
if (check_touch(t, 340 - 100, centerY - 100, 340 + 100, centerY + 100)) touch |= 0x10;
|
||||
touch |= 0x20;
|
||||
if (check_touch(x, y, 140 - 40, centerY + 20, 140 + 40, centerY + 100)) touch |= 4;
|
||||
else if (check_touch(x, y, 140 - 40, centerY - 100, 140 + 40, centerY - 40)) touch |= 8;
|
||||
else if (check_touch(x, y, 140 - 100, centerY - 40, 140, centerY + 40)) touch |= 1;
|
||||
else if (check_touch(x, y, 140, centerY - 40, 140 + 100, centerY + 40)) touch |= 2;
|
||||
|
||||
if (check_touch(x, y, 340 - 100, centerY - 100, 340 + 100, centerY + 100)) touch |= 0x10;
|
||||
if (check_touch(x, y, 0, 0, 480, 420)) touch |= 0x20;
|
||||
}
|
||||
DLM.touch = touch;
|
||||
}
|
||||
|
|
8
main.cpp
8
main.cpp
|
@ -998,11 +998,15 @@ void rpaint() {
|
|||
if (tmsgtm == 1) {tmsgtm = 80000000; tmsgtype = 2; }
|
||||
} //1
|
||||
else if (tmsgtype == 2) {
|
||||
if (key & (PAD_INPUT_DECIDE | PAD_INPUT_JUMP)) {
|
||||
tmsgy = 0; tmsgtype = 3; tmsgtm = 15 + 1;
|
||||
}
|
||||
else {
|
||||
tmsgtm++;
|
||||
}
|
||||
} else if (tmsgtype == 3) {
|
||||
xx[0] = 1200;
|
||||
tmsgy += xx[0];
|
||||
if (tmsgtm == 15) input_waitkey();
|
||||
if (tmsgtm == 1) {tmsgtm = 0; tmsgtype = 0; tmsgy = 0; }
|
||||
} //1
|
||||
|
||||
|
@ -3276,7 +3280,7 @@ void Mainprogram() {
|
|||
*/
|
||||
|
||||
//if (CheckHitKeyAll() == 0){end();}
|
||||
if (key != 0) { xx[0] = 1; }
|
||||
if (key & (PAD_INPUT_DECIDE | PAD_INPUT_JUMP)) { xx[0] = 1; }
|
||||
//if (input_keydown(KEY_INPUT_RETURN) == 1) {xx[0] = 1; }
|
||||
//if (input_keydown(KEY_INPUT_SPACE)==1){xx[0]=1;}
|
||||
//if (input_keydown(KEY_INPUT_Z) == 1) {xx[0] = 1; }
|
||||
|
|
Loading…
Add table
Reference in a new issue