• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Graphics.Font类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中SFML.Graphics.Font的典型用法代码示例。如果您正苦于以下问题:C# Font类的具体用法?C# Font怎么用?C# Font使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Font类属于SFML.Graphics命名空间,在下文中一共展示了Font类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: StyledTextsDrawer

        /// <summary>
        /// Initializes a new instance of the <see cref="StyledTextsDrawer"/> class.
        /// </summary>
        /// <param name="font">The font.</param>
        /// <exception cref="ArgumentNullException"><paramref name="font" /> is <c>null</c>.</exception>
        public StyledTextsDrawer(Font font)
        {
            if (font == null)
                throw new ArgumentNullException("font");

            _font = font;
        }
开发者ID:Vizzini,项目名称:netgore,代码行数:12,代码来源:StyledTextsDrawer.cs


示例2: ButtonControl

        public ButtonControl(Font font, uint size, Texture button, Texture hover, Texture press)
        {
            left = new RectangleShape();
            middle = new RectangleShape();
            right = new RectangleShape();

            left.Texture = button;
            middle.Texture = button;
            right.Texture = button;

            left.TextureRect = new IntRect(0, 0, (int)button.Size.X / 2 - 1, (int)button.Size.Y);
            middle.TextureRect = new IntRect((int)button.Size.X / 2 - 1, 0, 2, (int)button.Size.Y);
            right.TextureRect = new IntRect((int)button.Size.X / 2 + 1, 0, (int)button.Size.X / 2, (int)button.Size.Y);

            text = new TextControl(font, size) { TextAlignment = Alignment.MiddleCenter, Bold = true };
            text.BackgroundColor = Color.Transparent;

            IsHovered = false;
            IsPressed = false;
            ClickYOffset = 4.0f;

            buttonTexture = button;
            hoverTexture = hover;
            pressedTexture = press;
        }
开发者ID:Scellow,项目名称:sfml-ui,代码行数:25,代码来源:ButtonControl.cs


示例3: PrecacheFont

 public static void PrecacheFont(string what)
 {
     if (fonts.ContainsKey(what)) { return; }
     string thePath = Path.Combine(RootDirectory, what);
     Font theFont = new Font(thePath);
     fonts.Add(what, theFont);
 }
开发者ID:libjared,项目名称:iris,代码行数:7,代码来源:Content.cs


示例4: Debug

 static Debug()
 {
     drawInfos = new List<DebugDrawInfo>();
     font = new Font(System.IO.Path.Combine(
         Environment.GetFolderPath(Environment.SpecialFolder.Fonts),
         "ARIAL.TTF"));
 }
开发者ID:Spanfile,项目名称:LD33,代码行数:7,代码来源:Debug.cs


示例5: MenuState

        private int selected;       //the menu option we have selected

        public MenuState()
        {
            //initializing the menu object we have selected
            //this is honesty unnecessary, but i like to make things explicit
            selected = 0;

            //our font object our text uses
            //(note: use a different font, this one is pulled directly from the SFML.net examples)
            font = new Font("sansation.ttf");

            //the title of our menu
            title = new Text("INVASION GRID", font);
            title.Position = new Vector2f(50.0f, 10.0f);
            title.CharacterSize = 40;

            //setup for our options text
            options = new Text[4];

            options[0] = new Text("Easy Mode", font);
            options[1] = new Text("HARDCORE MODE", font);
            options[2] = new Text("High Scores", font);
            options[3] = new Text("Quit", font);

            for (int i = 0; i < 4; i++)
            {
                options[i].Position = new Vector2f(50.0f, 100.0f * (i + 1));
                options[i].Color = Color.Red;
            }

            //setup for our pointer
            pointer = new Text(">", font);
            pointer.Position = new Vector2f(30.0f, 100.0f);
            pointer.Color = Color.White;
        }
开发者ID:Jespyr,项目名称:Invasion-Grid,代码行数:36,代码来源:MenuState.cs


示例6: Text

 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Construct the text from a string, font and size
 /// </summary>
 /// <param name="str">String to display</param>
 /// <param name="font">Font to use</param>
 /// <param name="characterSize">Base characters size</param>
 ////////////////////////////////////////////////////////////
 public Text(string str, Font font, uint characterSize) :
     base(sfText_create())
 {
     DisplayedString = str;
     Font = font;
     CharacterSize = characterSize;
 }
开发者ID:mateuscezar,项目名称:netgore,代码行数:15,代码来源:Text.cs


