コード例 #1
0
        internal override void Resize(int newSize)
        {
            var oldCapacity = m_Capacity;

            m_Capacity = newSize;
            Array.Resize(ref QueryMatchIds, newSize);
            Array.Resize(ref QueryArgs, newSize);
            Array.Resize(ref Exclusivities, newSize);

            Array.Resize(ref UpdateMatchInterval, newSize);
            Array.Resize(ref TimeOuts, newSize);
            Array.Resize(ref ReAcquireOnLoss, newSize);
            Array.Resize(ref Priority, newSize);

            Array.Resize(ref Conditions, newSize);
            Array.Resize(ref TraitRequirements, newSize);
            Array.Resize(ref CachedTraits, newSize);
            Array.Resize(ref ConditionRatings, newSize);
            Array.Resize(ref ConditionMatchSets, newSize);
            Array.Resize(ref ReducedConditionRatings, newSize);

            Array.Resize(ref BestMatchDataIds, newSize);
            for (int i = oldCapacity; i < newSize; i++)
            {
                BestMatchDataIds[i] = (int)ReservedDataIDs.Invalid;
            }

            Array.Resize(ref QueryResults, newSize);
            Array.Resize(ref AcquireHandlers, newSize);
            Array.Resize(ref UpdateHandlers, newSize);
            Array.Resize(ref LossHandlers, newSize);
            Array.Resize(ref TimeoutHandlers, newSize);
            OnResize?.Invoke();
        }
コード例 #2
0
ファイル: GlfwWindow.cs プロジェクト: piRepos/pEngine-del
        private void InitializePositionEvents()
        {
			MovFun = (Glfw.Window P, int X, int Y) =>
			{
				foreach (IMonitor monitor in Environment.Platform.AvaiableMonitors)
				{
					if (Position > monitor.Position && Position < monitor.Position + monitor.CurrentResolution.ResolutionSize)
						Monitor = monitor;
				}

				OnMove?.Invoke(this, new WindowMoveEventArgs { Position = new Vector2i(X, Y) });
			};

			SizFun = (Glfw.Window P, int W, int H) =>
			{
				foreach (IMonitor monitor in Environment.Platform.AvaiableMonitors)
				{
					if (Position > monitor.Position && Position < monitor.Position + monitor.CurrentResolution.ResolutionSize)
						Monitor = monitor;
				}

				OnResize?.Invoke(this, new WindowResizeEventArgs { Size = new Vector2i(W, H) });
			};

			Glfw.SetWindowPosCallback(Handle, MovFun);
			Glfw.SetWindowSizeCallback(Handle, SizFun);
        }
コード例 #3
0
        public void InitEvents()
        {
            parent.Resize += (object obj, EventArgs args) => onResize?.Invoke(this, parent.Location.X, parent.Location.Y, parent.Size.Width, parent.Size.Height);

            parent.MouseDown += (object obj, MouseEventArgs args) =>
            {
                if (args.Button == MouseButtons.Left &&
                    Enumerable.Range(x, x + w).Contains(args.X) &&
                    Enumerable.Range(y, y + h).Contains(args.Y))
                {
                    OnClickEvent?.Invoke(this, args);
                }
            };

            parent.Paint += (object obj, PaintEventArgs args) =>
            {
                if (!SoundElement.IsEditing && this.editOnly)
                {
                    return;
                }

                var graphic = args.Graphics;

                graphic.FillRectangle(this.paintColor, new Rectangle(x, y, w, h));
            };
        }
        internal override void Resize(int newSize)
        {
            var oldCapacity = m_Capacity;

            m_Capacity = newSize;
            Array.Resize(ref QueryMatchIds, newSize);
            Array.Resize(ref Exclusivities, newSize);
            Array.Resize(ref Required, newSize);
            Array.Resize(ref Conditions, newSize);
            Array.Resize(ref TraitRequirements, newSize);
            Array.Resize(ref CachedTraits, newSize);
            Array.Resize(ref ConditionRatings, newSize);
            Array.Resize(ref ConditionMatchSets, newSize);
            Array.Resize(ref ReducedConditionRatings, newSize);

            Array.Resize(ref BestMatchDataIds, newSize);
            for (int i = oldCapacity; i < newSize; i++)
            {
                BestMatchDataIds[i] = (int)ReservedDataIDs.Invalid;
            }

            Array.Resize(ref QueryResults, newSize);
            Array.Resize(ref ObjectReferences, newSize);
            Array.Resize(ref RelationMemberships, newSize);
            OnResize?.Invoke();
        }
コード例 #5
0
        private void InvokeResizeEvents()
        {
            var event_args = new ElementResizeArgs(this, ActualRowSpan, ActualColumnSpan);

            OnResize?.Invoke(event_args);
            Grid.OnResize?.Invoke(event_args);
        }
