AGS.Editor.Utilities.GetSizeSpriteWillBeRenderedInGame C# (CSharp) Метод

GetSizeSpriteWillBeRenderedInGame() публичный статический Метод

Gets the size at which the sprite will be rendered in the game. This will be the sprite size, but doubled if it is a 320-res sprite in a 640-res game.
public static GetSizeSpriteWillBeRenderedInGame ( int spriteSlot, int &width, int &height ) : void
spriteSlot int
width int
height int
Результат void
        public static void GetSizeSpriteWillBeRenderedInGame(int spriteSlot, out int width, out int height)
        {
            width = Factory.NativeProxy.GetActualSpriteWidth(spriteSlot);
            height = Factory.NativeProxy.GetActualSpriteHeight(spriteSlot);

            if (Factory.AGSEditor.CurrentGame.IsHighResolution)
            {
                width *= Factory.NativeProxy.GetSpriteResolutionMultiplier(spriteSlot);
                height *= Factory.NativeProxy.GetSpriteResolutionMultiplier(spriteSlot);
            }
        }

Usage Example

Пример #1
0
        private void imagePanel_MouseDown(object sender, MouseEventArgs e)
        {
            if (_item != null)
            {
                int spriteWidth, spriteHeight;
                Utilities.GetSizeSpriteWillBeRenderedInGame(_item.Image, out spriteWidth, out spriteHeight);

                int newHotspotX = InverseScale(e.X);
                int newHotspotY = InverseScale(e.Y);
                if ((newHotspotX >= 0) && (newHotspotY >= 0) &&
                    (newHotspotX < spriteWidth) && (newHotspotY < spriteHeight))
                {
                    _item.HotspotX = newHotspotX;
                    _item.HotspotY = newHotspotY;
                    imagePanel.Invalidate();
                    Factory.GUIController.SetPropertyGridObject(_item);
                }
            }
        }
All Usage Examples Of AGS.Editor.Utilities::GetSizeSpriteWillBeRenderedInGame