/// <summary> /// Start up and run the server. /// </summary> public void StartUp(string args) { Files.Init(); SysConsole.Output(OutputType.INIT, "Launching as new client, this is " + (this == Central ? "" : "NOT ") + "the Central client."); SysConsole.Output(OutputType.INIT, "Loading command system..."); Commands = new ClientCommands(); Commands.Init(new ClientOutputter(this), this); SysConsole.Output(OutputType.INIT, "Loading CVar system..."); CVars = new ClientCVar(); CVars.Init(this, Commands.Output); SysConsole.Output(OutputType.INIT, "Loading default settings..."); if (Files.Exists("clientdefaultsettings.cfg")) { string contents = Files.ReadText("clientdefaultsettings.cfg"); Commands.ExecuteCommands(contents); } Commands.ExecuteCommands(args); SysConsole.Output(OutputType.INIT, "Generating window..."); Window = new GameWindow(CVars.r_width.ValueI, CVars.r_height.ValueI, new GraphicsMode(24, 24, 0, 0), Program.GameName + " v" + Program.GameVersion, GameWindowFlags.Default, DisplayDevice.Default, 4, 3, GraphicsContextFlags.ForwardCompatible); Window.Location = new Point(0, 0); Window.WindowState = CVars.r_fullscreen.ValueB ? WindowState.Fullscreen : WindowState.Normal; Window.Load += new EventHandler<EventArgs>(Window_Load); Window.RenderFrame += new EventHandler<FrameEventArgs>(Window_RenderFrame); Window.Mouse.Move += new EventHandler<MouseMoveEventArgs>(MouseHandler.Window_MouseMove); Window.KeyDown += new EventHandler<KeyboardKeyEventArgs>(KeyHandler.PrimaryGameWindow_KeyDown); Window.KeyPress += new EventHandler<KeyPressEventArgs>(KeyHandler.PrimaryGameWindow_KeyPress); Window.KeyUp += new EventHandler<KeyboardKeyEventArgs>(KeyHandler.PrimaryGameWindow_KeyUp); Window.Mouse.WheelChanged += new EventHandler<MouseWheelEventArgs>(KeyHandler.Mouse_Wheel); Window.Mouse.ButtonDown += new EventHandler<MouseButtonEventArgs>(KeyHandler.Mouse_ButtonDown); Window.Mouse.ButtonUp += new EventHandler<MouseButtonEventArgs>(KeyHandler.Mouse_ButtonUp); Window.Resize += Window_Resize; Window.Closed += Window_Closed; onVsyncChanged(CVars.r_vsync, null); Window.Run(1, CVars.r_maxfps.ValueD); }