示例7: OnEngineInit

        public override void OnEngineInit()
        {
            base.OnEngineInit();

            this.fnt = new Font(Environment.GetFolderPath(Environment.SpecialFolder.Fonts) + Path.DirectorySeparatorChar + "georgia.ttf");
            this.txt = new Text(string.Empty, fnt, 24);
        }
开发者ID:XerShade,项目名称:Xeris.Source,代码行数:7,代码来源:SfmlDebugFontModule.cs


示例8: UiLabel

 public UiLabel(string text, Font font)
 {
     this.font = font;
     foreground = new Color(255, 255, 255);
     backgroundColor = new Color(0, 0, 0, 80);
     CreateDrawables(text);
 }
开发者ID:3c3,项目名称:GRAPHical_learner,代码行数:7,代码来源:UiLabel.cs


示例9: loadContent

        public override void loadContent()
        {
            float logoScale;

            _logoTexture = ResourceManager.getResource<Texture>("logo_1");
            _logoShape = new RectangleShape();
            _logoShape.Texture = _logoTexture;
            _logoShape.Size = new Vector2f(_logoTexture.Size.X, _logoTexture.Size.Y);
            logoScale = Game.window.GetView().Size.X / (float)_logoTexture.Size.X;
            _logoShape.Scale = new Vector2f(logoScale, logoScale);

            _font = ResourceManager.getResource<Font>("immortal_font");
            _options = new List<Text>();
            _options.Add(new Text("New Game", _font, 48));
            _options.Add(new Text("Continue", _font, 48));
            _options.Add(new Text("Options", _font, 48));
            _options.Add(new Text("Exit", _font, 48));

            for (int i = 0; i < _options.Count; i++)
            {
                Text text = _options[i];

                text.Position = new Vector2f(128, i * 48 + _logoShape.Size.Y * _logoShape.Scale.Y + 64);
            }
        }
开发者ID:klutch,项目名称:Loderpit,代码行数:25,代码来源:MainMenuScreen.cs


示例10: DrawSpawn

        public static void DrawSpawn(MapSpawnValues spawn, ISpriteBatch spriteBatch, IDrawableMap map, Font font)
        {
            var spawnArea = spawn.SpawnArea;

            // Only draw if it does not cover the whole map
            if (!spawnArea.X.HasValue && !spawnArea.Y.HasValue && !spawnArea.Width.HasValue && !spawnArea.Height.HasValue)
                return;

            // Draw spawn area
            Vector2 cameraOffset = map.Camera.Min;
            Rectangle rect = spawnArea.ToRectangle(map);
            rect.X -= (int)cameraOffset.X;
            rect.Y -= (int)cameraOffset.Y;
            RenderRectangle.Draw(spriteBatch, rect, new Color(0, 255, 0, 75), new Color(0, 0, 0, 125), 2);

            // Draw name
            CharacterTemplate charTemp = CharacterTemplateManager.Instance[spawn.CharacterTemplateID];
            if (charTemp != null)
            {
                string text = string.Format("{0}x {1} [{2}]", spawn.SpawnAmount, charTemp.TemplateTable.Name, spawn.CharacterTemplateID);

                Vector2 textPos = new Vector2(rect.X, rect.Y);
                textPos -= new Vector2(0, font.MeasureString(text).Y);
                textPos = textPos.Round();

                spriteBatch.DrawStringShaded(font, text, textPos, Color.White, Color.Black);
            }
        }
开发者ID:Furt,项目名称:netgore,代码行数:28,代码来源:EditorEntityDrawer.cs


示例11: Menu

        public Menu()
        {

            selected = 0;

            font = new Font("sansation.ttf");

            title = new Text("INVASION GRID", font);
            title.Position = new Vector2f(50.0f, 10.0f);
            title.CharacterSize = 40;

            options = new Text[4];

            options[0] = new Text("Easy Mode", font);
            options[1] = new Text("HARDCORE MODE", font);
            options[2] = new Text("High Scores", font);
            options[3] = new Text("Quit", font);

            for(int i = 0; i < 4; i++)
            {
                options[i].Position = new Vector2f(50.0f, 100.0f * (i + 1));
                options[i].Color = Color.Red;
            }

            pointer = new Text(">", font);
            pointer.Position = new Vector2f(30.0f, 100.0f);
            pointer.Color = Color.White;

        }
开发者ID:Jespyr,项目名称:Invasion-Grid,代码行数:29,代码来源:Menu.cs


