当前位置: 首页>>代码示例>>C#>>正文


C# Layer.UsePixelCoordinates方法代码示例

本文整理汇总了C#中Layer.UsePixelCoordinates方法的典型用法代码示例。如果您正苦于以下问题:C# Layer.UsePixelCoordinates方法的具体用法?C# Layer.UsePixelCoordinates怎么用?C# Layer.UsePixelCoordinates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Layer的用法示例。


在下文中一共展示了Layer.UsePixelCoordinates方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenderableLayer

        public RenderableLayer (string contentManagerName, string thisName)
        {
            mContentManagerName = contentManagerName;
            mName = thisName;

            mRenderer = new RenderTargetRenderer(Camera.Main.DestinationRectangle.Width,
                Camera.Main.DestinationRectangle.Height);

            TargetLayer = new Layer();
            TargetLayer.UsePixelCoordinates();

            mSprite = new Sprite();
            mSprite.TextureScale = 1;
            SpriteManager.AddToLayer(mSprite, TargetLayer);
            mSprite.AttachTo(Camera.Main, false);
            mSprite.RelativeX = 0;
            mSprite.RelativeY = 0;
            mSprite.RelativeZ = -40;

        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:20,代码来源:RenderableLayer.cs

示例2: AddToManagers

 // Generated AddToManagers
 public override void AddToManagers()
 {
     HudLayer = SpriteManager.AddLayer();
     HudLayer.UsePixelCoordinates();
     AddToManagersBottomUp();
     CustomInitialize();
 }
开发者ID:BuffaloBuffalo,项目名称:FlatRedBall-Projects,代码行数:8,代码来源:GameScreen.Generated.cs

示例3: CustomInitialize

        void CustomInitialize()
		{
            if (!Layer2D.Texts.Contains(EntireScene.Texts[0]))
            {
                throw new Exception("Texts in entire Scenes which come from files in Screens are not properly added to Layers");
            }

            // The Layer defined by the Entity should be under the Layer defined by the screen.
            int indexOfEntityLayer = SpriteManager.Layers.IndexOf(this.LayerOwnerInstance.InternalLayer);
            int indexOfScreenLayer = SpriteManager.Layers.IndexOf(this.Layer2D);

            if (indexOfScreenLayer < indexOfEntityLayer)
            {
                throw new Exception("Unlayered Entity instances are placing their layers above the Layers defined by Screens");
            }


            if (Layer3DIndependentOfCamera.LayerCameraSettings == null)
            {
                throw new Exception("The 3D Layer needs its own LayerCameraSettings to be independent from the Camera");
            }
   
            if(Layer3DIndependentOfCamera.LayerCameraSettings.Orthogonal)
            {
                throw new Exception("The 3D Layer should not be orthogonal - it should be 3D 3D");
            }

            int right = FlatRedBall.Math.MathFunctions.RoundToInt(Layer2DPercentage.LayerCameraSettings.RightDestination);
            if (right != FlatRedBall.Math.MathFunctions.RoundToInt(SpriteManager.Camera.DestinationRectangle.Right * .4f))
            {
                throw new Exception("Percentage LayerCoordinateUnit is not working properly");
            }

            int left = FlatRedBall.Math.MathFunctions.RoundToInt(Layer2DPercentage.LayerCameraSettings.LeftDestination);
            if (left != FlatRedBall.Math.MathFunctions.RoundToInt(SpriteManager.Camera.DestinationRectangle.Right * .1f))
            {
                throw new Exception("Percentage LayerCoordinateUnit is not working properly - Left is wrong");
            }

            float orthoWidth = Layer2DPercentage.LayerCameraSettings.OrthogonalWidth;
            if ((orthoWidth - .3f * SpriteManager.Camera.OrthogonalWidth) > .1f)
            {
                throw new Exception("Percentage-based ortho widths are not working properly");
            }


            Sprite spriteThatShouldntBeOnMultipleLayers = this.LayerOwnerInstanceOnLayer.BearFromLayeredScene;
            int numberFound = 0;
            for (int i = 0; i < SpriteManager.Layers.Count; i++)
            {
                if (SpriteManager.Layers[i].Sprites.Contains(spriteThatShouldntBeOnMultipleLayers))
                {
                    numberFound++;
                }
            }
            if (numberFound > 1)
            {
                throw new Exception("Sprites which are on Layers in Entities which themselves are put on Layers are being rendered twice");
            }

            spriteThatShouldntBeOnMultipleLayers = this.LayerOwnerInstanceOnLayer.LayeredBear;
            numberFound = 0;
            for (int i = 0; i < SpriteManager.Layers.Count; i++)
            {
                if (SpriteManager.Layers[i].Sprites.Contains(spriteThatShouldntBeOnMultipleLayers))
                {
                    numberFound++;
                }
            }
            if (numberFound > 1)
            {
                throw new Exception("Sprites which are on Layers in Entities, which come from Scenes which are not on Layers, and have their Entity put on a Layer are being rendered twice.");
            }

            MoveToLayerEntityInstance.MoveToLayer(Layer2D);
            if (Layer2D.Circles.Contains(MoveToLayerEntityInstance.CircleInstance) == false)
            {
                throw new Exception("Circles on entities are not moved to a layer when calling MoveToLayer");
            }

            // set a 3D camera to make sure layers with null LayerCameraSettings are also 3d:
            Camera.Main.Orthogonal = false;

            layer2D = Camera.Main.AddLayer();
            layer2D.Name = "layer2D created in code";
            layer2D.UsePixelCoordinates();

            layer3D = Camera.Main.AddLayer();
            layer3D.Name = "layer3D created in code";

            on3DInstance = new DrawableEntity(this.ContentManagerName, false);
            on3DInstance.AddToManagers(layer3D);
		}
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:93,代码来源:LayerScreen.cs


注:本文中的Layer.UsePixelCoordinates方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。