本文整理汇总了C#中SFML.Graphics.RectangleShape.Round方法的典型用法代码示例。如果您正苦于以下问题:C# RectangleShape.Round方法的具体用法?C# RectangleShape.Round怎么用?C# RectangleShape.Round使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SFML.Graphics.RectangleShape
的用法示例。
在下文中一共展示了RectangleShape.Round方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public override void Draw(RenderTarget rt)
{
RectangleShape barArea = new RectangleShape(Size)
{
Position = Position,
FillColor = Color.Black
};
rt.Draw(barArea);
Text labelText = new Text(label, Assets.LoadFont(Program.DefaultFont))
{
Position = Position + new Vector2f(16.0f, -24.0f),
CharacterSize = 18,
Color = Color.Black
};
labelText.Round();
rt.Draw(labelText);
Text messageText = new Text(Value, Assets.LoadFont(Program.DefaultFont))
{
Position = Position + new Vector2f(8.0f, 8.0f),
CharacterSize = 28,
Color = Color.White
};
messageText.Round();
rt.Draw(messageText);
if (Selected && cursorVisible)
{
RectangleShape cursor = new RectangleShape(new Vector2f(2.0f, Size.Y - 16.0f))
{
Position = Position + new Vector2f(messageText.GetGlobalBounds().Width + 8.0f + 4.0f, 8.0f),
FillColor = Color.White
};
cursor.Round();
rt.Draw(cursor);
}
base.Draw(rt);
}
示例2: Draw
public override void Draw(RenderTarget rt)
{
RectangleShape numberbox = new RectangleShape(Size)
{
Position = Position,
FillColor = Color.Black,
};
rt.Draw(numberbox);
if (mouseIn)
{
RectangleShape checkboxHover = new RectangleShape(new Vector2f(64.0f - 8.0f, 48.0f - 8.0f))
{
Position = Position + new Vector2f(4f, 4f),
FillColor = Color.Black,
OutlineColor = Color.White,
OutlineThickness = 2f
};
rt.Draw(checkboxHover);
}
Text valueText = new Text(stringValue, Assets.LoadFont(Program.DefaultFont))
{
Position = Position + new Vector2f(8.0f, 8.0f),
CharacterSize = 28,
Color = Color.White
};
valueText.Round();
rt.Draw(valueText);
if (Selected && cursorVisible)
{
RectangleShape cursor = new RectangleShape(new Vector2f(2.0f, Size.Y - 16.0f))
{
Position = Position + new Vector2f(valueText.GetWidth() + 8.0f + 2.0f, 8.0f),
FillColor = Color.White
};
cursor.Round();
rt.Draw(cursor);
}
Text labelText = new Text(label, Assets.LoadFont(Program.DefaultFont))
{
Position = Position + new Vector2f(64.0f + 16.0f, 24.0f + 2.0f),
CharacterSize = 32,
Color = Color.Black
};
labelText.Center(false);
labelText.Round();
rt.Draw(labelText);
}
示例3: Draw
public override void Draw(RenderTarget rt)
{
// Outline
rt.Draw(new RectangleShape(new Vector2f(GameOptions.Width - 16, GameOptions.Height - 16))
{
Position = new Vector2f(8, 8),
OutlineColor = Color.Black,
FillColor = Color.White,
OutlineThickness = 8
});
// Draw chat backlog
float y = 0.0f;
for (int i = ChatBacklog.Count - 1; i > ChatBacklog.Count - ChatBacklogItems && i != -1; --i)
{
Text itemText = GameUtility.Wrap(ChatBacklog[i], Assets.LoadFont(Program.DefaultFont), 18,
GameOptions.Width / 3.0f, false);
y -= 20.0f * itemText.DisplayedString.Count(c => c == '\n');
itemText.Position = new Vector2f(16.0f, GameOptions.Height - 226.0f - 24.0f - 24.0f + y + 24.0f);
itemText.Color = new Color(128, 128, 128);
rt.Draw(itemText);
}
Text chatMessageText = new Text(chatValue, Assets.LoadFont(Program.DefaultFont))
{
Position = new Vector2f(8.0f + 6.0f, GameOptions.Height - 220.0f - 24.0f),
Color = Color.Black,
CharacterSize = 22
};
rt.Draw(chatMessageText);
if (cursorVisible)
{
RectangleShape cursor = new RectangleShape(new Vector2f(2.0f, 24.0f))
{
Position = chatMessageText.Position + new Vector2f(chatMessageText.GetWidth() + 2.0f, 2.0f),
FillColor = Color.Black
};
cursor.Round();
rt.Draw(cursor);
}
// White card table
rt.Draw(new RectangleShape(new Vector2f(1264.0f, 202.0f))
{
Position = new Vector2f(8.0f, GameOptions.Height - 194.0f - 16.0f),
FillColor = Color.Black
});
// Timer table
rt.Draw(new RectangleShape(new Vector2f(256.0f, 63.0f))
{
Position = new Vector2f(GameOptions.Width - 256.0f - 8.0f, 8.0f),
FillColor = Color.Black
});
// Table border
rt.Draw(new RectangleShape(new Vector2f(8.0f, 502.0f))
{
Position = new Vector2f(GameOptions.Width - 256.0f - 8.0f, 8.0f),
FillColor = Color.Black
});
// Timer text
string timerValue = String.Format("{0}:{1}", (Client.SecondsLeft / 60).ToString("D"),
(Client.SecondsLeft % 60).ToString("D").PadLeft(2, '0'));
Text text = new Text(timerValue, Assets.LoadFont("QuartzMS.ttf"))
{
Position = new Vector2f(GameOptions.Width - 128.0f - 8.0f, 40.0f),
Color = Color.White,
CharacterSize = 48
};
text.Center();
text.Round();
rt.Draw(text);
// Draw decks
rt.Draw(new Sprite(Assets.LoadTexture("Decks.png"))
{
Position = new Vector2f(GameOptions.Width / 2.0f - 31.0f - 128.0f - 70.0f, GameOptions.Height / 2.0f - 44.0f - 89.0f - 22.0f)
});
base.Draw(rt);
}
示例4: Draw
public override void Draw(RenderTarget rt)
{
// Display connecting message if needed
if (!Client.Connected)
{
RectangleShape bgShape = new RectangleShape(new Vector2f(GameOptions.Width, GameOptions.Height)) { FillColor = Color.Black };
rt.Draw(bgShape);
Text waitingText = new Text("Connecting", Assets.LoadFont(Program.DefaultFont))
{
Position = new Vector2f(GameOptions.Width / 2.0f, GameOptions.Height / 2.0f),
CharacterSize = 48,
Color = Color.White
};
waitingText.Center();
waitingText.Round();
rt.Draw(waitingText);
return;
}
// Draw lobby text
Text lobbyText = new Text("Lobby", Assets.LoadFont(Program.DefaultFont))
{
Position = new Vector2f(GameOptions.Width / 2.0f, 48.0f),
CharacterSize = 48,
Color = Color.Black
};
lobbyText.Center();
lobbyText.Round();
rt.Draw(lobbyText);
// Draw chat area
RectangleShape chatArea = new RectangleShape(
new Vector2f((GameOptions.Width / 3.0f) * 2.0f - 64.0f, (GameOptions.Height / 3.0f) * 2.0f + 64.0f))
{
Position = new Vector2f(GameOptions.Width / 3.0f, GameOptions.Height / 3.0f - 128.0f),
FillColor = new Color(96, 96, 96, 255)
};
rt.Draw(chatArea);
RectangleShape chatBarArea = new RectangleShape(new Vector2f((GameOptions.Width / 3.0f) * 2.0f - 64.0f, 48.0f))
{
Position = new Vector2f(GameOptions.Width / 3.0f, GameOptions.Height - 64.0f - 48.0f),
FillColor = Color.Black
};
rt.Draw(chatBarArea);
Text messageText = new Text(chatValue, Assets.LoadFont(Program.DefaultFont))
{
Position =
new Vector2f(GameOptions.Width / 3.0f + 8.0f, GameOptions.Height - 64.0f - 48.0f + 8.0f + 4.0f),
CharacterSize = 22,
Color = Color.White
};
messageText.Round();
rt.Draw(messageText);
if (cursorVisible)
{
RectangleShape cursor = new RectangleShape(new Vector2f(2.0f, 24.0f))
{
Position = messageText.Position + new Vector2f(messageText.GetWidth() + 2.0f, 2.0f),
FillColor = Color.White
};
cursor.Round();
rt.Draw(cursor);
}
// Draw chat backlog
float y = 0.0f;
for (int i = ChatBacklog.Count - 1; i > ChatBacklog.Count - ChatBacklogItems && i != -1; --i)
{
Text itemText = GameUtility.Wrap(ChatBacklog[i], Assets.LoadFont(Program.DefaultFont), 22,
(GameOptions.Width / 3.0f) * 2.0f - 64.0f - 32.0f - 48.0f, false);
y -= 24.0f * itemText.DisplayedString.Count(c => c == '\n');
itemText.Position = new Vector2f((float)Math.Floor(GameOptions.Width / 3.0f + 8.0f), GameOptions.Height - 144.0f + y + 24.0f);
itemText.Color = Color.White;
rt.Draw(itemText);
}
base.Draw(rt);
}