// Phunのキーコンフィグ //


// Back to [BMP_TO_Phun]
//[2008/04/28公開] 今は時間がないので、とりあえず、データだけ。わかりやすい使い方を動画に出来たらいいのですが…
//
//このページ全体を[Ctrl] + [A]で選択したテキストデータをコピーして([Ctrl] + [C])、Phunを起動して、[F11]を押して現れるコンソール画面に貼り付けて([Ctrl] + [V])、[Enter]を押してください。
//
//下にある表がキーコンフィグの表です。左の列は読まなくて良いです。真ん中の列のボタンを押せば、右の列の通りになります。
//
//もし変なことが起こっても、[Phun]フォルダ内の[config.cfg]を削除して、[Phun]を再起動したら元に戻ると思いますが、何か起きても自己責任でお願いします。m(__)m
//今のところ、「ワイドにしすぎると、裏の世界に行ってしまう」「(yやnで)ウィンドウサイズで変更するとき、最大化されていないウィンドウからでないと不具合が生じる」とという現象を確認しています。
//数字キーのショートカットは、オブジェクトを選択していない状態で[Shift] + [*]です。
//あと、水の色は上手く変更できません。白のはずがピンクになったり…。
//qwerty配列のキーボードを想定しています。ノートパソコンだと、使いづらかったりするかもしれません(今、手元に1台デスクトップしかないのでそのパソコン以外では確認できていません)。
//
//コマンド(命令) 押すべきキー コメント(説明)
//特に注意すべき3つのコマンド。誤操作が不安な人は外してください。
Keys.bind("escape",{System.exit}); // Esc 終了。Exit.
Keys.bind("y",{System.resolution = [320, 240];System.recreateWindow;}); // y ウィンドウサイズをYouTube動画のサイズに合わせる。
Keys.bind("n",{System.resolution = [512, 384]; System.recreateWindow;}); // Shift + n ウィンドウサイズをニコニコ動画(NicoVideo)のサイズに合わせる。
//シミュレーション開始・停止
Keys.bind("space",{Sim.running =  ! Sim.running}); // スペースキー シミュレーション開始/停止
Keys.bind("pause",{Sim.running = false}); // Pause シミュレーション停止
Keys.bind("enter",{Sim.running = true}); // テンキーの方のEnter シミュレーション再開
//ファンクションキーの拡張(「Drow inside object」と 「シミュレーション中のヒンジ・固定具ON / OFF」の設定は別の箇所にあります。)
Keys.bind("f1",{GUI.opaqueness = 0.9 - GUI.opaqueness}); // Shift + F1 文字オン/オフ
Keys.bind("menu",{GUI.opaqueness = 0.9 - GUI.opaqueness}); // メニューキー 〃(同じ効果です)
Keys.bind("f2",{Sim.airFrictionOn = !Sim.airFrictionOn}); // F2 空気抵抗 ON/OFF
Keys.bind("f3",{App.simpleWater = ! App.simpleWater}); // F3 Simple water rendering ON/OFF
Keys.bind("f4",{Sim.gravitySwitch =  ! Sim.gravitySwitch}); // F4 重力 ON/OFF
//    
Keys.bind("f5",{App.drawVertices =  ! App.drawVertices}); // F5 頂点座標 ON/OFF
Keys.bind("f6",{App.drawBodyCenters =  ! App.drawBodyCenters}); // F6 重心座標 ON/OFF
Keys.bind("f7",{App.drawVertices = false; App.drawBodyCenters = false; App.drawCollisions = false;}); // F7 [F5][F6][F8]をすべてOFF
Keys.bind("f8",{App.drawCollisions =  ! App.drawCollisions}); // F8 力表示 ON/OFF
//    
Keys.bind("f9",{App.drawClouds = ! App.drawClouds}); // F9 雲表示 ON/OFF
Keys.bind("f10",{App.borders = ! App.borders}); // F10 オブジェクト境界線 ON/OFF
// F11 [F11]はコンソール画面を出すコマンドのため、変更不可能。
Keys.bind("f12",{System.screenshot}); // F12 スクリーンショット
//背景と水の色
Keys.bind("1",{App.Background.skyColor = [0.3, 0.4, 1.0, 1.0]}); // Shift + 1 背景色をデフォルト(青い空)に。
Keys.bind("2",{App.Background.skyColor = [0.1, 0.1, 0.1, 1.0]}); // Shift + 2 背景色を暗く(夜or宇宙モード)。
Keys.bind("3",{App.Background.skyColor = [0.0, 0.0, 0.4, 1.0]}); // Shift + 3 背景を濃い青に(深海モード)。
Keys.bind("4",{App.Background.skyColor = [1.0, 0.25, 0.0, 1.0]}); // Shift + 4 背景をオレンジに(夕焼けモード)。
Keys.bind("5",{App.Background.skyColor = [1.0, 1.0, 1.0, 1.0]}); // Shift + 5 背景色を真っ白に(白板モード)。
Keys.bind("6",{GUI.Component.App.waterColor = [0.0, 0.0, 0.0, 0.7]}); // Shift + 6 水の色を黒に。
Keys.bind("7",{GUI.Component.App.waterColor = [0.0, 1.0, 0.0, 1.0]}); // Shift + 7 水の色を緑に。…のはずだけど、色が変。
Keys.bind("8",{GUI.Component.App.waterColor = [1.0, 0.0, 0.0, 1.0]}); // Shift + 8 水の色を赤に(溶岩モード)。
Keys.bind("9",{GUI.Component.App.waterColor = [1.0, 1.0, 1.0, 0.7]}); // Shift + 9 水の色を薄い灰色(ほとんど白)に。 
Keys.bind("0",{GUI.Component.App.waterColor = [0.1, 0.1, 1.0, 0.8]}); // Shift + 0 色の水をデフォルトに。
Keys.bind("-",{App.Background.skyColor = [0.3, 0.4, 1.0, 1.0]; GUI.Component.App.waterColor = [0.1, 0.1, 1.0, 0.8]}); // テンキーでない方の- 背景色と、水の色をデフォルトに。
//普段いじらない値のリセット
Keys.bind("tab",{GUI.opaqueness = 0.9; App.Background.skyColor = [0.3, 0.4, 1.0, 1.0]; GUI.Component.App.waterColor = [0.1, 0.1, 1.0, 0.8]; GUI.scale = 1.0; App.dragToolStrength = 0.25; App.pointSize = 4; System.antiAlias = 1; App.lineWidth = 4; Keys.bind("right", {}); Keys.bind("left", {}); App.GUI.zoomFactor = 0.2;}); // Tab 普段変更しない値をデフォルトに戻す。
Keys.bind("backspace",{GUI.opaqueness = 0.9; App.Background.skyColor = [0.3, 0.4, 1.0, 1.0]; GUI.Component.App.waterColor = [0.1, 0.1, 1.0, 0.8]; GUI.scale = 1.0; App.dragToolStrength = 0.25; App.pointSize = 4; System.antiAlias = 1; App.lineWidth = 4; Keys.bind("right", {}); Keys.bind("left", {}); App.GUI.zoomFactor = 0.2;}); // BackSpace 〃(同じ効果です)
//ワイドとズーム(文字の大きさも変わります)。
Keys.bind("q",{GUI.scale = 1.0}); // q 元のサイズ
Keys.bind("w",{GUI.scale = GUI.scale - 0.1}); // w 撮影する範囲を広く(広角:Wide-angle)。
Keys.bind("e",{GUI.scale = GUI.scale - 0.02}); // e 撮影する範囲を広く。
Keys.bind("r",{GUI.scale = GUI.scale + 0.02}); // r 被写体を大きく写す。
Keys.bind("t",{GUI.scale = GUI.scale + 0.1}); // t 被写体を大きく写す(望遠:Telescope)。
//Drow inside object
Keys.bind("insert",{App.GUI.drawInside = ! App.GUI.drawInside}); // Insert Drow inside object ON/OFF
Keys.bind("i",{App.GUI.drawInside = true}); // i Drow inside object ON (Inside)
Keys.bind("o",{App.GUI.drawInside = false}); // o Drow inside object OFF (Outside only)
//点のサイズと線の幅
Keys.bind("p",{App.pointSize = ((((0 - 7) * App.pointSize) * App.pointSize) + ((33 * App.pointSize) - 14)) / 6}); // Shift + p [F5],[F6]の点のサイズを1←→2←→4 (Vertices, Points)
Keys.bind("v",{App.pointSize = ((((0 - 7) * App.pointSize) * App.pointSize) + ((33 * App.pointSize) - 14)) / 6}); // v [F5],[F6]の点のサイズを1←→2←→4 (Vertices, Points)
Keys.bind("l",{App.lineWidth = ((((0 - 7) * App.lineWidth) * App.lineWidth) + ((33 * App.lineWidth) - 14)) / 6}); // l (エル) 描くときの線幅と[F8]の赤線の線幅を1←→2←→4 (Lines)
Keys.bind("b",{App.borderWidth = 1.1- App.borderWidth}); // Shift + b ポリゴンの境界の幅を0.1 ←→ 1に(Border width)
// ドラッグの強さ
Keys.bind("s",{App.dragToolStrength = 0.5}); // Shift + s ドラッグツールの強さを強く(Strong)。
Keys.bind("d",{App.dragToolStrength = 0.25}); // Shift + d ドラッグツールの強さをデフォルトに (Default Drag tool strength)。
Keys.bind("c",{App.dragToolStrength = 0.1}); // Shift + c ドラッグツールの強さを弱く。
//シミュレーション中のヒンジ(h)・固定具(f) ON / OFF
Keys.bind("f",{App.GUI.drawHingesWhenRunning = false}); // Shift + f シミュレーション中のヒンジ(h)・固定具(F) OFF (False)
Keys.bind("g",{App.GUI.drawHingesWhenRunning = ! App.GUI.drawHingesWhenRunning}); // g シミュレーション中のヒンジ(h)・固定具(f) ON / OFF
Keys.bind("h",{App.GUI.drawHingesWhenRunning = true}); // Shift + h シミュレーション中のヒンジ(H)・固定具(f) ON
//speed
Keys.bind("u",{Sim.timeFactor = Sim.timeFactor * 2}); // u speedを2倍に(speed Up)
Keys.bind("home",{Sim.timeFactor = Sim.timeFactor - 1.0}); // Home ([Fn] + [←] ?) speedを1.0減らす。
Keys.bind("j",{Sim.timeFactor = Sim.timeFactor - 0.1}); // j speedを0.1減らす。
Keys.bind("k",{Sim.timeFactor = Sim.timeFactor + 0.1}); // k speedを0.1増やす。
Keys.bind("end",{Sim.timeFactor = Sim.timeFactor + 1.0}); // End ([Fn] + [→] ?) speedを1.0増やす。
Keys.bind("'",{Sim.timeFactor = 1}); // : speed: 1.00
//その他
Keys.bind("a",{System.antiAlias = 3 - System.antiAlias}); // a アンチエイリアスを1←→2 (Anti Alias)
Keys.bind("z",{App.GUI.zoomFactor = 1.2 - App.GUI.zoomFactor}); // z ホイールでズーム(Zoom)するときの変化率を0.2 ←→ 1.0
Keys.bind("m",{Keys.bind("right",{Sim.running =  true}); Keys.bind("left",{Sim.running =  true});}); // m 矢印キーを押したときに、シミュレーションを開始する。
Keys.bind("/",{Keys.bind("right", {}); Keys.bind("left", {}); Sim.running =  false;}); // / シミュレーションを一時停止した上で、上記[m]を否定。