コード例 #6
0
 internal override void Resize(int newSize)
 {
     m_Capacity = newSize;
     Array.Resize(ref QueryMatchIds, newSize);
     Array.Resize(ref SetQueryArgs, newSize);
     Array.Resize(ref QueryResults, newSize);
     Array.Resize(ref OrderWeights, newSize);
     Array.Resize(ref UsedByMatch, newSize);
     Array.Resize(ref RelationIndexPairs, newSize);
     Array.Resize(ref LocalRelationIndexPairs, newSize);
     Array.Resize(ref RatingConfigurations, newSize);
     Array.Resize(ref MemberIndices, newSize);
     Array.Resize(ref CachedTraits, newSize);
     Array.Resize(ref Relations, newSize);
     Array.Resize(ref RelationRatings, newSize);
     Array.Resize(ref SearchData, newSize);
     Array.Resize(ref SetMatchData, newSize);
     Array.Resize(ref ReAcquireOnLoss, newSize);
     Array.Resize(ref Priorities, newSize);
     Array.Resize(ref UpdateMatchInterval, newSize);
     Array.Resize(ref LastUpdateCheckTime, newSize);
     Array.Resize(ref TimeOuts, newSize);
     Array.Resize(ref AcquireHandlers, newSize);
     Array.Resize(ref UpdateHandlers, newSize);
     Array.Resize(ref LossHandlers, newSize);
     Array.Resize(ref TimeoutHandlers, newSize);
     OnResize?.Invoke();
 }
コード例 #7
0
 public static async Task OnBrowserResize()
 {
     if (OnResize != null)
     {
         await OnResize.Invoke();
     }
 }
コード例 #8
0
 public void Start()
 {
     OnCorection?.Invoke();
     OnDetect?.Invoke();
     OnResize?.Invoke();
     OnCompare?.Invoke();
     pi.Save(procededImagesSavePath);
 }
コード例 #9
0
        public static async Task OnBrowserResize()
        {
            if (OnResize == null)
            {
                return;
            }

            await OnResize.Invoke();
        }
コード例 #10
0
 //If the screen was resized, notify listeners and reset the stored resolution
 private void LateUpdate()
 {
     if (prevResolution.x != Screen.width || prevResolution.y != Screen.height)
     {
         OnResize?.Invoke(prevResolution);
         prevResolution.x = Screen.width;
         prevResolution.y = Screen.height;
     }
 }
コード例 #11
0
ファイル: LowLevelElement.cs プロジェクト: igorurr/vicos
        // так как размеры элемента могут измениться из-за ресайза родителя, надо тречить,
        // проверки одних текущих свойств недостаточно
        void CheckUpdate()
        {
            if (WidthHeight != oldWH)
            {
                OnResize?.Invoke(oldWH);
                DoResize(oldWH);
            }

            oldWH = WidthHeight;
        }
コード例 #12
0
    public void Refresh()
    {
        Target.Release();
        Target = new RenderTexture((int)(Screen.width * u), (int)(Screen.height * v), 24);
        Target.antiAliasing = 4;
        c.targetTexture     = Target;
        res.width           = Screen.width;
        res.height          = Screen.height;

        OnResize?.Invoke();
    }
コード例 #13
0
        void HandleResizeEvent(EditorWindow window)
        {
            Vector2 currentWindowScale = new Vector2(window.position.width, window.position.height);

            if (currentWindowScale != windowScale)
            {
                windowScale = currentWindowScale;

                OnResize?.Invoke(window);
            }
        }
コード例 #14
0
        public void Resize(int width, int height)
        {
            int minW = Math.Min(width, world.GetLength(0));
            int minH = Math.Min(height, world.GetLength(1));

            bool[,] tmp = new bool[width, height];
            for (int x = 0; x < minW; x++)
            {
                for (int y = 0; y < minH; y++)
                {
                    tmp[x, y] = world[x, y];
                }
            }
            world = tmp;
            OnResize?.Invoke();
        }
コード例 #15
0
 static public void InvokeOnResize(EventArgs eventargs)
 {
     Resolution = new Size(DisplayAdapter.ClientRectangle.Width, DisplayAdapter.ClientRectangle.Height);
     if (Resolution.Width == 0)
     {
         Resolution.Width = 1;
     }
     if (Resolution.Height == 0)
     {
         Resolution.Height = 1;
     }
     DisplayAdapter.MainRenderer.Resize(Resolution.Width, Resolution.Height);
     if (OnResize != null)
     {
         OnResize.Invoke(null, eventargs);
     }
 }
