public GameWindow() { InitializeComponent(); Instance = this; Cursor.Hide(); // Multi mouse input init InputDevice = new MultiDeviceInput.InputDevice(Handle); InputDevice.EnumerateDevices(); InputDevice.MouseDown += new MultiDeviceInput.InputDevice.MouseEventHandler(_MouseDown); InputDevice.MouseMove += new MultiDeviceInput.InputDevice.MouseEventHandler(_MouseMove); InputDevice.MouseUp += new MultiDeviceInput.InputDevice.MouseEventHandler(_MouseUp); InputDevice.MouseWheel += new MultiDeviceInput.InputDevice.MouseEventHandler(_MouseWheel); foreach (var KvP in InputDevice.DeviceList) { MouseData NewMouse = new MouseData(); NewMouse.PosX = Canvas.Width / 2; NewMouse.PosY = Canvas.Height / 2; NewMouse.Data = KvP.Value; Mouses.Add(KvP.Value.Info.deviceHandle, NewMouse); } }
static void Main(string[] args) { string LevelToLoad = ""; bool GotConsole = false; bool EnableWepons = false; string[] PlayerString = new string[0]; for (int i = 0; i < args.Length; i++) { if (args[i].StartsWith("-level=")) { LevelToLoad = args[i]; } else if(args[i].StartsWith("-players=")) { PlayerString = args[i].Substring(args[i].IndexOf('=') + 1).Split('.'); } else switch(args[i]) { case "-console": { AllocConsole(); Console.WriteLine("Console & Logging subsytem initialized!"); GotConsole = true; } break; case "-unlock_all_weapons": { EnableWepons = true; } break; } } if (GotConsole) { Console.WriteLine("Command line arguments: "); for (int i = 0; i < args.Length; i++) { Console.Write(args[i] + " "); } Console.WriteLine(); } if (string.IsNullOrEmpty(LevelToLoad)) { Console.WriteLine("No level to load!"); } Console.WriteLine("Creating window"); GameWindow mainForm = new GameWindow(); mainForm.Show(); Console.WriteLine("Creating game"); using (Game game = new Game(mainForm, LevelToLoad.Substring(LevelToLoad.IndexOf('=') + 1), PlayerString, EnableWepons)) { game.Run(); } }