コード例 #1
0
        void CompilePreviewPages(System.Drawing.Printing.PrintPageEventArgs e)
        {
            Application.DoEvents();
            Font   printFont = FontProvider.GetFont(document.Cpi);
            string source    = document.ToString(fromPage);

            System.IO.StringReader sr = new System.IO.StringReader(source);
            float height     = e.MarginBounds.Height / document.PageHeight;
            float leftMargin = e.MarginBounds.Left;
            float topMargin  = e.MarginBounds.Top;
            float yPos       = topMargin;

            while (true)
            {
                string line = sr.ReadLine();
                if (line != null)
                {
                    e.Graphics.DrawString(line, printFont, Brushes.Black, leftMargin, yPos);
                    //yPos += (printFont.GetHeight(e.Graphics)-3);
                    yPos += height;
                }
                else
                {
                    break;
                }
            }
            e.HasMorePages = ++fromPage < document.Count;
            printFont.Dispose();
            sr.Close();
            sr.Dispose();
        }
コード例 #2
0
        public void CanLoadAllNecessaryFonts()
        {
            var fontProvider = new FontProvider();

            foreach (var fontName in _fontNames)
            {
                Assert.NotNull(fontProvider.GetFontFamily(fontName));
            }
            foreach (var fontName in _fontNames)
            {
                Assert.NotNull(fontProvider.GetFont(fontName, FontSize.FromPixels(23)));
            }
            foreach (var fontName in _fontNames)
            {
                Assert.NotNull(fontProvider.GetFont(fontProvider.GetFontFamily(fontName), FontSize.FromPixels(23)));
            }
        }
コード例 #3
0
 protected GameViewBase(ILog log, FontTarget font = FontTarget.Interface)
     : base(
         log,
         FontProvider.GetScreenWidth(font),
         FontProvider.GetScreenHeight(font),
         FontProvider.GetFont(font))
 {
 }
コード例 #4
0
        public static void LoadContent(ContentManager content)
        {
            FontProvider.AddFont("Mono14", content.Load <SpriteFont>(@"fonts/mono14"));
            FontProvider.AddFont("Mono8", content.Load <SpriteFont>(@"fonts/mono8"));
            FontProvider.AddFont("Mono21", content.Load <SpriteFont>(@"fonts/mono21"));

            Titlescreen.TitleTexture = content.Load <Texture2D>(@"textures/titlescreen");

            new TileMap <Map <TileCode>, TileCode>(8, 8, 0, FontProvider.GetFont("Mono8"),
                                                   content.Load <Texture2D>(@"textures/spritesheets/tilesheet"), 3);

            BulletInformationProvider.LoadBulletData(content);
            AnimationDictionaryProvider.Content = content;
        }
コード例 #5
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);

            spriteBatch.DrawString(
                FontProvider.GetFont(fontName),
                confirmText + GameVariableProvider.SaveState.PlayerName + "?",
                ShortcutProvider.Vector2Point(menuItems[0].ItemPosition - itemOffset - new Vector2(ShortcutProvider.GetFontCenter(fontName, confirmText + GameVariableProvider.SaveState.PlayerName + "?").X, 0)),
                Color.White,
                0,
                Vector2.Zero,
                1,
                SpriteEffects.None,
                .2f);
        }
コード例 #6
0
        void CompilePreviewPagesEx(System.Drawing.Printing.PrintPageEventArgs e)
        {
            Application.DoEvents();
            float             height     = e.MarginBounds.Height / document.PageHeight;
            float             leftMargin = e.MarginBounds.Left;
            float             topMargin  = e.MarginBounds.Top;
            float             yPos       = topMargin;
            Font              printFont  = FontProvider.GetFont(document.Cpi);
            ClassicReportPage page       = document[fromPage];

            for (int rowIndex = 0; rowIndex < document.PageHeight; rowIndex++)
            {
                string rowString = page.ToString(rowIndex);
                rowString = rowString.Replace(' ', 'M');
                foreach (ClassicReportPageItem item in page.GetItems(rowIndex))
                {
                    float xPos = leftMargin;
                    if (item.Offset > 0)
                    {
                        string trailer = rowString.Substring(0, item.Offset - 1);
                        xPos += e.Graphics.MeasureString(trailer, printFont).Width;
                    }
                    FontStyle fontStyle = FontStyle.Regular;
                    if (item.IsBold)
                    {
                        fontStyle |= FontStyle.Bold;
                    }
                    if (item.IsItalic)
                    {
                        fontStyle |= FontStyle.Italic;
                    }
                    if (item.IsUnderline)
                    {
                        fontStyle |= FontStyle.Underline;
                    }
                    Font itemFont = new Font(printFont, fontStyle);
                    e.Graphics.DrawString(item.Value, itemFont, Brushes.Black, xPos, yPos);
                    itemFont.Dispose();
                }
                yPos += height;
            }
            e.HasMorePages = ++fromPage <= toPage;
            printFont.Dispose();
        }
