画面90度回転
/*
* @title 画面90度回転
* @description ゲーム画面を90度回転させるぞ 配信とかでも見えやすくなるはずだっ
* @private
*/
javascript:(function(){
const container = document.getElementById('game-container');
const canvas = document.querySelector('canvas');
if(!container || !canvas) return alert('ゲーム画面が見つかりません');
/* 1. ゲーム画面を90度回転させる(CSS) */
/* 画面を横倒しにして、左右の余白を埋めるように拡大 */
canvas.style.transform = 'rotate(90deg) scale(1.7)'; /* 倍率は画面に合わせて調整 */
canvas.style.transformOrigin = 'center center';
/* 2. 操作の向きを90度補正するハック */
/* sendInputを上書きして、角度を90度(255段階で約64)ずらす */
if (typeof sendInput === 'function' && !window._originalSendInput) {
window._originalSendInput = sendInput;
window.sendInput = function() {
/* 入力角度を計算する直前に dx/dy を入れ替える */
const oldDx = inputState.dx;
const oldDy = inputState.dy;
/* 横倒し(90度)に合わせてベクトルを回転 */
inputState.dx = -oldDy;
inputState.dy = oldDx;
_originalSendInput.apply(this, arguments);
/* 元に戻さないと次のフレームの計算が狂うので復元 */
inputState.dx = oldDx;
inputState.dy = oldDy;
};
}
/* 3. 背景や余白を黒で埋めて没入感を高める */
document.body.style.overflow = 'hidden';
container.style.backgroundColor = '#000';
alert('【画面回転パッチ】適用しました!\nゲーム画面が横向きになり、操作も補正されています。');
})();