本文整理汇总了C#中SFML.Graphics.Text.SetOriginAtCenter方法的典型用法代码示例。如果您正苦于以下问题:C# Text.SetOriginAtCenter方法的具体用法?C# Text.SetOriginAtCenter怎么用?C# Text.SetOriginAtCenter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SFML.Graphics.Text
的用法示例。
在下文中一共展示了Text.SetOriginAtCenter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GameScreen
public GameScreen()
{
_game = new Game();
_view = new View();
// ms / f text
var msFText = new Text
{
Font = new Font("fonts/Quicksand-Bold.ttf"),
DisplayedString = " ms / frame: ",
Color = Color.White,
CharacterSize = 19
};
msFText.SetOriginAtCenter();
msFText.Position = new Vector2f(75, WindowConfig.WindowHeight - 25);
_msFLabel = new Label(msFText);
Widgets.Add(_msFLabel);
}
示例2: MainMenuScreen
public MainMenuScreen()
{
_backgroundSprite = new Sprite(new Texture("sprites/mainmenu.png"));
// enter game button
var enterGameText = new Text
{
Font = new Font("fonts/Quicksand-Bold.ttf"),
DisplayedString = "enter game",
Color = new Color(73, 73, 73)
};
enterGameText.SetOriginAtCenter();
enterGameText.Position = new Vector2f(120, WindowConfig.WindowHeight - 200);
var enterGameButton = new Button(enterGameText)
{
HoverSoundFilename = "sounds/buttonhover.wav",
DefaultTextColor = new Color(73, 73, 73),
TextHighlightColor = new Color(242, 242, 242),
ClickAction = () => { State.CurrentScreen = new GameScreen(); }
};
Widgets.Add(enterGameButton);
// options button
var optionsText = new Text
{
Font = new Font("fonts/Quicksand-Bold.ttf"),
DisplayedString = "options",
Color = new Color(73, 73, 73)
};
optionsText.SetOriginAtCenter();
optionsText.Position = new Vector2f(140, WindowConfig.WindowHeight - 140);
var optionsButton = new Button(optionsText)
{
HoverSoundFilename = "sounds/buttonhover.wav",
DefaultTextColor = new Color(73, 73, 73),
TextHighlightColor = new Color(242, 242, 242)
};
Widgets.Add(optionsButton);
// exit game button
var exitGameText = new Text
{
Font = new Font("fonts/Quicksand-Bold.ttf"),
DisplayedString = "exit game",
Color = new Color(73, 73, 73)
};
exitGameText.SetOriginAtCenter();
exitGameText.Position = new Vector2f(210, WindowConfig.WindowHeight - 80);
var exitGameButton = new Button(exitGameText)
{
HoverSoundFilename = "sounds/buttonhover.wav",
DefaultTextColor = new Color(73, 73, 73),
TextHighlightColor = new Color(242, 242, 242),
ClickAction = () => { State.Open = false; }
};
Widgets.Add(exitGameButton);
}