示例12: GlobalState

        /// <summary>
        /// Initializes a new instance of the <see cref="GlobalState"/> class.
        /// </summary>
        GlobalState()
        {
            ThreadAsserts.IsMainThread();

            // Load all sorts of stuff
            _contentManager = NetGore.Content.ContentManager.Create();

            var dbConnSettings = new DbConnectionSettings();
            _dbController =
                dbConnSettings.CreateDbControllerPromptEditWhenInvalid(x => new ServerDbController(x.GetMySqlConnectionString()),
                    x => dbConnSettings.PromptEditFileMessageBox(x));

            _defaultRenderFont = ContentManager.LoadFont("Font/Arial", 16, ContentLevel.Global);

            Character.NameFont = DefaultRenderFont;

            GrhInfo.Load(ContentPaths.Dev, ContentManager);
            AutomaticGrhDataSizeUpdater.Instance.UpdateSizes();

            _mapGrhWalls = new MapGrhWalls(ContentPaths.Dev, x => new WallEntity(x));

            // Load the child classes
            _mapState = new MapState(this);

            // Grab the audio manager instances, which will ensure that they are property initialized
            // before something that can't pass it an ContentManager tries to get an instance
            AudioManager.GetInstance(ContentManager);

            // Set the custom UITypeEditors
            CustomUITypeEditors.AddEditors(DbController);

            // Set up the timer
            _timer = new Timer { Interval = 1000 / 60 };
            _timer.Tick += _timer_Tick;
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:38,代码来源:GlobalState.cs


示例13: Main

        static void Main(string[] args)
        {
            RenderWindow window = new RenderWindow(new VideoMode(800, 600), "Test01");
            window.Closed += (object sender, EventArgs e) => { (sender as Window).Close(); };

            Font font = new Font("SnowflakeLetters.ttf");
            Text text = new Text("BALD IST WEIHNACHTEN!", font);
            Color col1 = new Color(123, 12, 12);
            text.Position = new Vector2f(200, 200);
            CircleShape shape = new CircleShape(20, 8);
            shape.FillColor = Color.White;
            shape.Position = new Vector2f(50, 50);
            float a, c;
            a = c = 50f;

            while (window.IsOpen())
            {
                window.Clear(col1);
                window.Draw(text);
                if (Keyboard.IsKeyPressed(Keyboard.Key.Left) && a > 0)
                    a -= 0.1f;
                if (Keyboard.IsKeyPressed(Keyboard.Key.Right) && a < window.Size.X - shape.Radius * 2)
                    a += 0.1f;
                if (Keyboard.IsKeyPressed(Keyboard.Key.Down) && c < window.Size.Y - shape.Radius * 2)
                    c += 0.1f;
                if (Keyboard.IsKeyPressed(Keyboard.Key.Up) && c >  0)
                    c -= 0.1f;
                window.Draw(shape);
                shape.Position = new Vector2f(a, c);

                window.Display();
                window.DispatchEvents();
            }
        }
开发者ID:HanHangit,项目名称:Visual-Test,代码行数:34,代码来源:Program.cs


示例14: Editor

        public Editor()
        {
            InitializeComponent();

            _instance = this;

            _changeMade = false;

            _curGame = new Game();

            _newGame = new NewGame();

            _IO = new IO();

            _newMap = new NewMap();

            _globalFont = new SFML.Graphics.Font("Georgia.ttf");

            _block = new Texture("block.png");

            _projectDirectory = new ProjectDirectory();

            _mapViewFormList = new List<MapViewerForm>();

            _actorManager = new ActorManagerForm();

            _gameRunner = new GameRunner(_curGame);

            _viewSwitch = new ViewSwitch();

            _viewVariable = new ViewVariable();

            DisableTool();
        }
开发者ID:ComposerCookie,项目名称:JRPDragon,代码行数:34,代码来源:Editor.cs


示例15: SelectLevelView

        public SelectLevelView(MainMenuView menu)
        {
            scene = new Scene(ScrollInputs.None);
            Font text = new Font("Content/font.ttf");
            (backButton = new FastButton(text, 22, "Content/button.png", "Content/button_hover.png", "Content/button_pressed.png")
            {
                Position = new Vector2f(500, 600),
                Size = new Vector2f(280, 49),
                Text = "Back to Menu",
                Anchor = AnchorPoints.Left | AnchorPoints.Top
            }).OnClick += BackToMenu;

            string[] files = Directory.GetFiles("Content/Levels/", "*.json");
            for (int i = 0; i < files.Length; i++)
            {
                string file = files[i];
                string name = JsonConvert.DeserializeObject<GameScene>(File.ReadAllText(file)).Name;
                FastButton level = new FastButton(text, 22, "Content/button.png", "Content/button_hover.png", "Content/button_pressed.png")
                {
                    Position = new Vector2f(300, 50 + i * 50),
                    Size = new Vector2f(680, 49),
                    Text = "Play " + name,
                    Anchor = AnchorPoints.Left | AnchorPoints.Top
                };
                level.OnClick += (s, e) =>
                {
                    Next(this, new InGameView(file, this));
                };

                scene.AddComponent(level);
            }

            scene.AddComponent(backButton);
            this.menu = menu;
        }
开发者ID:WebFreak001,项目名称:LD-30,代码行数:35,代码来源:SelectLevelView.cs


示例16: BigLabeledButtonComponent

        public BigLabeledButtonComponent(Screen screen, Texture buttonTexture, Vector2f position, string text, Color buttonColor, Action onClick)
            : base(screen)
        {
            _buttonTexture = buttonTexture;
            _position = position;
            _buttonColor = buttonColor;
            _selectedColor = new Color(
                (byte)Math.Min(255, (int)_buttonColor.R + 50),
                (byte)Math.Min(255, (int)_buttonColor.G + 50),
                (byte)Math.Min(255, (int)_buttonColor.B + 50),
                255);
            _onClick = onClick;
            _font = ResourceManager.getResource<Font>("immortal_font");

            // Initialize button shape
            _buttonShape = new RectangleShape();
            _buttonShape.Texture = _buttonTexture;
            _buttonShape.Position = position;
            _buttonShape.Size = new Vector2f(_buttonShape.Texture.Size.X, _buttonShape.Texture.Size.Y);
            _buttonShape.FillColor = _buttonColor;

            // Initialize text
            _firstLetter = new Text(text.Substring(0, 1), _font, 72);
            _firstLetter.Position = position + new Vector2f(30, 0);
            _firstLetter.Color = Color.White;
            _firstLetterShadow = new Text(_firstLetter.DisplayedString, _font, 72);
            _firstLetterShadow.Position = _firstLetter.Position + new Vector2f(3, 3);
            _firstLetterShadow.Color = Color.Black;
            _word = new Text(text.Substring(1, text.Length - 1), _font, 48);
            _word.Position = _firstLetter.Position + new Vector2f(_firstLetter.GetLocalBounds().Width + 4, 13);
            _word.Color = Color.White;
            _wordShadow = new Text(_word.DisplayedString, _font, 48);
            _wordShadow.Position = _word.Position + new Vector2f(3, 3);
            _wordShadow.Color = Color.Black;
        }
开发者ID:klutch,项目名称:Loderpit,代码行数:35,代码来源:BigLabeledButtonComponent.cs


示例17: IsAssetValid

        protected static bool IsAssetValid(Font asset)
        {
            if (asset == null || asset.IsDisposed)
                return false;

            return true;
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:7,代码来源:SpriteBatch.cs


示例18: ScoreBoardState

        //class specific vars go here
        public ScoreBoardState()
        {
            font = new Font("sansation.ttf");

            title = new Text("Scoreboard", font);
            title.Position = new Vector2f(50.0f, 10.0f);
            title.CharacterSize = 40;
        }
开发者ID:Jespyr,项目名称:Invasion-Grid,代码行数:9,代码来源:ScoreBoardState.cs


示例19: CharacterStatusComponent

 public CharacterStatusComponent(Screen screen, Font font, int entityId, Vector2f offset)
     : base(screen)
 {
     _font = font;
     _entityId = entityId;
     _text = new Text("", font, 14);
     _offset = offset;
 }
开发者ID:klutch,项目名称:Loderpit,代码行数:8,代码来源:CharacterStatusComponent.cs


示例20: Chat

 public Chat(Client client)
 {
     writing = false;
     myFont = new Font("content/arial.ttf");
     toWrite = "";
     msgList = new List<KeyValuePair<DateTime, string>>();
     this.client = client;
 }
开发者ID:CyrilPaulus,项目名称:2dThing,代码行数:8,代码来源:Chat.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Graphics.RectangleShape类代码示例发布时间:2022-05-26
下一篇:
C# Service.OrmliteConnection类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap