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

C# Graphics.Text类代码示例

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

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



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

示例1: Draw

        public void Draw()
        {
            Text t = new Text();
            t.Font = Program.Data.Font;
            t.CharacterSize = 14;

            SFML.Graphics.Sprite s = new SFML.Graphics.Sprite(Program.Data.SpriteBasedOnType(SpriteType.Button)[ID]);
            s.Position = new Vector2f(X, Y);
            _screen.Draw(s);

            ConstructionGUI g = (ConstructionGUI)Program.SM.States[1].GameGUI[9];
            if (Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnableLocation[g.LocY][g.LocX] > -1)
            {
                SpawnBuildable b = (SpawnBuildable)Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnable[Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnableLocation[g.LocY][g.LocX]];
                if (SlotID + 3 * g.CurPage < b.Required.Count)//SlotID + 3 * g.CurPage < Program.Data.MySpawnable[Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnable[Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnableLocation[g.LocY][g.LocX]].ID].)
                {
                    s = new SFML.Graphics.Sprite(Program.Data.SpriteBasedOnType(SpriteType.Items)[Program.Data.MyItems[b.Required.ElementAt(SlotID + 3 * g.CurPage).Key.ID].Sprite]);
                    s.Position = new Vector2f(X, Y);
                    _screen.Draw(s);

                    t.DisplayedString = Program.Data.MyItems[b.Required.ElementAt(SlotID + 3 * g.CurPage).Key.ID].Name + ": " + (Program.Data.GetBuildableList()[b.ID].RequiredItems.ElementAt(SlotID + 3 * g.CurPage).Value - b.Required.ElementAt(SlotID + 3 * g.CurPage).Value.Count - b.Built.ElementAt(SlotID + 3 * g.CurPage).Value.Count) + "/" + b.Required.ElementAt(SlotID + 3 * g.CurPage).Value.Count + "/" + b.Built.ElementAt(SlotID + 3 * g.CurPage).Value.Count;
                    t.Position = new Vector2f(X + 38, Y + 8);
                    _screen.Draw(t);

                    if (State == 1)
                    {
                        b.Required.ElementAt(SlotID + 3 * g.CurPage).Key.DrawSprite(_screen, Mouse.GetPosition(_screen).X - (int)Program.Data.SpriteBasedOnType(SpriteType.Items)[Program.Data.MyItems[b.Required.ElementAt(SlotID + 3 * g.CurPage).Key.ID].Sprite].Size.X / 2, Mouse.GetPosition(_screen).Y - (int)Program.Data.SpriteBasedOnType(SpriteType.Items)[Program.Data.MyItems[b.Required.ElementAt(SlotID + 3 * g.CurPage).Key.ID].Sprite].Size.Y / 2);
                    }
                }
            }
        }
开发者ID:ComposerCookie,项目名称:WanderingSoul,代码行数:31,代码来源:ConstructionGUIItemButton.cs


示例2: MapRenderer

        public MapRenderer(IntPtr mapRenderWindowHandle, IntPtr tileSetRenderHandle, MapEditor.MapEditorProperties mapEditorProperties)
        {
            _mapRenderWindow = new RenderWindow(mapRenderWindowHandle);
            _tileSetRenderWindow = new RenderWindow(tileSetRenderHandle);
            _mapRenderWindow.MouseButtonPressed += mapRenderWindow_MouseButtonPressed;
            _mapRenderWindow.MouseMoved += mapRenderWindow_MouseMoved;
            _tileSetRenderWindow.MouseButtonPressed += tileSetRenderWindow_MouseButtonPressed;
            _tileSetRenderWindow.MouseMoved += tileSetRenderWindow_MouseMoved;
            _tileSetRenderWindow.MouseButtonReleased += tileSetRenderWindow_MouseButtonReleased;

            _mapEditorProperties = mapEditorProperties;
            _mapEditorProperties.CurrentLayer = World.Map.Layers.Ground;
            _mapEditorProperties.MapView = new View(this._mapRenderWindow.DefaultView);

            _mousePositionText = new Text("", new Font(AppDomain.CurrentDomain.BaseDirectory + "/Data/Graphics/Fonts/MainFont.ttf"), 20);

            this.LoadTileSets();

            _tileSetView = this._tileSetRenderWindow.DefaultView;

            this.Running = true;

            this._mapRenderWindow.SetActive(false);
            this._tileSetRenderWindow.SetActive(false);

            new Thread(UpdateLoop).Start();
        }
开发者ID:JohnLamontagne,项目名称:CEngineSharp,代码行数:27,代码来源:MapRenderer.cs


示例3: Main

        static void Main(string[] args)
        {
            // initialize window and view
            win = new RenderWindow(new VideoMode(1000, 700), "Hadoken!!!");
            view = new View();
            resetView();
            gui = new GUI(win, view);

            // exit Program, when window is being closed
            //win.Closed += new EventHandler(closeWindow);
            win.Closed += (sender, e) => { (sender as Window).Close(); };

            // initialize GameState
            handleNewGameState();

            // initialize GameTime
            GameTime gameTime = new GameTime();
            gameTime.Start();

            // debug Text
            Text debugText = new Text("debug Text", new Font("Fonts/calibri.ttf"));

            while (running && win.IsOpen())
            {
                KeyboardInputManager.update();

                currentGameState = state.update();

                // gather draw-stuff
                win.Clear(new Color(100, 149, 237));    //cornflowerblue ftw!!! 1337
                state.draw(win, view);
                state.drawGUI(gui);

                // first the state must be drawn, before I can change the currentState
                if (currentGameState != prevGameState)
                {
                    handleNewGameState();
                }

                // do the actual drawing
                win.SetView(view);
                win.Display();

                // check for window-events. e.g. window closed        
                win.DispatchEvents();

                // update GameTime
                gameTime.Update();
                float deltaTime = (float)gameTime.EllapsedTime.TotalSeconds;

                // idleLoop for fixed FrameRate
                float deltaPlusIdleTime = deltaTime;
                while (deltaPlusIdleTime < (1F / fixedFps))
                {
                    gameTime.Update();
                    deltaPlusIdleTime += (float)gameTime.EllapsedTime.TotalSeconds;
                }
                Console.WriteLine("real fps: " + (int)(1F / deltaPlusIdleTime) + ", theo fps: " + (int)(1F / deltaTime));
            }
        }
开发者ID:Greaka,项目名称:RuneShift,代码行数:60,代码来源:Program.cs


示例4: Draw

        public void Draw()
        {
            Text t = new Text();
            t.Font = Program.Data.Font;
            t.CharacterSize = 14;

            SFML.Graphics.Sprite s = new SFML.Graphics.Sprite(Program.Data.SpriteBasedOnType(SpriteType.Button)[ID]);
            s.Position = new Vector2f(X, Y);
            _screen.Draw(s);

            BuildGUI g = (BuildGUI)Program.State[1].GameGUI[8];
            if (g.CurPick + 3 * g.PickPage < Logic.KnownBluePrintForThisCharacter(Program.Data.MyPlayerData[Program.CurrentSaveData].MainParty.MyParty[0], g.CurClass).Count)
            {
                if (SlotID + 3 * g.CurPage < Program.Data.GetBuildableList()[Logic.KnownBluePrintForThisCharacter(Program.Data.MyPlayerData[Program.CurrentSaveData].MainParty.MyParty[0], g.CurClass)[g.CurPick + 3 * g.PickPage]].RequiredItems.Count)
                {
                    s = new SFML.Graphics.Sprite(Program.Data.SpriteBasedOnType(SpriteType.Items)[Program.Data.GetBuildableList()[Logic.KnownBluePrintForThisCharacter(Program.Data.MyPlayerData[Program.CurrentSaveData].MainParty.MyParty[0], g.CurClass)[g.CurPick + 3 * g.PickPage]].RequiredItems.ElementAt(SlotID + 3 * g.CurPage).Key.ID]);
                    s.Position = new Vector2f(X, Y);
                    _screen.Draw(s);

                    t.DisplayedString = Program.Data.MyItems[Program.Data.GetBuildableList()[Logic.KnownBluePrintForThisCharacter(Program.Data.MyPlayerData[Program.CurrentSaveData].MainParty.MyParty[0], g.CurClass)[g.CurPick + 3 * g.PickPage]].RequiredItems.ElementAt(SlotID + 3 * g.CurPage).Key.ID].Name + ": " + Program.Data.GetBuildableList()[Logic.KnownBluePrintForThisCharacter(Program.Data.MyPlayerData[Program.CurrentSaveData].MainParty.MyParty[0], g.CurClass)[g.CurPick + 3 * g.PickPage]].RequiredItems.ElementAt(SlotID + 3 * g.CurPage).Value;
                    t.Position = new Vector2f(X + 40, Y + 7);
                    _screen.Draw(t);
                }
            }
        }
开发者ID:ComposerCookie,项目名称:WanderingSoul,代码行数:25,代码来源:BuildGUISquareItemButton.cs


示例5: 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


示例6: Counter

        public Counter()
        {
            Text = new Text("", Game.Assets.Fonts["DejaVuSans"]);
            Text.Color = TextColor;

            Position = Game.Target.GetView().Size * 0.5f;
        }
开发者ID:Wezthal,项目名称:GameProject,代码行数:7,代码来源:Counter.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: Draw

        public void Draw(RenderTarget rt)
        {
            DateTime now = DateTime.Now;

            Text message = new Text("", myFont);
            message.CharacterSize = 14;

            int removeCount = 0;
            foreach(KeyValuePair<DateTime, String> pair in msgList){
             	message.DisplayedString += pair.Value + "\n";
                if((now - pair.Key).TotalSeconds > messageLifeTime)
                    removeCount++;
            }

            msgList.RemoveRange(0, removeCount);
            message.Position = new Vector2f(14, rt.Height - 54 - message.GetRect().Height);
            rt.Draw(message);

            if(writing){
                Text display = new Text("say : " + toWrite + "_", myFont);
                display.CharacterSize = 14;
                display.Position = new Vector2f(14, rt.Height - 36 - display.GetRect().Height);
                rt.Draw(display);
            }
        }
开发者ID:CyrilPaulus,项目名称:2dThing,代码行数:25,代码来源:Chat.cs


示例9: 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


示例10: Draw

 public override void Draw(RenderTarget r)
 {
     var text = ((int)(1000/EntityManager.FrameTime)).ToString () + " FPS";
     DebugText = new Text(text, DebugText.Font)
     {Position = r.GetView ().Center - r.GetView ().Size/2, Color = DebugText.Color};
     r.Draw (DebugText);
 }
开发者ID:Phyxius,项目名称:SomeZombieGame,代码行数:7,代码来源:DebugInfo.cs


示例11: Draw

        public override void Draw(RenderTarget rt)
        {
            RectangleShape bgOverlay = new RectangleShape(new Vector2f(GameOptions.Width, GameOptions.Height)) { FillColor = Color.Black };
            rt.Draw(bgOverlay);

            Text title = new Text("Game Over", Assets.LoadFont(Program.DefaultFont))
            {
                Position = new Vector2f(GameOptions.Width / 2.0f, 48.0f),
                CharacterSize = 48,
                Color = Color.White
            };

            title.Center();
            title.Round();
            rt.Draw(title);

            Text winnerTitle = new Text(GetWinnerText(), Assets.LoadFont(Program.DefaultFont))
            {
                Position = new Vector2f(GameOptions.Width / 2.0f, GameOptions.Height / 2.0f),
                CharacterSize = 48,
                Color = Color.White
            };

            winnerTitle.Center();
            winnerTitle.Round();
            rt.Draw(winnerTitle);

            base.Draw(rt);
        }
开发者ID:DatZach,项目名称:HumanityAgainstCards,代码行数:29,代码来源:GameOverScreen.cs


示例12: Draw

        public override void Draw(RenderTarget rt)
        {
            RectangleShape overylay = new RectangleShape(new Vector2f(GameOptions.Width, GameOptions.Height))
            {
                FillColor = new Color(0, 0, 0, 128)
            };

            rt.Draw(overylay);

            RectangleShape window = new RectangleShape(new Vector2f(GameOptions.Width * (1.0f - PaddingHorizontal * 2.0f), GameOptions.Height * (1.0f - PaddingVertical * 2.0f)))
            {
                Position = new Vector2f(GameOptions.Width * PaddingHorizontal, GameOptions.Height * PaddingVertical),
                FillColor = Color.White,
                OutlineColor = Color.Black,
                OutlineThickness = 2.0f
            };

            rt.Draw(window);

            Text labelSettings = new Text("Join by IP", Assets.LoadFont(Program.DefaultFont))
            {
                Position = new Vector2f(GameOptions.Width / 2.0f, GameOptions.Height * PaddingVertical + 48.0f),
                Color = Color.Black,
                CharacterSize = 32
            };

            labelSettings.Center();
            labelSettings.Round();
            rt.Draw(labelSettings);

            base.Draw(rt);
        }
开发者ID:DatZach,项目名称:HumanityAgainstCards,代码行数:32,代码来源:JoinByIpOverlay.cs


示例13: HeadsUpDisplay

        public HeadsUpDisplay(Game Game)
            : base(Game, null)
        {
            // Score
            Score = new Text("00000000", Game.TidyHand, 50);
            Score.Color = new Color(255, 255, 255, 180);
            Score.Position = new Vector2f(Game.Size.X - 270, 2);
            AddChild(Score);

            ScoreMultiplier = new Text("x001", Game.TidyHand, 35);
            ScoreMultiplier.Color = new Color(200, 200, 200, 180);
            ScoreMultiplier.Position = new Vector2f(Game.Size.X - 100, 50);
            AddChild(ScoreMultiplier);

            // Powerups
            Layer_Powerups = new Layer();
            AddChild(Layer_Powerups);

            // FPS
            if (DisplayFPS)
            {
                FPS = new Text("00.0", Game.TidyHand, 30);
                FPS.Position = new Vector2f(Game.Size.X - 70, Game.Size.Y - 40);
                AddChild(FPS);

                FPSUpdateTimer = new Timer(500); // Update every 0.5 seconds
                FPSUpdateTimer.Elapsed += FPSUpdate;
                FPSUpdateTimer.Start();
            }
        }
开发者ID:Torrunt,项目名称:SingleSwitchGame,代码行数:30,代码来源:HeadsUpDisplay.cs


示例14: Init

 public override void Init()
 {
     label = new Text(Text, Font);
     label.Scale = new SFML.Window.Vector2f(Scale, Scale);
     UpdateScale();
     base.Init();
 }
开发者ID:pjhaugh,项目名称:ftl-overdrive,代码行数:7,代码来源:Label.cs


示例15: PauseState

        public PauseState(StateStack stack, Context context)
            : base(stack, context)
        {
            RenderWindow window = mContext.window;

            mBackgroundSprite = new Sprite();
            mPausedText = new Text();
            mInstructionText = new Text();

            mPausedText.Font = mContext.fonts.get(FontID.Main);
            mPausedText.DisplayedString = "Game Paused";
            mPausedText.CharacterSize = 70;
            mPausedText.centerOrigin();
            mPausedText.Position = new Vector2f(0, 0);

            mInstructionText.Font = mContext.fonts.get(FontID.Main);
            mInstructionText.DisplayedString = "(Press Backspace to return to main menu)";
            mInstructionText.centerOrigin();
            mInstructionText.Position = new Vector2f(0, 0);

            backgroundShape = new RectangleShape();
            backgroundShape.FillColor = new Color(0, 0, 0, 150);
            backgroundShape.Position = window.GetView().Center;
            backgroundShape.centerOrigin();
            backgroundShape.Size = window.GetView().Size;
        }
开发者ID:pixeltasim,项目名称:SFML.NET_Gamedev,代码行数:26,代码来源:PauseState.cs


示例16: Draw

        public void Draw()
        {
            SFML.Graphics.Sprite s = new SFML.Graphics.Sprite(Program.Data.SpriteBasedOnType(SpriteType.Button)[ID]);
            s.Position = new Vector2f(X, Y);
            _screen.Draw(s);

            Text t = new Text();
            t.Font = Program.Data.Font;
            t.CharacterSize = 14;

            CraftGUI g = (CraftGUI)Program.SM.States[1].GameGUI[10];
            Items i = Program.Data.MyItems[Logic.KnownRecipeForThisCharacter(Logic.CurrentParty.MainParty.MyParty[0], g.CurClass).Count];
            {
                if (SlotID + 3 * g.CurPage < i.ItemRequired.Count)
                {
                    s = new SFML.Graphics.Sprite(Program.Data.SpriteBasedOnType(SpriteType.Items)[Program.Data.MyItems[i.ItemRequired.ElementAt(SlotID + 3 * g.CurPage).Key].Sprite]);
                    s.Position = new Vector2f(X, Y);
                    _screen.Draw(s);

                    t.DisplayedString = Program.Data.MyItems[i.ItemRequired.ElementAt(SlotID + 3 * g.CurPage).Key].Name + ": " + i.ItemRequired.ElementAt(SlotID + 3 * g.CurPage).Value;
                    t.Position = new Vector2f(X + 38, Y + 8);
                    _screen.Draw(t);
                }
            }
        }
开发者ID:ComposerCookie,项目名称:WanderingSoul,代码行数:25,代码来源:CraftGUISquareItemButton.cs


示例17: GameStateStart

        public GameStateStart()
        {
            Game.Instance.AudioManager.PauseAllBackground();
            Game.Instance.AudioManager.PlaySound("game/background_music", true);

            if (Game.Instance.AllPlayers.Count != 1)
            {
                _gameMode = new MultiplayerGame(_allCells);
            }
            else
            {
                _gameMode = new SingleplayerGame(_allCells);
            }

            _gameMode.PrepareGame();

            _background = new Sprite(ResourceManager.Instance["menu/background"] as Texture);

            _playerInfoText = new Text(
                Game.Instance.Player.Name,
                ResourceManager.Instance["fonts/bebas_neue"] as Font,
                25) {
                       Position = new Vector2f(5, 5), Color = Game.Instance.Player.Color
                    };

            // register events
            Game.Instance.Window.MouseButtonPressed += MouseButtonPressed;
            Game.Instance.Window.MouseButtonReleased += MouseButtonReleased;
            Game.Instance.Window.KeyReleased += KeyReleased;
        }
开发者ID:Yozer,项目名称:NanoWar,代码行数:30,代码来源:GameStateStart.cs


示例18: HighscoreList

 public HighscoreList(Vector2f position)
 {
     Text = new Text();
     Text.Font = Game.Assets.Fonts["PixelPlay"];
     Text.CharacterSize = 30;
     Text.Position = position;
 }
开发者ID:Wezthal,项目名称:GameProject,代码行数:7,代码来源:HighscoreList.cs


示例19: Initialize

        static void Initialize()
        {
            Environment.SetEnvironmentVariable("PATH", Environment.GetEnvironmentVariable("PATH") + ";" + Environment.CurrentDirectory + "\\libs");
            dtClock = new Stopwatch();
            textFps = new Text("0", new Font(new FileStream("assets\\fonts\\arial.ttf", FileMode.Open, FileAccess.Read)));
            window = new RenderWindow(new VideoMode(1280, 768), "Test", Styles.Default);
            window.SetFramerateLimit(60);
            window.SetTitle("NATE");
            tiles = new TileManager("assets\\tilemaps\\rpgtiles.png", 32);
            iMap = new MapInterface();
            //map = new Map(new Vector2i(32, 32), ((int)tiles.image.Size.X / tiles.tileSize) * ((int)tiles.image.Size.Y / tiles.tileSize), true); -- for random
            //map = new Map(new Vector2i(32, 32), ((int)tiles.image.Size.X / tiles.tileSize) * ((int)tiles.image.Size.Y / tiles.tileSize), false); -- blank
            map = iMap.ReadMap("map1.ntm");
            
            scaling = new Vector2f(2, 2);
            textureCollection = new Texture[(tiles.image.Size.X / tiles.tileSize) * (tiles.image.Size.Y / tiles.tileSize)];
            camera = new Camera();
            camera.speed = 1000;

            window.Closed += (s, a) => window.Close();
            window.KeyPressed += (s, a) => { if (a.Code == Keyboard.Key.Z) { iMap.WriteMap("map0.ntm", map); } };
            window.MouseWheelMoved += (s, a) => { scaling.X += a.Delta * 0.075f; scaling.Y += a.Delta * 0.075f; };

            dtClock.Start();

            for (int i = 0; i < (tiles.image.Size.X / tiles.tileSize) * (tiles.image.Size.Y / tiles.tileSize); i++)
            {
                textureCollection[i] = tiles.GetTile(i);
                textureCollection[i].Smooth = false;
            }
        }
开发者ID:leontodd,项目名称:NATE,代码行数:31,代码来源:Program.cs


示例20: MeasureString

        public Vector2f MeasureString(TextString str)
        {
            Vector2f size = new Vector2f(0f,0f);
            Vector2f curLineSize = new Vector2f(0f, 0f);

            foreach (KeyValuePair<TextStyle, string> s in str.FormatedText)
            {
                if (s.Key == TextStyle.EndLine)
                {
                    size.Y += curLineSize.Y;
                    size.X = curLineSize.X > size.X ? curLineSize.X : size.X;
                    curLineSize = new Vector2f(0f, 0f);
                }
                else
                {
                    Text textSlope = new Text(s.Value, Font, str.CharacterSize);
                    Text.Styles textStyle = Text.Styles.Regular;
                    if ((s.Key & TextStyle.Bold) != 0)
                        textStyle |= Text.Styles.Bold;
                    if( (s.Key & TextStyle.Italic) != 0)
                        textStyle |= Text.Styles.Italic;
                    textSlope.Style = textStyle;
                    FloatRect localBounds = textSlope.GetLocalBounds();

                    Vector2f ssize = new Vector2f(localBounds.Width,localBounds.Height);
                    curLineSize.X += (int)ssize.X;
                    curLineSize.Y = (int)ssize.Y > curLineSize.Y ? (int)ssize.Y : curLineSize.Y;
                }
            }

            size.X = curLineSize.X > size.X ? curLineSize.X : size.X;
            size.Y += curLineSize.Y;
            return size;
        }
开发者ID:Ziple,项目名称:NOubliezPas,代码行数:34,代码来源:Font.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Graphics.Texture类代码示例发布时间:2022-05-26
下一篇:
C# Graphics.Sprite类代码示例发布时间: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