非公開 画面90度回転

    @@ -3,42 +3,57 @@ * @description ゲーム画面を90度回転させるぞ 配信とかでも見えやすくなるはずだっ * @private */ - - javascript:(function(){ const container = document.getElementById('game-container'); - const canvas = document.querySelector('canvas'); + const canvas = document.getElementById('gameCanvas'); if(!container || !canvas) return alert('ゲーム画面が見つかりません'); - /* 1. ゲーム画面を90度回転させる(CSS) */ - /* 画面を横倒しにして、左右の余白を埋めるように拡大 */ - canvas.style.transform = 'rotate(90deg) scale(1.7)'; /* 倍率は画面に合わせて調整 */ - canvas.style.transformOrigin = 'center center'; + /* --- 1. 表示エリアを画面いっぱいに広げる --- */ + Object.assign(container.style, { + position: 'fixed', top: '0', left: '0', width: '100vw', height: '100vh', + zIndex: '9999', backgroundColor: '#000', maxWidth: 'none', maxHeight: 'none' + }); - /* 2. 操作の向きを90度補正するハック */ - /* sendInputを上書きして、角度を90度(255段階で約64)ずらす */ + /* 画面の縦横比に合わせて拡大率を自動計算 (横画面にするので縦幅に合わせる) */ + const scale = window.innerWidth / canvas.height; + canvas.style.transform = `translate(-50%, -50%) rotate(90deg) scale(${scale})`; + Object.assign(canvas.style, { + position: 'absolute', top: '50%', left: '50%', transformOrigin: 'center center' + }); + + /* --- 2. 名前と絵文字を「水平」に保つフック --- */ + /* CanvasのfillTextを上書きし、描画の瞬間だけ-90度回転させて打ち消す */ + const originalFillText = CanvasRenderingContext2D.prototype.fillText; + CanvasRenderingContext2D.prototype.fillText = function(text, x, y, maxWidth) { + /* プレイヤーの名前や絵文字と思われる描画(特定座標でのテキスト)を狙い撃ち */ + /* ゲームの描画ロジック上、translateで位置が決まった後に0,0付近で描画される性質を利用 */ + if (Math.abs(x) < 50 && Math.abs(y) < 50 && !text.includes('%') && !text.includes(':')) { + this.save(); + this.rotate(-Math.PI / 2); /* -90度回転して画面の回転を打ち消す */ + /* 座標軸が変わるので x と y を入れ替えて調整 */ + originalFillText.call(this, text, -y, x, maxWidth); + this.restore(); + } else { + originalFillText.apply(this, arguments); + } + }; + + /* --- 3. 操作方向の90度回転補正 --- */ if (typeof sendInput === 'function' && !window._originalSendInput) { window._originalSendInput = sendInput; window.sendInput = function() { - /* 入力角度を計算する直前に dx/dy を入れ替える */ const oldDx = inputState.dx; const oldDy = inputState.dy; - - /* 横倒し(90度)に合わせてベクトルを回転 */ + /* 画面が90度右に回っているので、入力ベクトルも同様に回す */ + /* 右(oldDx)が下へ、上(oldDy)が右へ */ inputState.dx = -oldDy; inputState.dy = oldDx; - - _originalSendInput.apply(this, arguments); - - /* 元に戻さないと次のフレームの計算が狂うので復元 */ + window._originalSendInput.apply(this, arguments); inputState.dx = oldDx; inputState.dy = oldDy; }; } - /* 3. 背景や余白を黒で埋めて没入感を高める */ document.body.style.overflow = 'hidden'; - container.style.backgroundColor = '#000'; - - alert('【画面回転パッチ】適用しました!\nゲーム画面が横向きになり、操作も補正されています。'); + alert('【真・横画面パッチ】適用完了!\n・全画面化\n・文字の向き補正\n・操作方向修正'); })();
  • /*
     * @title 画面90度回転
     * @description ゲーム画面を90度回転させるぞ 配信とかでも見えやすくなるはずだっ
     * @private
     */
    javascript:(function(){
        const container = document.getElementById('game-container');
        const canvas = document.getElementById('gameCanvas');
        if(!container || !canvas) return alert('ゲーム画面が見つかりません');
    
        /* --- 1. 表示エリアを画面いっぱいに広げる --- */
        Object.assign(container.style, {
            position: 'fixed', top: '0', left: '0', width: '100vw', height: '100vh',
            zIndex: '9999', backgroundColor: '#000', maxWidth: 'none', maxHeight: 'none'
        });
        
        /* 画面の縦横比に合わせて拡大率を自動計算 (横画面にするので縦幅に合わせる) */
        const scale = window.innerWidth / canvas.height;
        canvas.style.transform = `translate(-50%, -50%) rotate(90deg) scale(${scale})`;
        Object.assign(canvas.style, {
            position: 'absolute', top: '50%', left: '50%', transformOrigin: 'center center'
        });
    
        /* --- 2. 名前と絵文字を「水平」に保つフック --- */
        /* CanvasのfillTextを上書きし、描画の瞬間だけ-90度回転させて打ち消す */
        const originalFillText = CanvasRenderingContext2D.prototype.fillText;
        CanvasRenderingContext2D.prototype.fillText = function(text, x, y, maxWidth) {
            /* プレイヤーの名前や絵文字と思われる描画(特定座標でのテキスト)を狙い撃ち */
            /* ゲームの描画ロジック上、translateで位置が決まった後に0,0付近で描画される性質を利用 */
            if (Math.abs(x) < 50 && Math.abs(y) < 50 && !text.includes('%') && !text.includes(':')) {
                this.save();
                this.rotate(-Math.PI / 2); /* -90度回転して画面の回転を打ち消す */
                /* 座標軸が変わるので x と y を入れ替えて調整 */
                originalFillText.call(this, text, -y, x, maxWidth);
                this.restore();
            } else {
                originalFillText.apply(this, arguments);
            }
        };
    
        /* --- 3. 操作方向の90度回転補正 --- */
        if (typeof sendInput === 'function' && !window._originalSendInput) {
            window._originalSendInput = sendInput;
            window.sendInput = function() {
                const oldDx = inputState.dx;
                const oldDy = inputState.dy;
                /* 画面が90度右に回っているので、入力ベクトルも同様に回す */
                /* 右(oldDx)が下へ、上(oldDy)が右へ */
                inputState.dx = -oldDy;
                inputState.dy = oldDx;
                window._originalSendInput.apply(this, arguments);
                inputState.dx = oldDx;
                inputState.dy = oldDy;
            };
        }
    
        document.body.style.overflow = 'hidden';
        alert('【真・横画面パッチ】適用完了!\n・全画面化\n・文字の向き補正\n・操作方向修正');
    })();
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2026/05/07 21:37:28 - 4 hours ago
  2. 2026/05/07 21:36:45 - 4 hours ago
  3. 2026/05/07 21:35:51 - 4 hours ago
  4. 2026/05/07 21:33:04 - 4 hours ago
  5. 2026/05/07 21:32:51 - 4 hours ago
  6. 2026/05/07 21:32:34 - 4 hours ago
  7. 2026/05/07 21:31:47 - 4 hours ago
  8. 2026/05/07 21:30:08 - 4 hours ago
  9. 2026/05/07 21:29:42 - 4 hours ago
  10. 2026/05/07 21:29:00 - 4 hours ago
  11. 2026/05/07 21:28:35 - 4 hours ago
  12. 2026/05/07 21:28:13 - 4 hours ago
  13. 2026/05/07 21:27:47 - 4 hours ago
  14. 2026/05/07 21:26:34 - 4 hours ago
  15. 2026/05/07 21:25:12 - 4 hours ago
  16. 2026/05/07 21:24:27 - 4 hours ago
  17. 2026/05/07 21:23:48 - 4 hours ago
  18. 2026/05/07 21:19:16 - 4 hours ago
  19. 2026/05/07 21:18:28 - 4 hours ago
  20. 2026/05/07 21:18:05 - 4 hours ago
  21. 2026/05/07 21:16:56 - 4 hours ago
  22. 2026/05/07 21:15:57 - 4 hours ago
  23. 2026/05/07 21:13:29 - 4 hours ago
  24. 2026/05/07 21:12:09 - 4 hours ago
  25. 2026/05/07 21:11:27 - 4 hours ago
  26. 2026/05/07 21:10:51 - 4 hours ago
  27. 2026/05/07 21:10:17 - 4 hours ago
  28. 2026/05/07 21:09:44 - 4 hours ago
  29. 2026/05/07 21:06:24 - 4 hours ago
  30. 2026/05/07 21:04:49 - 4 hours ago
  31. 2026/05/07 20:58:38 - 4 hours ago
  32. 2026/05/07 20:55:41 - 5 hours ago
  33. 2026/05/07 20:44:19 - 5 hours ago
  34. 2026/05/07 20:33:33 - 5 hours ago
  35. 2026/05/07 20:27:57 - 5 hours ago
  36. 2026/05/07 20:21:47 - 5 hours ago
  37. 2026/05/07 20:15:17 - 5 hours ago
  38. 2026/05/07 20:07:46 - 5 hours ago
  39. 2026/05/07 19:45:31 - 6 hours ago
  40. 2026/05/07 19:36:35 - 6 hours ago
  41. 2026/05/07 19:32:05 - 6 hours ago
  42. 2026/05/07 19:30:04 - 6 hours ago
  43. 2026/05/07 19:22:33 - 6 hours ago
  44. 2026/05/07 14:18:43 - 11 hours ago