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


C# TextureLoader类代码示例

本文整理汇总了C#中TextureLoader的典型用法代码示例。如果您正苦于以下问题:C# TextureLoader类的具体用法?C# TextureLoader怎么用?C# TextureLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Draw

        public void Draw( CanvasDrawingSession ds, CanvasSpriteBatch SBatch, TextureLoader Textures )
        {
            lock ( PFSim )
            {
                var Snapshot = PFSim.Snapshot();
                while ( Snapshot.MoveNext() )
                {
                    Particle P = Snapshot.Current;

                    float A = Vector2.Transform( new Vector2( 0, 1 ), Matrix3x2.CreateRotation( P.ttl * 0.01f ) ).X;

                    Vector4 Tint = new Vector4(
                        P.Tint.M11 + P.Tint.M21 + P.Tint.M31 + P.Tint.M41 + P.Tint.M51,
                        P.Tint.M12 + P.Tint.M22 + P.Tint.M32 + P.Tint.M42 + P.Tint.M52,
                        P.Tint.M13 + P.Tint.M23 + P.Tint.M33 + P.Tint.M43 + P.Tint.M53,
                        P.Tint.M14 + P.Tint.M24 + P.Tint.M34 + P.Tint.M44 + P.Tint.M54
                    );

                    Tint.W *= A;
                    ScrollWind.Strength *= 0.5f;

                    SBatch.Draw(
                        Textures[ P.TextureId ]
                        , P.Pos, Tint
                        , Textures.Center[ P.TextureId ], 0, P.Scale
                        , CanvasSpriteFlip.None );
                }

                DrawWireFrames( ds );
            }
        }
开发者ID:tgckpg,项目名称:wenku10,代码行数:31,代码来源:Glitter.cs

示例2: SvgSquaresMode

        /// <summary>
        /// Initializes a new instance of the <see cref="RectangleMode"/> class.
        /// </summary>
        public SvgSquaresMode()
        {
            // Create a list of gem images.
            SceneNodeLinkedList<float> nodes = new SceneNodeLinkedList<float>();
            RootSceneNode = nodes;

            // Load the image into memory.
            svgLoader = new SvgLoader(new FileInfo("Images/1cm.svg"));
            float screenScale = Platform.Instance.Window.Resolution.Height / 16f;
            svgLoader.Scale = screenScale * SvgImageLoader.Meter100px;
            TextureLoader textureLoader = new TextureLoader(svgLoader);

            // Create squares across the board.
            rows = (int) (440 / screenScale);
            columns = (int) (600 / (2 * screenScale));

            for (int i = 0; i < columns; i++)
            {
                for (int j = 0; j < rows; j++)
                {
                    ImageNode<float> image = new ImageNode<float>(textureLoader);
                    image.Point = new Point2<float>((j % 2) * screenScale + i * 2 * screenScale, j * screenScale);

                    if (i % 4 == 0)
                        image.Tint = new Color<float>(1, 1, 0, 0);

                    if (j % 4 == 0)
                        image.Tint = new Color<float>(1, 0, 1, 0);

                    nodes.Add(image);
                }
            }
        }
开发者ID:dmoonfire,项目名称:boogame-cil,代码行数:36,代码来源:SvgSquaresMode.cs

