AGS.Editor.CharactersEditorFilter.DrawCharacter C# (CSharp) Метод

DrawCharacter() приватный Метод

private DrawCharacter ( AGS.Types.Character character, RoomEditorState state ) : void
character AGS.Types.Character
state RoomEditorState
Результат void
        private void DrawCharacter(Character character, RoomEditorState state)
        {
            AgsView view = _game.FindViewByID(character.NormalView);

            if (view != null && view.Loops.Count > 0)
            {
                int scale = state.ScaleFactor;

                int spriteNum = 0;

                //this is a check to make certain that loop 0 frame 0 of the character normalview has an image;
                //if not, it defaults to using spriteNum 0
                if (view.Loops[0].Frames.Count > 0)
                {
                    ViewFrame thisFrame = view.Loops[0].Frames[0];
                    spriteNum = thisFrame.Image;
                }
                int xPos = AdjustXCoordinateForWindowScroll(character.StartX, state);// character.StartX* scale;
                int yPos = AdjustYCoordinateForWindowScroll(character.StartY, state);// character.StartY* scale;
                int spriteWidth = GetSpriteWidthForGameResolution(spriteNum) * scale;// Factory.NativeProxy.GetRelativeSpriteWidth(spriteNum) * scale;
                int spriteHeight = GetSpriteHeightForGameResolution(spriteNum) * scale; // Factory.NativeProxy.GetRelativeSpriteHeight(spriteNum) * scale;

                Factory.NativeProxy.DrawSpriteToBuffer(spriteNum, xPos - spriteWidth / 2, yPos - spriteHeight, scale);
            }
        }