本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}