Example #1
0
        public WorldViewportGump(GameScene scene) : base(0, 0)
        {
            AcceptMouseInput       = false;
            CanMove                = !Engine.Profile.Current.GameWindowLock;
            CanCloseWithEsc        = false;
            CanCloseWithRightClick = false;
            ControlInfo.Layer      = UILayer.Under;
            X            = Engine.Profile.Current.GameWindowPosition.X;
            Y            = Engine.Profile.Current.GameWindowPosition.Y;
            _worldWidth  = Engine.Profile.Current.GameWindowSize.X;
            _worldHeight = Engine.Profile.Current.GameWindowSize.Y;
            _button      = new Button(0, 0x837, 0x838, 0x838);

            _button.MouseDown += (sender, e) =>
            {
                if (!Engine.Profile.Current.GameWindowLock)
                {
                    _clicked = true;
                }
            };

            _button.MouseUp += (sender, e) =>
            {
                if (!Engine.Profile.Current.GameWindowLock)
                {
                    Point n = ResizeWindow(_lastSize);

                    OptionsGump options = Engine.UI.GetGump <OptionsGump>();
                    options?.UpdateVideo();

                    if (FileManager.ClientVersion >= ClientVersions.CV_200)
                    {
                        NetClient.Socket.Send(new PGameWindowSize((uint)n.X, (uint)n.Y));
                    }

                    _clicked = false;
                }
            };

            _button.SetTooltip("Resize game window");
            Width            = _worldWidth + BORDER_WIDTH * 2;
            Height           = _worldHeight + BORDER_HEIGHT * 2;
            _border          = new GameBorder(0, 0, Width, Height, 4);
            _border.DragEnd += (sender, e) =>
            {
                OptionsGump options = Engine.UI.GetGump <OptionsGump>();
                options?.UpdateVideo();
            };
            _viewport = new WorldViewport(scene, BORDER_WIDTH, BORDER_HEIGHT, _worldWidth, _worldHeight);

            Engine.UI.SystemChat = _systemChatControl = new SystemChatControl(BORDER_WIDTH, BORDER_HEIGHT, _worldWidth, _worldHeight);

            Add(_border);
            Add(_button);
            Add(_viewport);
            Add(_systemChatControl);
            Resize();

            _savedSize = _lastSize = Engine.Profile.Current.GameWindowSize;
        }
Example #2
0
        protected override void OnDragEnd(int x, int y)
        {
            OptionsGump options = Engine.UI.GetByLocalSerial <OptionsGump>();

            if (options != null)
            {
                options.UpdateVideo();
            }
        }
Example #3
0
        protected override void OnDragEnd(int x, int y)
        {
            OptionsGump options = Engine.UI.GetControl <OptionsGump>();

            options?.UpdateVideo();
        }