AGS.Editor.CharactersEditorFilter.SelectCharacter C# (CSharp) Method

SelectCharacter() private method

private SelectCharacter ( AGS.Types.View view, AGS.Types.Character character, int xClick, int yClick, RoomEditorState state ) : void
view AGS.Types.View
character AGS.Types.Character
xClick int
yClick int
state RoomEditorState
return void
        private void SelectCharacter(AgsView view, Character character, int xClick, int yClick, RoomEditorState state)
        {
            int spriteNum = 0;

            if (view.Loops[0].Frames.Count > 0)
            {
                ViewFrame thisFrame = view.Loops[0].Frames[0];
                spriteNum = thisFrame.Image;
            }

            int width = GetSpriteWidthForGameResolution(spriteNum);
            int height = GetSpriteHeightForGameResolution(spriteNum);

            if ((xClick >= character.StartX - (width / 2)) && (xClick < character.StartX + (width / 2)) &&
                (yClick >= character.StartY - height) && (yClick < character.StartY))
            {
                if (!state.DragFromCenter)
                {
                    _mouseOffsetX = xClick - character.StartX;
                    _mouseOffsetY = yClick - character.StartY;
                }
                else
                {
                    _mouseOffsetX = 0;
                    _mouseOffsetY = 0;
                }
                _selectedCharacter = character;
                _movingCharacterWithMouse = true;
            }
        }