コード例 #16
0
 /// <summary>
 /// Событие перемещение мыши над элементом
 /// </summary>
 protected override void OnMouseMove(MouseEventArgs e)
 {
     if (IsMouseCaptured && this.Parent is StackPanel SP && SP.Children.Count > 1)
     {
         if (SP.Children.IndexOf(this) - 1 is int index && index >= 0 && SP.Children[index] is Border b)
         {
             if (this.PointToScreen(Mouse.GetPosition(this)).X is double DragX && Math.Abs(DragX - ClickX) > 2)
             {
                 if (Math.Round(b.Width + (DragX - ClickX)) is double NewWidth && NewWidth > 0)
                 {
                     b.Width = NewWidth;
                     ClickX  = DragX;
                     OnResize?.Invoke(this, new EventArgs());
                 }
             }
         }
     }
 }
コード例 #17
0
        private void DoResize(int width, int height)
        {
            while (Renderer.Instance.RenderingInProgress)
            {
            }
            var rt = RenderTarget.RenderTargets[0];

            rt.Clear();
            swapChain.ResizeBuffers(1, width, height, Format.Unknown, SwapChainFlags.AllowModeSwitch);
            using (var tex = Resource.FromSwapChain <Texture2D>(swapChain, 0)) {
                rt.Update(null, new RenderTargetView(Renderer.Instance.Device, tex));
                rt.SendResizeEvent();
            }
            Viewport = new Viewport(0, 0, width, height);
            OnResize?.Invoke(this, new Event.SResizeEvent {
                Size = new System.Drawing.Size(width, height)
            });
        }
コード例 #18
0
        /// <summary>
        /// Increases the buffer size. Any call to this method must be protected with a lock.
        /// </summary>
        /// <param name="size">
        /// The new buffer size.
        /// </param>
        private void Grow(int size)
        {
            if (size > maximumSize)
            {
                throw new OutOfMemoryException();
            }

            var newBuffer = ArrayPool <byte> .Shared.Rent(size);

            if (WriteWaterMark < ReadWaterMark)
            {
                // Copy the data at the start
                Array.Copy(buffer, 0, newBuffer, 0, WriteWaterMark);

                var trailingDataLength = buffer.Length - ReadWaterMark;
                Array.Copy(
                    buffer,
                    ReadWaterMark,
                    newBuffer,
                    newBuffer.Length - trailingDataLength,
                    trailingDataLength);

                ReadWaterMark += newBuffer.Length - buffer.Length;
            }
            else
            {
                // ... [Read WM] ... [Write WM] ... [newly available space]
                Array.Copy(buffer, 0, newBuffer, 0, buffer.Length);
            }

            ArrayPool <byte> .Shared.Return(buffer);

            buffer = newBuffer;

            Debug.Assert(bytesRead + AvailableReadableBytes == bytesWritten);
            OnResize?.Invoke(this, EventArgs.Empty);
        }
コード例 #19
0
 public static async Task OnBrowserResize()
 {
     await OnResize?.Invoke();
 }
コード例 #20
0
 public void Component_OnResize(Vector location) => OnResize?.Invoke(this, location);
コード例 #21
0
        private void ProcFunction()
        {
            while (true)
            {
                try
                {
                    var starttime = DateTime.Now;

                    //Get values
                    point  = Owner.GetMCursorPositionConsole();
                    pointg = Owner.GetMCursorPositionScreen();
                    mb     = Owner.GetMouseButtonScreen();
                    mbg    = Owner.GetMouseButtonScreen();
                    s      = Owner.GetWindowSize();
                    for (var i = 0; i < 255; i++)
                    {
                        keysg[i] = Owner.GetKeyState(i);
                    }

                    //OnResize
                    if (s.Width != olds.Width || s.Height != olds.Height)
                    {
                        OnResize?.Invoke(s);
                    }

                    //OnMouseMove
                    //if (point.X != oldpoint.X || point.Y != oldpoint.Y)
                    //    OnMouseMove?.Invoke(point.X, point.Y, pointg.X, pointg.Y, mb);

                    //OnGlobalMouseMove
                    //if (pointg.X != oldpointg.X || pointg.Y != oldpointg.Y)
                    //    OnGlobalMouseMove?.Invoke(pointg.X, pointg.Y, mbg);

                    //OnGlobalKey*
                    for (var i = 0; i < 255; i++)
                    {
                        if (keysg[i] != oldkeysg[i])
                        {
                            if (keysg[i] == 0)
                            {
                                OnGlobalKeyUp?.Invoke(i, keysg);
                            }
                            else
                            {
                                OnGlobalKeyDown?.Invoke(i, keysg);
                            }
                            break;
                        }
                    }

                    //OnMouse*
                    //if (mb != oldmb)
                    //    if (mb == MButton.Null)
                    //        OnMouseUp?.Invoke(point.X, point.Y, pointg.X, pointg.Y, point.X != new Point().X && point.Y != new Point().Y, oldmb);
                    //    else if (mb != MButton.Null)
                    //        OnMouseDown?.Invoke(point.X, point.Y, pointg.X, pointg.Y, point.X != new Point().X && point.Y != new Point().Y, mb);

                    //OnKeyDown
                    if (Console.KeyAvailable)
                    {
                        key = Console.ReadKey().KeyChar;
                        OnKeyDown?.Invoke(key);
                    }

                    //Save old values
                    olds = s;
                    keysg.CopyTo(oldkeysg, 0);
                    oldkey    = key;
                    oldmb     = mb;
                    oldpoint  = point;
                    oldpointg = pointg;

                    //OnEventHandlerTimerElapsed
                    OnEventHandlerTimerElapsed?.Invoke((DateTime.Now - starttime).TotalMilliseconds);
                }
                catch (Exception ex)
                {
                    CallException(ex);
                }

                Thread.Sleep(CyclicCheckingEventsInterval);
            }
        }