示例3: Factory

            public Factory(Data d, GameObject gObj,
			float zOff = 0, float zR = 1, int rQOff = 0, Camera cam = null,
			string texturePrfx = "", string fontPrfx = "",
			TextureLoader textureLdr = null,
			TextureUnloader textureUnldr = null)
                : base(gObj, zOff, zR, rQOff,
			cam, texturePrfx, fontPrfx, textureLdr, textureUnldr)
            {
                data = d;
                mesh = new Mesh();

                meshFilter = gameObject.AddComponent<MeshFilter>();
                meshFilter.sharedMesh = mesh;

                meshRenderer = gameObject.AddComponent<UnityEngine.MeshRenderer>();
                meshRenderer.castShadows = false;
                meshRenderer.receiveShadows = false;

                textureName = texturePrefix + data.textures[0].filename;
                meshRenderer.sharedMaterial =
                ResourceCache.SharedInstance().LoadTexture(
                data.name, textureName, data.textures[0].format,
                    textureLoader, textureUnloader);
                if (renderQueueOffset != 0)
                meshRenderer.sharedMaterial.renderQueue += renderQueueOffset;

                premultipliedAlpha = (data.textures[0].format ==
                (int)Format.Constant.TEXTUREFORMAT_PREMULTIPLIEDALPHA);

                buffer = new CombinedMeshBuffer();

                CreateBitmapContexts(data);
                CreateTextContexts(data);
            }
开发者ID:99corps,项目名称:lwf,代码行数:34,代码来源:lwf_combinedmesh_factory.cs

示例4: Draw

        public void Draw( CanvasDrawingSession ds, CanvasSpriteBatch SBatch, TextureLoader Textures )
        {
            lock ( PFSim )
            {
                var Snapshot = PFSim.Snapshot();
                while ( Snapshot.MoveNext() )
                {
                    Particle P = Snapshot.Current;

                    float A = ( P.Trait & PFTrait.IMMORTAL ) == 0 ? P.ttl * 0.033f : 1;

                    P.Tint.M12 = 4 * ( 1 - A );
                    P.Tint.M21 = 3 * A;

                    Vector4 Tint = new Vector4(
                        P.Tint.M11 + P.Tint.M21 + P.Tint.M31 + P.Tint.M41 + P.Tint.M51,
                        P.Tint.M12 + P.Tint.M22 + P.Tint.M32 + P.Tint.M42 + P.Tint.M52,
                        P.Tint.M13 + P.Tint.M23 + P.Tint.M33 + P.Tint.M43 + P.Tint.M53,
                        P.Tint.M14 + P.Tint.M24 + P.Tint.M34 + P.Tint.M44 + P.Tint.M54
                    ) * 2;

                    Tint.W *= A * 0.125f;

                    SBatch.Draw( Textures[ P.TextureId ], P.Pos, Tint, Textures.Center[ P.TextureId ], 0, P.Scale * A, CanvasSpriteFlip.None );
                }

                DrawWireFrames( ds );
            }
        }
开发者ID:tgckpg,项目名称:wenku10,代码行数:29,代码来源:Fireworks.cs

示例5: OnLoadImageKey

        /// <summary>
        /// Called when the load image key event is called.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The <see cref="MfGames.Scene2.Images.LoadImageKeyEventArgs"/> instance containing the event data.</param>
        private void OnLoadImageKey(object sender, LoadImageKeyEventArgs args)
        {
            BitmapLoader systemLoader = new BitmapLoader(new FileInfo("Images/" + args.Path + ".png"));
            TextureLoader textureLoader = new TextureLoader(systemLoader);

            args.ImageKeyLoader = textureLoader;
        }
开发者ID:dmoonfire,项目名称:boogame-cil,代码行数:12,代码来源:GemsMode.cs

示例6: Atlas

		public Atlas (String path, TextureLoader textureLoader) {
			using (StreamReader reader = new StreamReader(path)) {
				try {
					Load(reader, Path.GetDirectoryName(path), textureLoader);
				} catch (Exception ex) {
					throw new Exception("Error reading atlas file: " + path, ex);
				}
			}
		}
开发者ID:nicksergeev,项目名称:spine-runtimes,代码行数:9,代码来源:Atlas.cs

示例7: Factory

            public Factory(Data data, GameObject gObj,
			float zOff = 0, float zR = 1, int rQOff = 0, Camera cam = null,
			string texturePrfx = "", string fontPrfx = "",
			TextureLoader textureLdr = null,
			TextureUnloader textureUnldr = null)
                : base(gObj, zOff, zR, rQOff,
			cam, texturePrfx, fontPrfx, textureLdr, textureUnldr)
            {
                CreateBitmapContexts(data);
            }
开发者ID:explodingbarrel,项目名称:lwf,代码行数:10,代码来源:lwf_drawmesh_factory.cs

示例8: ReadFile

		private async Task ReadFile(string path, TextureLoader textureLoader) {
			var folder = Windows.ApplicationModel.Package.Current.InstalledLocation;
			var file = await folder.GetFileAsync(path).AsTask().ConfigureAwait(false);
			using (var reader = new StreamReader(await file.OpenStreamForReadAsync().ConfigureAwait(false))) {
				try {
					Load(reader, Path.GetDirectoryName(path), textureLoader);
				} catch (Exception ex) {
					throw new Exception("Error reading atlas file: " + path, ex);
				}
			}
		}
开发者ID:dev-celvin,项目名称:DK,代码行数:11,代码来源:Atlas.cs

示例9: Factory

            public Factory(Data d, GameObject gObj,
			float zOff = 0, float zR = 1, int rQOff = 0,
			string sLayerName = null, int sOrder = 0, bool uAC = false,
			Camera renderCam = null, Camera inputCam = null,
			string texturePrfx = "", string fontPrfx = "",
			TextureLoader textureLdr = null,
			TextureUnloader textureUnldr = null)
                : base(d, gObj, zOff, zR, rQOff, sLayerName, sOrder, uAC, renderCam,
			inputCam, texturePrfx, fontPrfx, textureLdr, textureUnldr)
            {
                CreateBitmapContexts();
                CreateTextContexts();
            }
开发者ID:rayyee,项目名称:lwf,代码行数:13,代码来源:lwf_drawmesh_factory.cs

示例10: RegisterTexture

		public Texture RegisterTexture(ref Texture texture, ref TextureLoader<Texture> textureLoader) {
			if(_textureList.Contains(texture)) {
				throw new Exception(string.Format("Texture {0} already registered.", texture));
			}
			if(_textureCatalog.ContainsKey(texture.Name)) {
				throw new Exception(string.Format("A Texture with the Name {0} already exists in this catalog. Cannot insert {1}.", texture.Name, texture));
			}
			_textureList.Add(texture);
			_textureCatalog.Add(
				texture.Name, 
			    new CatalogEntry<Texture, TextureLoader<Texture>>(texture, textureLoader)
			);
			return texture;
		}
开发者ID:jwmarsden,项目名称:Kinetic3,代码行数:14,代码来源:Catalog.cs

示例11: CanvasStage

        public CanvasStage( CanvasAnimatedControl Stage )
        {
            _stage = Stage;

            Scenes = new List<IScene>();

            Textures = new TextureLoader();
            Stage.CreateResources += Stage_CreateResources;

            Stage.GameLoopStarting += Stage_GameLoopStarting;
            Stage.GameLoopStopped += Stage_GameLoopStopped;

            Stage.SizeChanged += Stage_SizeChanged;
            Stage.Unloaded += Stage_Unloaded;
        }
开发者ID:tgckpg,项目名称:wenku10,代码行数:15,代码来源:CanvasStage.cs

