本文整理汇总了C#中Renderer.SetScissorRectangle方法的典型用法代码示例。如果您正苦于以下问题:C# Renderer.SetScissorRectangle方法的具体用法?C# Renderer.SetScissorRectangle怎么用?C# Renderer.SetScissorRectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Renderer
的用法示例。
在下文中一共展示了Renderer.SetScissorRectangle方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public override void Draw(Renderer renderer)
{
if (background != null) background.Draw(renderer);
if (fadeSize.Y != Main.WindowHeight)
renderer.SetScissorRectangle((int)(Main.WindowWidth - fadeSize.X) / 2, (int)(Main.WindowHeight - fadeSize.Y) / 2,
(int)fadeSize.X, (int)fadeSize.Y, false);
RenderHelper.SmartDrawRectangle(bg, 5, 0, 0, Main.WindowWidth, Main.WindowHeight, Color.White, renderer);
foreach (Elements.Control c in controls)
{
c.Draw(renderer);
}
if (fadeSize.X != Main.WindowWidth)
{
renderer.ResetScissorRectangle();
renderer.SetScissorRectangle((int)(Main.WindowWidth - fadeSize.X) / 2, (int)(Main.WindowHeight - fadeSize.Y) / 2,
(int)fadeSize.X, (int)fadeSize.Y, false);
}
if (saves.ItemsCount() == 0)
{
var a = overlayFont.MeasureString("No save files found");
renderer.DrawString(overlayFont, "No save files found",
new Rectangle(0, (int)(saves.Position.Y + (saves.Size.Y - a.Y) / 2), Main.WindowWidth, (int)a.Y),
Color.Gray, Renderer.TextAlignment.Center);
}
if (fadeSize.X != Main.WindowWidth)
renderer.ResetScissorRectangle();
}
示例2: Draw
public override void Draw(Renderer renderer)
{
//tabs[selectedTab].isMouseOver = true;
if (background != null) background.Draw(renderer);
if (fadeSize.Y != Main.WindowHeight)
renderer.SetScissorRectangle((int)(Main.WindowWidth - fadeSize.X) / 2, (int)(Main.WindowHeight - fadeSize.Y) / 2,
(int)fadeSize.X, (int)fadeSize.Y, false);
renderer.Draw(bgtexture, new Rectangle(0, 0, Main.WindowWidth, Main.WindowHeight), Color.White);
foreach (Control c in controls)
{
c.Draw(renderer);
}
for (int x = 0; x < levels.GetLength(0); x++)
{
for (int y = 0; y < levels.GetLength(1); y++)
{
if (levels[x, y].isVisible)
{
renderer.Draw(wires[y * levels.GetLength(0) + x], new Rectangle(0, 0, Main.WindowWidth, Main.WindowHeight),
!levels[x, y].isEnabled ? wireDisabled :
levels[x, y].isPressed ? wireSelected :
levels[x,y].isMouseOver ? wireMouseOver :
Logics.CampaingProgress.IsComplete(TABS_NAMES[CurTab], y * levels.GetLength(0) + x) ? wireCompleted :
wireIdle);
}
//levels[x, y] = new ImageButton(16 + x * 96 + d, 54 + y * 90, 80, 80, (y * levels.GetLength(0) + x).ToString());
}
}
if (fadeSize.X != Main.WindowWidth)
renderer.ResetScissorRectangle();
}
示例3: Draw
public override void Draw(Renderer renderer)
{
base.Draw(renderer);
renderer.SetScissorRectangle(GUIEngine.s_mainMenu.line3p1.X, GUIEngine.s_mainMenu.line3p1.Y, Main.WindowWidth, Main.WindowHeight, false);
renderer.End();
renderer.BeginUnscaled(SpriteSortMode.Immediate, BlendState.AlphaBlend, null,
null, Graphics.GraphicsEngine.s_ScissorsOn, null, Matrix.CreateTranslation(MainMenu.FrameOffset, 0, 0));
Vector2 corner = Position + Size;
renderer.Draw(GraphicsEngine.pixel,
new Rectangle((int)(corner.X - 333), (int)(corner.Y - 1),
333, 1), Color.White);
renderer.Draw(GraphicsEngine.pixel,
new Rectangle((int)(corner.X - 1), (int)(corner.Y - (ShortUpperLine ? 29 : 96)),
1, (int)((ShortUpperLine ? 29 : 96) - (ButtonsCount == FrameButtonsCount.Zero ? 0 : 23))), Color.White);
if (ButtonsCount != FrameButtonsCount.Zero)
{
renderer.Draw(GraphicsEngine.pixel,
new Rectangle((int)(corner.X - 120), (int)(corner.Y - 23),
1, 23), Color.White);
int linew = ButtonsCount == FrameButtonsCount.One ? 120 : 240;
renderer.Draw(GraphicsEngine.pixel,
new Rectangle((int)(corner.X - linew), (int)(corner.Y - 24),
linew, 1), Color.White);
}
}
示例4: Draw
//TODO animation
public override void Draw(Renderer renderer)
{
renderer.Draw(GraphicsEngine.pixel,
new Rectangle(0, 0, Main.WindowWidth, Main.WindowHeight),
Shortcuts.BG_COLOR * fadeopacity);
bool b = OffsetX != 0;
if (b)
{
renderer.SetScissorRectangle(position.X, position.Y, size.X, size.Y, false);
renderer.End();
renderer.BeginUnscaled(SpriteSortMode.Immediate, BlendState.AlphaBlend, null,
null, Graphics.GraphicsEngine.s_ScissorsOn, null, Matrix.CreateTranslation(OffsetX, 0, 0));
}
RenderHelper.SmartDrawRectangle(bg, 5,
(int)position.X - 2, (int)position.Y - 2, (int)size.X + 4, (int)size.Y - 30 + 4,
Color.White, renderer);
base.Draw(renderer);
renderer.Draw(title, position + new Vector2(64, 64), Color.White);
renderer.Draw(GraphicsEngine.pixel,
new Rectangle((int)(position.X + size.X / 4), (int)(position.Y + size.Y - 30), 1, 30),
Color.White);
renderer.Draw(GraphicsEngine.pixel,
new Rectangle((int)(position.X + size.X / 2), (int)(position.Y + size.Y - 30), 1, 30),
Color.White);
renderer.Draw(GraphicsEngine.pixel,
new Rectangle((int)(position.X + 3 * size.X / 4), (int)(position.Y + size.Y - 30), 1, 30),
Color.White);
if (b)
renderer.ResetScissorRectangle();
}
示例5: Draw
public override void Draw(Renderer renderer)
{
#region fadeUpdate
if (isclosing)
{
if (OffsetX > -size.X)
OffsetX -= 15;
if (OffsetX <= -size.X)
{
OffsetX = -(int)size.X;
Close();
}
}
else
{
if (OffsetX < 0)
OffsetX += 15;
}
if (OffsetX > 0)
OffsetX = 0;
fadeopacity = (float)(OffsetX + size.X) / size.X / 2f;
#endregion
lock (compToDraw)
{
renderer.Draw(GraphicsEngine.pixel, new Rectangle(0, 0, Main.WindowWidth, Main.WindowHeight), Shortcuts.BG_COLOR * fadeopacity);
bool b = OffsetX != 0;
if (b)
{
renderer.SetScissorRectangle(pos.X, pos.Y, size.X, size.Y, false);
renderer.End();
renderer.BeginUnscaled(SpriteSortMode.Immediate, BlendState.AlphaBlend, null,
null, Graphics.GraphicsEngine.s_ScissorsOn, null, Matrix.CreateTranslation(OffsetX, 0, 0));
}
RenderHelper.SmartDrawRectangle(GraphicsEngine.bg, 5,
(int)pos.X - 2, (int)pos.Y - 2, (int)size.X + 4, (int)size.Y - 30 + 4,
Color.White, renderer);
int x = 5;
int y = 30;
for (int i = 0; i < compToDraw.Count; i++)
{
compToDraw[i].DrawAt((int)pos.X + x, (int)pos.Y + y, renderer);
x += 50;
if (x + 50 >= size.X)
{
x = 0;
y += 50;
}
}
base.Draw(renderer);
if (b)
renderer.ResetScissorRectangle();
}
}
示例6: Draw
public override void Draw(Renderer renderer)
{
if (background != null) background.Draw(renderer);
if (fadeSize.Y != Main.WindowHeight)
renderer.SetScissorRectangle((int)(Main.WindowWidth - fadeSize.X) / 2, (int)(Main.WindowHeight - fadeSize.Y) / 2,
(int)fadeSize.X, (int)fadeSize.Y, false);
RenderHelper.SmartDrawRectangle(bg, 5, 0, 0, Main.WindowWidth, Main.WindowHeight, Color.White, renderer);
foreach (Elements.Control c in controls)
{
c.Draw(renderer);
}
if (fadeSize.X != Main.WindowWidth)
renderer.ResetScissorRectangle();
}
示例7: Draw
public override void Draw(Renderer renderer)
{
renderer.End();
renderer.BeginUnscaled(SpriteSortMode.Immediate, null, SamplerState.PointWrap, null, null, null,
Matrix.CreateTranslation(Scene.MainMenu.FrameOffset, 0, 0));
scrollbar.Draw(renderer);
renderer.End();
renderer.SetScissorRectangle(position.X, position.Y + 96, size.X, size.Y - 96, false);
renderer.BeginUnscaled(SpriteSortMode.Immediate, null, null, null, Graphics.GraphicsEngine.s_ScissorsOn, null,
Matrix.CreateTranslation(Scene.MainMenu.FrameOffset, 0, 0));
for (int i = 0; i < elements.Count; i++)
{
elements[i].Draw(renderer);
}
renderer.End();
renderer.ResetScissorRectangle();
renderer.SetScissorRectangle(GUIEngine.s_mainMenu.line3p1.X, GUIEngine.s_mainMenu.line3p1.Y, Main.WindowWidth, Main.WindowHeight, false);
renderer.BeginUnscaled(SpriteSortMode.Immediate, null, null, null, Graphics.GraphicsEngine.s_ScissorsOn, null,
Matrix.CreateTranslation(Scene.MainMenu.FrameOffset, 0, 0));
}
示例8: Draw
public override void Draw(Renderer renderer)
{
if (article != null)
article.Draw(renderer);
renderer.Draw(folder, Position + new Vector2(26, 26), Color.White);
renderer.Draw(GraphicsEngine.pixel, new Rectangle((int)Position.X - 9, (int)Position.Y + 96, (int)Size.X + 9, 2), Color.White);//top bar
renderer.Draw(GraphicsEngine.pixel, new Rectangle((int)(Position.X + Size.X) - 1, (int)Position.Y + 96, 1, 6), Color.White);//small thing near right sb
renderer.Draw(GraphicsEngine.pixel, new Rectangle((int)Position.X + 278, (int)Position.Y + 96, 2, 6), Color.White);//small thing near left sb
renderer.Draw(GraphicsEngine.pixel, new Rectangle((int)Position.X + 150, (int)Position.Y + (int)Size.Y - 2, 130, 2), Color.White);
renderer.Draw(GraphicsEngine.pixel, new Rectangle((int)Position.X + 278, (int)Position.Y + (int)Size.Y - 7, 2, 6), Color.White);
base.Draw(renderer);
renderer.SetScissorRectangle(Position.X, Position.Y + 98, Size.X, Size.Y - 100, false);
renderer.End();
renderer.BeginUnscaled(SpriteSortMode.Immediate, BlendState.AlphaBlend, null,
null, Graphics.GraphicsEngine.s_ScissorsOn, null,
Matrix.CreateTranslation(MainMenu.FrameOffset + FileListOffset.X, FileListOffset.Y, 0));
for (int i = 0; i < buttons.Count; i++)
{
buttons[i].Draw(renderer);
}
renderer.End();
renderer.ResetScissorRectangle();
renderer.BeginUnscaled(SpriteSortMode.Immediate, BlendState.AlphaBlend, null,
null, RasterizerState.CullNone, null,
Matrix.CreateTranslation(MainMenu.FrameOffset, 0, 0));
}
示例9: Draw
public override void Draw(Renderer renderer)
{
base.Draw(renderer);
int dotOutIndex = -1;
bool hasAvalableComponents = false;
for (int i = 0; i < Tiles.Count; i++)
{
if (Tiles[i] is CSFolder && (Tiles[i] as CSFolder).IsOpened)
{
dotOutIndex = i;
break;
}
if (Tiles[i] is CSComponentCopy && (Tiles[i] as CSComponentCopy).Avalable != 0)
hasAvalableComponents = true;
}
//overlay
if (!hasAvalableComponents)
{
renderer.Draw(GraphicsEngine.pixel, new Rectangle((int)position.X, (int)position.Y, SIZE_X, SIZE_Y), Shortcuts.BG_COLOR * 0.5f);
renderer.Draw(GraphicsEngine.pixel, new Rectangle((int)position.X, (int)position.Y, SIZE_X, SIZE_Y), Color.Black * 0.4f);
}
//opened folder
if (IsOpened || animationState > 0)
{
if (animationState < SIZE_X)
{
renderer.SetScissorRectangle(position.X + SIZE_X, 0, SIZE_X, Main.WindowHeight, false);
renderer.End();
renderer.BeginUnscaled(SpriteSortMode.Immediate, BlendState.AlphaBlend, null,
null, Graphics.GraphicsEngine.s_ScissorsOn, null, Matrix.CreateTranslation(animationState - SIZE_X, 0, 0));
}
//bg
RenderHelper.SmartDrawRectangle(ComponentSelector.bg, 8, 42 + (int)position.X, 0, 48, Main.WindowHeight,
Color.White, renderer);
if (dotOutIndex != -1)
{
renderer.End();
renderer.BeginUnscaled(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.None,
RasterizerState.CullNone);
renderer.Draw(ComponentSelector.dotOverlay,
new Rectangle(44 + (int)position.X, 2, 44, Main.WindowHeight - 4),
new Rectangle(44 + (int)position.X, 2, 44, Main.WindowHeight - 4),
Color.White);
}
//items
for (int i = 0; i < Tiles.Count; i++)
{
Tiles[i].Draw(renderer);
if (dotOutIndex != -1 && dotOutIndex != i)
{
renderer.Draw(ComponentSelector.dotOverlay,
new Rectangle((int)Tiles[i].position.X, (int)Tiles[i].position.Y, CSTile.SIZE_X, CSTile.SIZE_Y),
new Rectangle((int)Tiles[i].position.X, (int)Tiles[i].position.Y, CSTile.SIZE_X, CSTile.SIZE_Y),
Color.White);
}
}
if (animationState < SIZE_X)
{
renderer.ResetScissorRectangle();
}
}
}
示例10: Draw
public override void Draw(Renderer renderer)
{
if (background != null && (Main.CurState.StartsWith("GUI") ||
(currentState.items.Count > 0 && currentState.items[0] != inGameItems[0] && currentState.items[0] != inGameItems[4].Children[0] &&
currentState.caption != "HANDBOOK")))
{
gameBGOpacity = 0;
background.Draw(renderer);
var atr = GUIEngine.font.MeasureString(currentTip);
renderer.DrawString(GUIEngine.font, ">> " + currentTip + " <<", new Rectangle(0, (int)(Main.WindowHeight - atr.Y), Main.WindowWidth, (int)atr.Y),
new Color(180, 255, 180), Renderer.TextAlignment.Center);
}
else
{
if (gameBGOpacity < 0.5f)
gameBGOpacity += 0.02f;
renderer.Draw(MicroWorld.Graphics.GraphicsEngine.pixel, new Rectangle(0, 0, Main.WindowWidth, Main.WindowHeight),
new Color(45, 57, 107) * gameBGOpacity);
}
renderer.Draw(GraphicsEngine.pixel, new Rectangle(0, 0, 0, 0), Color.White);
renderer.DrawLinesList(new VertexPositionColorTexture[]{
new VertexPositionColorTexture(new Vector3(line1p1.X, line1p1.Y,0), Color.White, new Vector2()),
new VertexPositionColorTexture(new Vector3(line1p2.X, line1p2.Y, 0), Color.White, new Vector2()),
new VertexPositionColorTexture(new Vector3(line2p1.X, line2p1.Y,0), Color.White, new Vector2()),
new VertexPositionColorTexture(new Vector3(line2p2.X, line2p2.Y, 0), Color.White, new Vector2()),
new VertexPositionColorTexture(new Vector3(line3p1.X, line3p1.Y,0), Color.White, new Vector2()),
new VertexPositionColorTexture(new Vector3(line3p2.X, line3p2.Y, 0), Color.White, new Vector2()),
new VertexPositionColorTexture(new Vector3(line4p1.X, line4p1.Y,0), Color.White, new Vector2()),
new VertexPositionColorTexture(new Vector3(line4p2.X, line4p2.Y, 0), Color.White, new Vector2())
});
renderer.SetScissorRectangle(line2p1.X+1, line1p1.Y, Main.WindowWidth, Main.WindowHeight, false);
lock (controls)
{
foreach (Elements.Control c in controls)
{
c.Draw(renderer);
}
}
renderer.DrawString(fontCurrent, currentState.caption, new Vector2(CaptionPosition.X + 10, CaptionPosition.Y + 10), Color.White,
Renderer.TextAlignment.Left);
if (currentFrame != null && currentFrame.isVisible)
{
renderer.SetScissorRectangle(line3p1.X, line3p1.Y, Main.WindowWidth, Main.WindowHeight, false);
renderer.End();
renderer.BeginUnscaled(SpriteSortMode.Immediate, BlendState.AlphaBlend, null,
null, Graphics.GraphicsEngine.s_ScissorsOn, null, Matrix.CreateTranslation(FrameOffset, 0, 0));
currentFrame.Draw(renderer);
}
renderer.ResetScissorRectangle();
}
示例11: Draw
public override void Draw(Renderer renderer)
{
if (!isVisible) return;
Vector2 posold = position;
if (ShouldOffset)
Position = Position + Settings.GameOffset * Settings.GameScale;
//bg
if (BGAsColor)
renderer.Draw(GraphicsEngine.pixel, new Rectangle((int)position.X, (int)position.Y, (int)Size.X, (int)Size.Y), BackgroundColor);
else
RenderHelper.SmartDrawRectangle(Texture, 5, (int)position.X, (int)position.Y, (int)Size.X, (int)Size.Y, BackgroundColor,
renderer);
#region ScissorsInit
float x = position.X < 0 ? 0 : position.X;
float y = position.Y < 0 ? 0 : position.Y;
float w = size.X < 0 ? 0 : size.X;
float h = size.Y < 0 ? 0 : size.Y;
if (x > Main.WindowWidth)
x = Main.WindowWidth;
if (y > Main.WindowHeight)
y = Main.WindowHeight;
if (x + w > Main.WindowWidth)
w = Main.WindowWidth - x;
if (y + h > Main.WindowHeight)
h = Main.WindowHeight - y;
#endregion
renderer.SetScissorRectangle(x, y, w, h, false);
//selection
if (SelectionStart != -1 && SelectionLength != 0)
{
int min = Math.Min(SelectionStart + SelectionLength, selectionStart);
int max = min + Math.Abs(SelectionLength);
var sc = getCoordForCursor(min);
int sci = (int)((sc.Y + TextOffset.Y) / SizePerOneSymbol.Y);
int scj = (int)((sc.X + TextOffset.X) / SizePerOneSymbol.X);
if (scj < 0) scj = 0;
var sc2 = getCoordForCursor(max);
int sc2i = (int)((sc2.Y + TextOffset.Y) / SizePerOneSymbol.Y);
int sc2j = (int)((sc2.X + TextOffset.X) / SizePerOneSymbol.X);
if (sc2j < 0) sc2j = 0;
if (sci == sc2i)//same line
{
renderer.Draw(GraphicsEngine.pixel, new Rectangle((int)(position.X + sc.X), (int)(position.Y + sc.Y),
(int)(sc2.X - sc.X), (int)charSize.Y), SelectionColor);
}
else//multiline
{
renderer.Draw(GraphicsEngine.pixel, new Rectangle((int)(position.X + sc.X), (int)(position.Y + sc.Y),
(int)(Font.MeasureString(DrawTextLines[sci].Substring(scj)).X - sc.X), (int)charSize.Y), SelectionColor);
float c = sc.Y + SizePerOneSymbol.Y;
for (int i = sci + 1; i < sc2i; i++)
{
renderer.Draw(GraphicsEngine.pixel, new Rectangle((int)(position.X), (int)(position.Y + c),
(int)(Font.MeasureString(DrawTextLines[i]).X), (int)charSize.Y), SelectionColor);
c += SizePerOneSymbol.Y;
}
renderer.Draw(GraphicsEngine.pixel, new Rectangle((int)(position.X), (int)(position.Y + sc2.Y),
(int)(sc2.X), (int)charSize.Y), SelectionColor);
}
}
//text
renderer.DrawString(font, DrawText, position - TextOffset, ForegroundColor,
Renderer.TextAlignment.Left);
//cursor
if (Editable && isFocused && Main.Ticks % 60 < 30)
renderer.Draw(GraphicsEngine.pixel, new Rectangle((int)(position.X + cursorPos.X), (int)(position.Y + cursorPos.Y),
1, (int)charSize.Y), CursorColor);
renderer.ResetScissorRectangle();
base.Draw(renderer);
if (ShouldOffset)
position = posold;
}