コード例 #22
0
ファイル: Preview.cs プロジェクト: Svinoed/IntellectEye
 private void Preview_SizeChanged(object sender, EventArgs e)
 {
     //При вызове изменения размеров выполняется проверка на null
     OnResize?.Invoke(sender, e);
 }
コード例 #23
0
 public void Component_OnResize(Vector size) => OnResize?.Invoke(this, size);
コード例 #24
0
 private void OnWindowResize(WindowHandle *window, int width, int height)
 => OnResize?.Invoke(width, height);
コード例 #25
0
 public static void InvokeOnResize()
 {
     OnResize?.Invoke();
 }
コード例 #26
0
 protected void Resize()
 {
     OnResize?.Invoke();
     //(Engine.Instance.RenderBackend as D3D11.D3D11RenderBackend).RenderPath.Resize();
     //Engine.Instance.MainCamera.AspectRatio = AspectRatio;
 }
コード例 #27
0
 public void SendResizeEvent()
 {
     OnResize?.Invoke(this, new Event.SResizeEvent {
         Size = new System.Drawing.Size(Width, Height)
     });
 }
コード例 #28
0
 public void NotifyResize(ResizeEvent e) => OnResize?.Invoke(this, e);
コード例 #29
0
 /// <summary>
 ///
 /// Invoke OnResize event.
 ///
 /// </summary>
 protected void InvokeResize()
 {
     OnResize?.Invoke(this);
 }
コード例 #30
0
        LRESULT WndProc(HWND hwnd, WM msg, WPARAM wParam, LPARAM lParam)
        {
            switch (msg)
            {
            case WM.CLOSE:
                OnClose?.Invoke();
                if (DestroyWhenClose == null || DestroyWhenClose())
                {
                    User32.DestroyWindow(hwnd);
                }
                return(0);

            case WM.ENABLE:
                OnEnable?.Invoke(wParam);
                break;

            case WM.SHOWWINDOW:
                OnShow?.Invoke(wParam);
                break;

            case WM.DESTROY:
                OnDestroy?.Invoke();
                return(0);

            case WM.MOUSEMOVE:
                OnMouseMove?.Invoke(lParam.LowWord, lParam.HiWord);
                return(0);

            case WM.LBUTTONDOWN:
                OnMouseLeftDown?.Invoke(lParam.LowWord, lParam.HiWord);
                return(0);

            case WM.LBUTTONUP:
                OnMouseLeftUp?.Invoke(lParam.LowWord, lParam.HiWord);
                return(0);

            case WM.LBUTTONDBLCLK:
                OnMouseLeftDoubleClicked?.Invoke();
                return(0);

            case WM.RBUTTONDOWN:
                OnMouseRightDown?.Invoke(lParam.LowWord, lParam.HiWord);
                return(0);

            case WM.RBUTTONUP:
                OnMouseRightUp?.Invoke(lParam.LowWord, lParam.HiWord);
                return(0);

            case WM.MBUTTONDOWN:
                OnMouseMiddleDown?.Invoke(lParam.LowWord, lParam.HiWord);
                return(0);

            case WM.MBUTTONUP:
                OnMouseMiddleUp?.Invoke(lParam.LowWord, lParam.HiWord);
                return(0);

            case WM.MOUSEWHEEL:
                OnMouseWheel?.Invoke(wParam.HiWord);
                return(0);

            case WM.RESIZE:
                OnResize?.Invoke(lParam.LowWord, lParam.HiWord);
                return(0);

            case WM.PAINT:
            {
                var ps = default(PAINTSTRUCT);
                User32.BeginPaint(hwnd, ref ps);
                OnPaint?.Invoke();
                User32.EndPaint(hwnd, ref ps);
            }
                return(0);
            }
            return(User32.DefWindowProcW(hwnd, msg, wParam, lParam));
        }