示例#1
0
        private static void TestString()
        {
            //text left-aligned
            var s = "Abc";

            _composition.DrawString(
                s,
                Fonts.Fixed5x7,
                Brushes.Yellow,
                new Point(0, 0)
                );

            //text right-aligned
            s = "Xyz";
            Size sz = _composition.MeasureString(
                s,
                Fonts.Fixed5x7);

            _composition.DrawString(
                s,
                Fonts.Fixed5x7,
                Brushes.Red,
                new Point(32 - sz.Width, 8)
                );
        }
示例#2
0
        private void ComposePauseShowLevel(CompositionTargetBase target)
        {
            //draw a big bordered box
            target.FillRectangle(
                Brushes.Black,
                this._rectAlert);

            target.DrawRectangle(
                Pens.Lime,
                this._rectAlert);

            //draw a "Level" abbreviation
            target.DrawString(
                "Lv",
                Fonts.Fixed5x7,
                Brushes.Lime,
                this._rectAlert.Left + 2,
                this._rectAlert.Top + 2);

            //draw the number of the current level
            string text = this.Context.CurrentLevel.ToString();
            Size   sz   = target.MeasureString(text, Fonts.Fixed5x7);

            target.DrawString(
                text,
                Fonts.Fixed5x7,
                Brushes.Yellow,
                this._rectAlert.Right - 2 - sz.Width,
                this._rectAlert.Top + 2);
        }
示例#3
0
        private void ComposePauseSaucerHit(CompositionTargetBase target)
        {
            //draw a big bordered box
            target.FillRectangle(
                Brushes.Black,
                this._rectAlert);

            target.DrawRectangle(
                Pens.Lime,
                this._rectAlert);

            //draw the ship symbol
            target.DrawString(
                "LM",   //saucer
                AlienFont.Instance,
                Brushes.Lime,
                this._rectAlert.Left,
                this._rectAlert.Top + 2);

            //draw the number of ships left
            string text = this.Saucer.PromisedScore.ToString();
            Size   sz   = target.MeasureString(text, Fonts.Fixed5x7);

            target.DrawString(
                text,
                Fonts.Fixed5x7,
                Brushes.Yellow,
                this._rectAlert.Right - 2 - sz.Width,
                this._rectAlert.Top + 2);
        }