private void SelectFont(SquidFont font) { materialPreviewControl.Visible = false; richTextBoxPreview.Visible = true; buttonSaveFont.Visible = true; labelSRdefinition.Visible = false; textBoxSourceRectanglesXML.Visible = false; buttonBrowseXML.Visible = false; buttonBrowsePath.Visible = false; textBoxPath.Enabled = false; _selectedFont = font; txtName.Text = font.Name; PreviewFont(font); }
private void PreviewFont(SquidFont font) { if (File.Exists(Path.Combine(SquidEngineProject.Instance.Path, font.Filename))) { StreamReader reader = new StreamReader(Path.Combine(SquidEngineProject.Instance.Path, font.Filename)); string fontText = reader.ReadToEnd(); reader.Close(); reader = null; richTextBoxPreview.Text = fontText; } else { richTextBoxPreview.Text = Properties.Resources.SpriteFont; } }
/// <summary> /// Initializes the control, creating the ContentManager /// and using it to load a SpriteFont. /// </summary> protected override void Initialize() { _materialType = typeof(Texture2D); _font = new SquidFont(); _spriteBatch = new SpriteBatch(GraphicsDevice); System.IO.FileStream fs = new System.IO.FileStream(Application.StartupPath + "\\Resources\\checker.png", System.IO.FileMode.Open); _checkerTexture = Texture2D.FromStream(GraphicsDevice, fs); fs.Close(); fs = new System.IO.FileStream(Application.StartupPath + "\\Resources\\cross.png", System.IO.FileMode.Open); _crossTexture = Texture2D.FromStream(GraphicsDevice, fs); fs.Close(); _stretchTexture = false; this.VScroll = true; this.HScroll = true; this.AutoScrollMinSize = new System.Drawing.Size(0, 0); // Hook the idle event to constantly redraw our animation. Application.Idle += delegate { Invalidate(); }; }
private void toolStripButtonCreateFont_Click(object sender, EventArgs e) { String newMaterialName; // TO-DO: replace this with a unique name generator newMaterialName = "New Font"; SquidFont newMaterial = new SquidFont(newMaterialName, SceneManager.EmbeddedFonts[0].Font, (_showLocalTextures ? AssetScope.Local : AssetScope.Global)); if (newMaterial.Scope == AssetScope.Local) { newMaterial.Parent = SceneManager.ActiveScene; } else { newMaterial.Parent = SceneManager.GlobalDataHolder; } newMaterial.Filename = ""; _fontList.Add(newMaterial); LoadNodes(true, 1); }
private void SelectTexture(SquidFont material) { materialPreviewControl.MaterialType = typeof(SquidFont); _SelectedFont = material; materialPreviewControl.FontDisplay = material; }