static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); dnTorque d = new dnTorque(); //GCHandle f = GCHandle.Alloc(d, GCHandleType.Pinned); d.InitializeTorque( new string[] { "-dedicated", "-mission", "levels/elf_isle.mis" }, "GameScripts.Main", @"C:\Torque\DotNetConnect\GameScripts\GameScripts\bin\Release\", @"GameScripts.dll"); }
private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new main_window()); //If we are running dedicated, there is no reason to show a form. DialogResult result = MessageBox.Show("Launch Dedicated", "Dedicated?", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { dnt_torque = new dnTorque(IntPtr.Zero); #if DEBUG dnt_torque.InitializeTorque(new[] {"-dedicated", "-mission", @"levels/Empty_Terrain.mis"}, "DNT_FPS_Demo_Game_Dll.Scripts.Server.Main", "DNT_FPS_Demo_Game_Dll.Scripts.Client.Main", "DNT_FPS_Demo_Game_Dll.Scripts.Main", "", "", "", Path.GetDirectoryName(Application.ExecutablePath) + "\\", @"DNT FPS Demo Game Dll.dll", "<!!__PROJECTNAME__!!>_DEBUG.dll"); #else dnt_torque.InitializeTorque(new[] {"-dedicated", "-mission", @"levels/Empty_Terrain.mis"}, "DNT_FPS_Demo_Game_Dll.Scripts.Server.Main", "DNT_FPS_Demo_Game_Dll.Scripts.Client.Main", "DNT_FPS_Demo_Game_Dll.Scripts.Main", "", "", "", Path.GetDirectoryName(Application.ExecutablePath) + "\\", @"DNT FPS Demo Game Dll.dll","<!!__PROJECTNAME__!!>_DEBUG.dll"); #endif } else { dnt_torque = new dnTorque(Process.GetCurrentProcess().Handle); //Initialize Torque, pass a handle to this form into T3D so it knows where to rendor the screen to. //If you don't do this, you can't pass the mouse and key strokes, w/out the mouse and keystrokes //being redirected the application will hang intermittently. #if DEBUG dnt_torque.InitializeTorque(new[] { "" }, "DNT_FPS_Demo_Game_Dll.Scripts.Server.Main", "DNT_FPS_Demo_Game_Dll.Scripts.Client.Main", "DNT_FPS_Demo_Game_Dll.Scripts.Main", "", "", "", Path.GetDirectoryName(Application.ExecutablePath) + "\\", @"DNT FPS Demo Game Dll.dll", "<!!__PROJECTNAME__!!>_DEBUG.dll"); #else dnt_torque.InitializeTorque(new[] {""}, "DNT_FPS_Demo_Game_Dll.Scripts.Server.Main", "DNT_FPS_Demo_Game_Dll.Scripts.Client.Main", "DNT_FPS_Demo_Game_Dll.Scripts.Main", "", "", "", Path.GetDirectoryName(Application.ExecutablePath) + "\\", @"DNT FPS Demo Game Dll.dll", "<!!__PROJECTNAME__!!>.dll"); #endif //Let's prepare the T3D display, } dnt_torque.WindowIcon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); //Turn verbose debugging off. dnt_torque.Debugging = false; while (dnt_torque.IsRunning) Thread.Sleep(1000); dnt_torque = null; Application.Exit(); }