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


C# Renderer.SetPalette方法代码示例

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


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

示例1: DrawCursor

        public void DrawCursor(Renderer renderer, string cursorName, int2 lastMousePos, int cursorFrame)
        {
            var cursorSequence = GetCursorSequence(cursorName);
            var cursorSprite = cursorSequence.GetSprite(cursorFrame);

            renderer.SetPalette(palette);
            renderer.SpriteRenderer.DrawSprite(cursorSprite,
                                               lastMousePos - cursorSequence.Hotspot - (0.5f * cursorSprite.size).ToInt2(),
                                               palettes[cursorSequence.Palette],
                                               cursorSprite.size);
        }
开发者ID:RunCraze,项目名称:OpenRA,代码行数:11,代码来源:CursorProvider.cs

示例2: DrawCursor

        public static void DrawCursor(Renderer renderer, string cursorName, int2 lastMousePos, int cursorFrame)
        {
            var cursorSequence = GetCursorSequence(cursorName);
            var cursorSprite = cursorSequence.GetSprite(cursorFrame);

            renderer.SetPalette(Palette);
            renderer.SpriteRenderer.DrawSprite(cursorSprite,
                                               lastMousePos - cursorSequence.Hotspot,
                                               Palette.GetPaletteIndex(cursorSequence.Palette),
                                               cursorSprite.size);
        }
开发者ID:Tsher,项目名称:OpenRA,代码行数:11,代码来源:CursorProvider.cs

示例3: DrawCursor

        public void DrawCursor(Renderer renderer, string cursorName, int2 lastMousePos, int cursorFrame)
        {
            var cursorSequence = GetCursorSequence(cursorName);
            var cursorSprite = cursorSequence.GetSprite(cursorFrame);
            var cursorSize = CursorViewportZoomed ? 2.0f * cursorSprite.size : cursorSprite.size;

            var cursorOffset = CursorViewportZoomed ?
                (2 * cursorSequence.Hotspot) + cursorSprite.size.ToInt2() :
                cursorSequence.Hotspot + (0.5f * cursorSprite.size).ToInt2();

            renderer.SetPalette(palette);
            renderer.SpriteRenderer.DrawSprite(cursorSprite,
                lastMousePos - cursorOffset,
                palettes[cursorSequence.Palette],
                cursorSize);
        }
开发者ID:RobotCaleb,项目名称:OpenRA,代码行数:16,代码来源:CursorProvider.cs

示例4: Render

        public void Render(Renderer renderer)
        {
            if (cursorName == null)
                return;

            var cursorSequence = cursorProvider.GetCursorSequence(cursorName);
            var cursorSprite = sprites[cursorName][((int)cursorFrame % cursorSequence.Length)];
            var cursorSize = CursorProvider.CursorViewportZoomed ? 2.0f * cursorSprite.Size : cursorSprite.Size;

            var cursorOffset = CursorProvider.CursorViewportZoomed ?
                (2 * cursorSequence.Hotspot) + cursorSprite.Size.ToInt2() :
                cursorSequence.Hotspot + (0.5f * cursorSprite.Size).ToInt2();

            renderer.SetPalette(palette);
            renderer.SpriteRenderer.DrawSprite(cursorSprite,
                Viewport.LastMousePos - cursorOffset,
                paletteReferences[cursorSequence.Palette],
                cursorSize);
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:19,代码来源:SoftwareCursor.cs

示例5: Init

        public override void Init(ModData modData, Dictionary<string, string> info)
        {
            // Avoid standard loading mechanisms so we
            // can display the loadscreen as early as possible
            r = Game.Renderer;
            if (r == null)
                return;

            if (info.ContainsKey("Text"))
                messages = info["Text"].Split(',');

            if (info.ContainsKey("Palette"))
            {
                using (var stream = modData.DefaultFileSystem.Open(info["Palette"]))
                {
                    palette = new ImmutablePalette(stream, new int[] { });
                }

                hardwarePalette = new HardwarePalette();
                hardwarePalette.AddPalette("loadscreen", palette, false);
                hardwarePalette.Initialize();
                r.SetPalette(hardwarePalette);
            }

            if (info.ContainsKey("Image"))
            {
                using (var stream = modData.DefaultFileSystem.Open(info["Image"]))
                {
                    CpsD2Loader loader = new CpsD2Loader();
                    if (!loader.TryParseSprite(stream, out frames))
                        return;
                }

                if (frames.Length == 0)
                    return;

                sheetBuilder = new SheetBuilder(SheetType.Indexed, 512);
                logo = sheetBuilder.Add(frames[0]);

                logoPos = new float2((r.Resolution.Width - logo.Size.X) / 2, (r.Resolution.Height - logo.Size.Y) / 2);
            }
        }
开发者ID:Comanche93,项目名称:d2,代码行数:42,代码来源:D2LoadScreen.cs


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