コード例 #7
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            if (Confirmation)
            {
                confirmDialog.Draw(spriteBatch);
                return;
            }

            base.Draw(spriteBatch);

            spriteBatch.DrawString(
                FontProvider.GetFont(fontName),
                TextBuffer,
                ShortcutProvider.Vector2Point(menuLabels[0].Position + new Vector2(FontProvider.GetFont(fontName).MeasureString(menuLabels[0].Text).X + 14, 0)),
                Color.White,
                0,
                Vector2.Zero,
                1,
                SpriteEffects.None,
                .2f);
        }
コード例 #8
0
        protected override void Draw()
        {
            base.Draw();
            _spriteBatch.Begin();
            _spriteBatch.DrawString(Editor.Font, "Hello World", new Vector2(150, 150), Color.White);
            _spriteBatch.End();
            return;

            GraphicsDevice.SetRenderTarget(_renderTarget);
            GraphicsDevice.Viewport = _standardViewport;
            GraphicsDevice.Clear(Color.Black);
            _spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
            if (!MapLoaded)
            {
                _spriteBatch.DrawString(FontProvider.GetFont("Mono8"), "Please load a map.",
                                        ShortCuts.ScreenCenter - ShortCuts.GetFontCenter("Mono8", "Please load a map."),
                                        Color.Green);
            }
            else if (DrawAll)
            {
                TileMap.Draw();
            }
            else
            {
                TileMap.Draw(Layer);
            }
            EntityManager.Draw();
            _bulletManager.Draw();
            _spriteBatch.End();
            DrawHelper.Draw();
            GraphicsDevice.SetRenderTarget(null);
            GraphicsDevice.Viewport = _renderViewport;
            GraphicsDevice.Clear(Color.LightBlue);
            _spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
            _spriteBatch.Draw(_renderTarget, new Rectangle(0, 0, _renderViewport.Width, _renderViewport.Height),
                              Color.White);
            _spriteBatch.End();
        }
コード例 #9
0
 public MenuItem(string itemName, string fontName, bool isSelected, Color selectedColor, Color unSelectedColor)
     : this(itemName, Vector2.Zero, isSelected, FontProvider.GetFont(fontName))
 {
     SelectedColor   = selectedColor;
     UnSelectedcolor = unSelectedColor;
 }
コード例 #10
0
 public MenuItem(string itemName, string fontName, bool isSelected)
     : this(itemName, Vector2.Zero, isSelected, FontProvider.GetFont(fontName))
 {
 }
コード例 #11
0
 public MenuItem(string itemName, string fontName)
     : this(itemName, Vector2.Zero, false, FontProvider.GetFont(fontName))
 {
 }
コード例 #12
0
 public MenuItem(string itemName)
     : this(itemName, Vector2.Zero, false, FontProvider.GetFont("Pericles14"))
 {
 }
コード例 #13
0
 public MenuItem(string itemName, Vector2 itemPosition)
     : this(itemName, itemPosition, false, FontProvider.GetFont("Pericles14"))
 {
 }
コード例 #14
0
ファイル: MenuLabel.cs プロジェクト: FelixKirmse/BlackDragon
 public MenuLabel(string text, string fontName)
 {
     Text = text;
     font = FontProvider.GetFont(fontName);
 }
コード例 #15
0
 public MenuLabel(string text, string fontName)
 {
     _spriteBatch = VariableProvider.SpriteBatch;
     Text         = text;
     _font        = FontProvider.GetFont(fontName);
 }
コード例 #16
0
 public static void Initialize()
 {
     font = FontProvider.GetFont("Mono14");
 }
コード例 #17
0
ファイル: UxContext.cs プロジェクト: Crul/Rogueskiv
 public IntPtr GetFont(string fontFile, int fontSize) => FontProvider.GetFont(fontFile, fontSize);
コード例 #18
0
 private DialogManager()
 {
     _spriteBatch = VariableProvider.SpriteBatch;
     _font        = FontProvider.GetFont("Mono14");
 }