示例12: Atlas

		public Atlas (String path, TextureLoader textureLoader) {

#if WINDOWS_PHONE
            Stream stream = Microsoft.Xna.Framework.TitleContainer.OpenStream(path);
            using (StreamReader reader = new StreamReader(stream))
            {
#else
            using (StreamReader reader = new StreamReader(path)) {
#endif
				try {
					Load(reader, Path.GetDirectoryName(path), textureLoader);
				} catch (Exception ex) {
					throw new Exception("Error reading atlas file: " + path, ex);
				}
			}
		}
开发者ID:dev-celvin,项目名称:DK,代码行数:16,代码来源:Atlas.cs

示例13: Factory

            protected Factory(GameObject gObj,
		float zOff, float zR, int rQOff, Camera cam,
		string texturePrfx = "", string fontPrfx = "",
		TextureLoader textureLdr = null,
		TextureUnloader textureUnldr = null)
            {
                gameObject = gObj;
                zOffset = zOff;
                zRate = zR;
                renderQueueOffset = rQOff;
                camera = cam;
                texturePrefix = texturePrfx;
                fontPrefix = fontPrfx;
                textureLoader = textureLdr;
                textureUnloader = textureUnldr;
                matrix = Matrix4x4.identity;
            }
开发者ID:neojjang,项目名称:lwf,代码行数:17,代码来源:lwf_unity_factory.cs

示例14: GemsMode

        /// <summary>
        /// Initializes a new instance of the <see cref="RectangleMode"/> class.
        /// </summary>
        public GemsMode()
        {
            // Create a list of gem images.
            SceneNodeLinkedList<float> nodes = new SceneNodeLinkedList<float>();
            RootSceneNode = nodes;

            // Create the blue gem.
            BitmapLoader systemLoader = new BitmapLoader(new FileInfo("Images/Gem Blue.png"));
            TextureLoader textureLoader = new TextureLoader(systemLoader);
            ImageNode<float> image = new ImageNode<float>(textureLoader);
            image.Point = new Point2<float>(10, 10);
            image.DrawableRenderAnimators.Add(
                new DisappearingFlickerDrawableAnimation<float>());
            image.DrawableRenderAnimators.Add(
                new UnsteadyFlickerDrawableAnimation<float>()
                {
                    OpacityScale = 0.2,
                    TimeScale = 1,
                });
            Updating += image.OnUpdate;
            nodes.Add(image);

            // Create the green gem.
            systemLoader = new BitmapLoader(new FileInfo("Images/Gem Green.png"));
            textureLoader = new TextureLoader(systemLoader);
            image = new ImageNode<float>(textureLoader);
            image.Point = new Point2<float>(60, 90);
            nodes.Add(image);

            // Create the translucent orange.
            systemLoader = new BitmapLoader(new FileInfo("Images/Gem Orange.png"));
            textureLoader = new TextureLoader(systemLoader);
            image = new ImageNode<float>(textureLoader);
            image.Tint = new Color<float>(0.5f, 1f, 1f, 1f);
            image.Point = new Point2<float>(110, 10);
            nodes.Add(image);

            // Create an animated image.
            AnimatedImageNodeController<float> animatedController = new AnimatedImageNodeController<float>();
            animatedController.NeedImageKey += OnLoadImageKey;
            animatedController.Load(new FileInfo("Images/Gem Animation.xml"));
            AnimatedImageNode<float> animatedImage = new AnimatedImageNode<float>(animatedController);
            animatedImage.Point = new Point2<float>(10, 200);
            Updating += animatedImage.OnUpdate;
            nodes.Add(animatedImage);
        }
开发者ID:dmoonfire,项目名称:boogame-cil,代码行数:49,代码来源:GemsMode.cs

示例15: Factory

            protected Factory(GameObject gObj,
		float zOff, float zR, int rQOff, Camera cam,
		string texturePrfx = "", string fontPrfx = "",
		TextureLoader textureLdr = null,
		TextureUnloader textureUnldr = null)
            {
                gameObject = gObj;
                zOffset = zOff;
                zRate = zR;
                renderQueueOffset = rQOff;
                camera = cam;
                texturePrefix = texturePrfx;
                fontPrefix = fontPrfx;
                textureLoader = textureLdr;
                textureUnloader = textureUnldr;
                matrix = Matrix4x4.identity;
                blendMode = (int)Format.Constant.BLEND_MODE_NORMAL;
                maskMode = (int)Format.Constant.BLEND_MODE_NORMAL;
            }
开发者ID:explodingbarrel,项目名称:lwf,代码行数:19,代码来源:lwf_unity_factory.cs


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