public TrueCraftGame(MultiPlayerClient client, IPEndPoint endPoint) { Window.Title = "TrueCraft"; Content.RootDirectory = "Content"; Graphics = new GraphicsDeviceManager(this); Graphics.SynchronizeWithVerticalRetrace = false; Graphics.IsFullScreen = UserSettings.Local.IsFullscreen; Graphics.PreferredBackBufferWidth = UserSettings.Local.WindowResolution.Width; Graphics.PreferredBackBufferHeight = UserSettings.Local.WindowResolution.Height; Graphics.GraphicsProfile = GraphicsProfile.HiDef; Graphics.PreparingDeviceSettings += PrepareDeviceSettings; Graphics.ApplyChanges(); Window.ClientSizeChanged += Window_ClientSizeChanged; Client = client; EndPoint = endPoint; LastPhysicsUpdate = DateTime.MinValue; NextPhysicsUpdate = DateTime.MinValue; PendingMainThreadActions = new ConcurrentBag <Action>(); MouseCaptured = true; Bobbing = 0; KeyboardComponent = new KeyboardHandler(this); Components.Add(KeyboardComponent); MouseComponent = new MouseHandler(this); Components.Add(MouseComponent); GamePadComponent = new GamePadHandler(this); Components.Add(GamePadComponent); }
public static void Start(params string[] args) { var username = args.Length == 0 ? "" : args[0]; var endpoint = args.Length < 2 ? "127.0.0.1" : args[1]; UserSettings.Local = new UserSettings(); UserSettings.Local.Load(); var user = new TrueCraftUser { Username = username }; var client = new MultiPlayerClient(user); var game = new TrueCraftGame(client, ParseEndPoint(endpoint)); game.Run(); client.Disconnect(); }