Exemplo n.º 1
0
        public GameplayScreen(ContentManager globalContent, UIScreenService uiScreenService)
            : base("Content/UI/Screens/GameplayScreen", "GameplayScreen", globalContent)
        {
            Contract.Require(uiScreenService, "uiScreenService");

            this.textRenderer    = new TextRenderer();
            this.blankTexture    = GlobalContent.Load<Texture2D>(GlobalTextureID.Blank);
            this.photograph      = GlobalContent.Load<Texture2D>(GlobalTextureID.Photograph);
            this.font            = GlobalContent.Load<SpriteFont>(GlobalFontID.SegoeUI);
        }
Exemplo n.º 2
0
        public SampleScreen2(ContentManager globalContent, UIScreenService uiScreenService)
            : base("Content/UI/Screens/SampleScreen2", "SampleScreen2", globalContent)
        {
            Contract.Require(uiScreenService, "uiScreenService");

            IsOpaque = true;

            this.font         = LocalContent.Load<SpriteFont>("Garamond");
            this.blankTexture = GlobalContent.Load<Texture2D>(GlobalTextureID.Blank);
            this.textRenderer = new TextRenderer();
        }
Exemplo n.º 3
0
        public LoadingScreen(ContentManager globalContent, UIScreenService uiScreenService)
            : base("Content/UI/Screens/LoadingScreen", "LoadingScreen", globalContent)
        {
            Contract.Require(uiScreenService, "uiScreenService");

            this.uiScreenService = uiScreenService;
            this.textRenderer    = new TextRenderer();
            this.blankTexture    = GlobalContent.Load<Texture2D>(GlobalTextureID.Blank);
            this.font            = GlobalContent.Load<SpriteFont>(GlobalFontID.SegoeUI);
            this.spinnerSprite   = LocalContent.Load<Sprite>("Spinner");
            this.loader          = new AsynchronousContentLoader();

            this.textRenderer.RegisterIcon("spinner", spinnerSprite[0]);

            UpdateMessage(String.Empty);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScrollingTextBlock"/> class.
        /// </summary>
        /// <param name="textRenderer">The text renderer which will be used to draw the scrolling text block's text.</param>
        /// <param name="font">The sprite font which will be used to draw the scrolling text block's text.</param>
        /// <param name="text">The string which is displayed by the scrolling text block.</param>
        /// <param name="width">The width of the scrolling text block's layout area in pixels,
        /// or <see langword="null"/> to give the layout area an unconstrained width.</param>
        /// <param name="height">The height of the scrolling text block's layout area in pixels,
        /// or <see langword="null"/> to give the layout area an unconstrained height.</param>
        public ScrollingTextBlock(TextRenderer textRenderer, SpriteFont font, String text, Int32? width, Int32? height)
        {
            Contract.Require(textRenderer, nameof(textRenderer));
            Contract.Require(font, nameof(font));
            Contract.Require(text, nameof(text));

            this.TextRenderer = textRenderer;
            this.Font = font;

            this.Width = width;
            this.Height = height;

            this.textParserTokens = new TextParserTokenStream();
            this.textLayoutCommands = new TextLayoutCommandStream();

            this.Text = text;
            this.TextRenderer.Parse(text, textParserTokens);
            this.TextRenderer.CalculateLayout(Text, textLayoutCommands,
                new TextLayoutSettings(Font, width, height, TextFlags.Standard));

            Reset();
        }
            /// <summary>
            /// Loads the panel's content assets if they haven't already been loaded.
            /// </summary>
            private void LoadContentIfNecessary()
            {
                if (content != null)
                    return;

                content = ContentManager.Create();
                spriteBatch = SpriteBatch.Create();

                var asm = Assembly.GetExecutingAssembly();
                using (var stream = asm.GetManifestResourceStream("TwistedLogik.Ultraviolet.UI.Presentation.Resources.Content.Fonts.SegoeUITexture.png"))
                    font = content.LoadFromStream<SpriteFont>(stream, "png");

                blankTexture = Texture2D.Create(1, 1);
                blankTexture.SetData(new[] { Color.White });
            }
Exemplo n.º 6
0
        /// <summary>
        /// Called when the application is loading content.
        /// </summary>
        protected override void OnLoadingContent()
        {
            this.content = ContentManager.Create("Content");

            LoadContentManifests();

            this.spriteBatch = SpriteBatch.Create();
            this.spriteFont = this.content.Load<SpriteFont>(GlobalFontID.SegoeUI);

            this.textRenderer = new TextRenderer();

            base.OnLoadingContent();
        }