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


C# Text.SetOriginAtCenter方法代码示例

本文整理汇总了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);
        }
开发者ID:Tetramputechture,项目名称:Ending_0.1b,代码行数:21,代码来源:GameScreen.cs

示例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);
        }
开发者ID:Tetramputechture,项目名称:Ending_0.1b,代码行数:64,代码来源:MainMenuScreen.cs


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