예제 #1
0
        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;
            Client = client;
            EndPoint = endPoint;
            NextPhysicsUpdate = DateTime.MinValue;
            ChunkMeshes = new List<Mesh>();
            IncomingChunks = new ConcurrentBag<Mesh>();
            PendingMainThreadActions = new ConcurrentBag<Action>();
            MouseCaptured = true;

            var keyboardComponent = new KeyboardComponent(this);
            KeyboardComponent = keyboardComponent;
            Components.Add(keyboardComponent);

            var mouseComponent = new MouseComponent(this);
            MouseComponent = mouseComponent;
            Components.Add(mouseComponent);
        }
예제 #2
0
        public ChatInterface(MultiplayerClient client, KeyboardComponent keyboard, FontRenderer font)
        {
            Client = client;
            Keyboard = keyboard;
            Font = font;

            Input = string.Empty;
            Messages = new List<ChatMessage>();
            DummyTexture = new Texture2D(keyboard.Game.GraphicsDevice, 1, 1);
            DummyTexture.SetData(new[] { Color.White });

            Client.ChatMessage += OnChatMessage;
            Keyboard.KeyDown += OnKeyDown;
        }