private void beginInArcadeMode(ref GameConfiguration gameConfig) { Boolean closed = true; Boolean stopRunner = false; Process game = new Process(); Process joyToKey = new Process(); GlobalMouseKeyboard globalMouseKeyboard = new GlobalMouseKeyboard(); runJoyToKey(ref gameConfig); while (!stopRunner) { if (globalMouseKeyboard.F2IsPressed) { //restart the game game.Kill(); closed = true; globalMouseKeyboard.F2IsPressed = false; } if (globalMouseKeyboard.F4IsPressed) { //end arcade mode game.Kill(); stopRunner = true; globalMouseKeyboard.Dispose(); } if (closed) { if (gameConfig.HideMouse) { Cursor.Position = new Point(2000, 2000); //work around } //another work around, set the cursor graphic to a transparent one, http://forums.whirlpool.net.au/archive/1172326 ProcessStartInfo psi = new ProcessStartInfo(gameConfig.GamePath); if (gameConfig.FullScreen) { psi.WindowStyle = ProcessWindowStyle.Maximized; //TODO: only maximizes fully if the taskbar is set to auto-hide } game = Process.Start(psi); closed = false; } game.WaitForExit(100); //? to reduce cpu usage? if (game.HasExited) { closed = true; } } }
private void beginInArcadeMode(ref GameConfiguration gameConfig) { Boolean closed = true; Boolean stopRunner = false; Process game = new Process(); Process joyToKey = new Process(); GlobalMouseKeyboard globalMouseKeyboard = new GlobalMouseKeyboard(); runJoyToKey(ref gameConfig); while (!stopRunner) { if (globalMouseKeyboard.F2IsPressed) { //restart the game game.Kill(); closed = true; globalMouseKeyboard.F2IsPressed = false; } if (globalMouseKeyboard.F4IsPressed) { //end arcade mode game.Kill(); stopRunner = true; globalMouseKeyboard.Dispose(); } if (closed) { if (gameConfig.HideMouse) Cursor.Position = new Point(2000, 2000); //work around //another work around, set the cursor graphic to a transparent one, http://forums.whirlpool.net.au/archive/1172326 ProcessStartInfo psi = new ProcessStartInfo(gameConfig.GamePath); if (gameConfig.FullScreen) psi.WindowStyle = ProcessWindowStyle.Maximized; //TODO: only maximizes fully if the taskbar is set to auto-hide game = Process.Start(psi); closed = false; } game.WaitForExit(100); //? to reduce cpu usage? if (game.HasExited) { closed = true; } } }
private void beginInArcadeMode(ref GameConfiguration gameConfig, String joyToKeyConfigPath, Boolean inArcadeMode, Boolean fullScreen, Boolean hideMouse) { Boolean closed = true; Boolean stopRunner = false; Process game = new Process(); Process joyToKey = new Process(); GlobalMouseKeyboard globalMouseKeyboard = new GlobalMouseKeyboard(); runJoyToKey(ref gameConfig, joyToKeyConfigPath); while (!stopRunner) { if (globalMouseKeyboard.F2IsPressed) { //restart the game game.Kill(); closed = true; globalMouseKeyboard.F2IsPressed = false; } if (globalMouseKeyboard.F4IsPressed) { //end arcade mode game.Kill(); stopRunner = true; globalMouseKeyboard.Dispose(); Rahil.Shared.tryKillProcess("JoyToKey"); } if (closed) { game = runGame(gameConfig, hideMouse, fullScreen); closed = false; } game.WaitForExit(100); //? to reduce cpu usage? if (game.HasExited) { closed = true; } } }