Skip to content

MouseState._pressedButtons not return to MemoryPool #2411

Open
@Sarofc

Description

@Sarofc

version 2.22

Image
internal MouseState(IMouse mouse, MemoryPool<byte> pool)
{
	//IL_0097: Unknown result type (might be due to invalid IL or missing references)
	//IL_009d: Expected I4, but got Unknown
	//IL_015f: Unknown result type (might be due to invalid IL or missing references)
	//IL_0164: Unknown result type (might be due to invalid IL or missing references)
	Name = ((IInputDevice)mouse).Name;
	Index = ((IInputDevice)mouse).Index;
	IsConnected = ((IInputDevice)mouse).IsConnected;
	IReadOnlyList<MouseButton> supportedButtons = mouse.SupportedButtons;
	_buttonCount = supportedButtons.Count;
	_buttons = pool.Rent(_buttonCount * 4);
	_pressedButtons = pool.Rent(_buttonCount * 4);
	_pressedButtonCount = _buttonCount;
	Span<MouseButton> supportedButtons2 = GetSupportedButtons();
	Span<MouseButton> pressedButtons = GetPressedButtons();
	_pressedButtonCount = 0;
	for (int i = 0; i < _buttonCount; i++)
	{
		supportedButtons2[i] = (MouseButton)(int)supportedButtons[i];
		if (mouse.IsButtonPressed(supportedButtons2[i]))
		{
			pressedButtons[_pressedButtonCount++] = supportedButtons2[i];
		}
	}
	using (_pressedButtons)
	{
		Span<MouseButton> pressedButtons2 = GetPressedButtons();
		_pressedButtons = pool.Rent(_pressedButtonCount * 4);
		pressedButtons = GetPressedButtons();
		pressedButtons2.CopyTo(pressedButtons);
		IReadOnlyList<ScrollWheel> scrollWheels = mouse.ScrollWheels;
		_scrollWheelCount = scrollWheels.Count;
		_scrollWheels = pool.Rent(_scrollWheelCount * Unsafe.SizeOf<ScrollWheel>());
		Span<ScrollWheel> scrollWheels2 = GetScrollWheels();
		for (int j = 0; j < _scrollWheelCount; j++)
		{
			scrollWheels2[j] = scrollWheels[j];
		}
		Position = mouse.Position;
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy