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


C# Text.SetPosition方法代码示例

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


在下文中一共展示了Text.SetPosition方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetupInstructions

		void SetupInstructions()
		{
			var instructions = new Text()
			{
				Value = "Use WASD keys and mouse/touch to move",
				HorizontalAlignment = HorizontalAlignment.Center,
				VerticalAlignment = VerticalAlignment.Center
			};
			var font = ResourceCache.GetFont("Fonts/Anonymous Pro.ttf");
			instructions.SetFont(font, 15);
			UI.Root.AddChild(instructions);

			// Animating text
			Text text = new Text();
			text.Name = "animatingText";
			text.SetFont(font, 15);
			text.HorizontalAlignment = HorizontalAlignment.Center;
			text.VerticalAlignment = VerticalAlignment.Center;
			text.SetPosition(0, UI.Root.Height/4 + 20);
			UI.Root.AddChild(text);
		}
开发者ID:cianmulville,项目名称:urho-samples,代码行数:21,代码来源:LightAnimation.cs

示例2: CreateSlider

		Slider CreateSlider(int x, int y, int xSize, int ySize, string text)
		{
			UIElement root = UI.Root;
			ResourceCache cache = ResourceCache;
			Font font = cache.GetFont("Fonts/Anonymous Pro.ttf");
			// Create text and slider below it
			Text sliderText = new Text();
			root.AddChild(sliderText);
			sliderText.SetPosition(x, y);
			sliderText.SetFont(font, 12);
			sliderText.Value = text;

			Slider slider = new Slider();
			root.AddChild(slider);
			slider.SetStyleAuto(null);
			slider.SetPosition(x, y + 20);
			slider.SetSize(xSize, ySize);
			// Use 0-1 range for controlling sound/music master volume
			slider.Range = 1.0f;

			return slider;
		}
开发者ID:jiailiuyan,项目名称:urho-samples,代码行数:22,代码来源:SoundEffects.cs

示例3: CreateUI

		void CreateUI()
		{
			var cache = ResourceCache;

			// Create a Cursor UI element because we want to be able to hide and show it at will. When hidden, the mouse cursor will
			// control the camera, and when visible, it will point the raycast target
			XmlFile style = cache.GetXmlFile("UI/DefaultStyle.xml");
			Cursor cursor = new Cursor();
			cursor.SetStyleAuto(style);
			UI.Cursor = cursor;

			// Set starting position of the cursor at the rendering window center
			var graphics = Graphics;
			cursor.SetPosition(graphics.Width / 2, graphics.Height / 2);

			// Construct new Text object, set string to display and font to use
			var instructionText = new Text();

			instructionText.Value =
				"Use WASD keys to move, RMB to rotate view\n" +
				"LMB to set destination, SHIFT+LMB to spawn a Jack\n" +
				"CTRL+LMB to teleport main agent\n" +
				"MMB to add obstacles or remove obstacles/agents\n" +
				"F5 to save scene, F7 to load\n" +
				"Space to toggle debug geometry";

			instructionText.SetFont(cache.GetFont("Fonts/Anonymous Pro.ttf"), 15);
			// The text has multiple rows. Center them in relation to each other
			instructionText.TextAlignment = HorizontalAlignment.Center;

			// Position the text relative to the screen center
			instructionText.HorizontalAlignment = HorizontalAlignment.Center;
			instructionText.VerticalAlignment = VerticalAlignment.Center;
			instructionText.SetPosition(0, UI.Root.Height / 4);
			UI.Root.AddChild(instructionText);
		}
开发者ID:xamarin,项目名称:urho-samples,代码行数:36,代码来源:CrowdNavigation.cs

示例4: LoadAndAddNewTextEntryBelowPrevious

        public void LoadAndAddNewTextEntryBelowPrevious(Text text)
        {
            text.LoadContent(ScreenManager.Content);

            Text previousText = null;
            foreach (UIElement uielement in ActiveUIElements)
            {
                if (uielement as Text != null)
                {
                    if (previousText != null)
                    {
                        if (uielement.Position.Y > previousText.Position.Y)
                        {
                            previousText = (Text)uielement;
                        }
                    }
                    else
                    {
                        previousText = (Text)uielement;
                    }
                }
            }

            foreach (UIElement uielement in UIElementsToAdd)
            {
                if (uielement as Text != null)
                {
                    if (previousText != null)
                    {
                        if (uielement.Position.Y > previousText.Position.Y)
                        {
                            previousText = (Text)uielement;
                        }
                    }
                    else
                    {
                        previousText = (Text)uielement;
                    }
                }
            }

            if (previousText != null)
            {
                text.SetPosition(new Vector2(0, 4 * previousText.TextOrigin.Y));
                AddUIElementRelativeTo(text, previousText);
            }
            else
            {
                AddUIElement(text);
            }
        }
开发者ID:AlanWills,项目名称:Other-Worlds-Than-These,代码行数:51,代码来源:Panel.cs

示例5: CreateInstructions

        void CreateInstructions()
        {
            var cache = ResourceCache;
            UI ui = UI;

            // Construct new Text object, set string to display and font to use
            var instructionText = new Text();
            instructionText.Value = "Drag on the buttons to move them around.\nMulti- button drag also supported.";
            instructionText.SetFont(cache.GetFont("Fonts/Anonymous Pro.ttf"), 15);
            ui.Root.AddChild(instructionText);

            // Position the text relative to the screen center
            instructionText.HorizontalAlignment = HorizontalAlignment.Center;
            instructionText.VerticalAlignment = VerticalAlignment.Center;
            instructionText.SetPosition(0, ui.Root.Height/4);
        }
开发者ID:ZENG-Yuhao,项目名称:Xamarin-CrossPlatform,代码行数:16,代码来源:UIDrag.cs

示例6: CreateInstructions

		void CreateInstructions()
		{
			var cache = ResourceCache;
			UI ui = UI;

			// Construct new Text object, set string to display and font to use
			instructionText = new Text();
			instructionText.Value = ("Use arrow up and down to control sound filtering");
			instructionText.SetFont(cache.GetFont("Fonts/Anonymous Pro.ttf"), 15);

			// Position the text relative to the screen center
			instructionText.TextAlignment = HorizontalAlignment.Center;
			instructionText.HorizontalAlignment = HorizontalAlignment.Center;
			instructionText.VerticalAlignment = VerticalAlignment.Center;
			instructionText.SetPosition(0, ui.Root.Height/4);

			ui.Root.AddChild(instructionText);
		}
开发者ID:cianmulville,项目名称:urho-samples,代码行数:18,代码来源:SoundSynthesis.cs

示例7: Main

    static void Main()
    {
        Clutter.Application.Init ();

        Stage = new Stage ();
        Stage.Title = "Deal!";
        Stage.Add (new Texture ("Pixmaps/Table.png"));
        Stage.SetSize (800, 480);
        Stage.KeyPressEvent += HandleKeyPress;

        Texture C = new Texture ("Pixmaps/Coin.png");
        C.SetSize (50, 50);
        C.SetPosition (35, 405);
        Stage.Add (C);

        Bet = 0;
        BetButton = new BetButton ();
        BetButton.ButtonPressEvent += IncreaseBet;
        Stage.Add (BetButton);

        DealButton = new DealButton ();
        DealButton.ButtonPressEvent += NewGame;
        Stage.Add (DealButton);

        StepButton = new StepButton ();
        StepButton.ButtonPressEvent += NextStep;
        Stage.Add (StepButton);

        Stack = new Stack ();
        Stack.Decrease (20);
        ScoreText = new Text ("Droid Sans Bold 21", "" + Stack.GetAmount());
        ScoreText.SetColor (new Clutter.Color (0xff, 0xff, 0xff, 0xff));
        ScoreText.SetPosition (100, 413);
        Stage.Add (ScoreText);

        Coins = new Coin [5];
        Coins [0] = new Coin ();
        Coins [1] = new Coin ();
        Coins [2] = new Coin ();
        Coins [3] = new Coin ();
        Coins [4] = new Coin ();
        for (int i = 0; i < 5; i++) {
            Coins [i].SetPosition (35, 405);
            Stage.Add (Coins [i]);
        }

        Deck = new Deck ();

        PlayerHand   = new Hand (Deck.Draw (), Deck.Draw (), Deck.Draw (), Deck.Draw (), Deck.Draw ());
        OpponentHand = new Hand (Deck.Draw (), Deck.Draw (), Deck.Draw (), Deck.Draw (), Deck.Draw ());

        SetupAnimation ();

        Stage.ShowAll();

        Clutter.Application.Run ();
    }
开发者ID:hbons,项目名称:Deal,代码行数:57,代码来源:Deal.cs


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