public static void LoadCollection(FontCollection collection) { foreach (var item in collection.Fonts) { var font = new Font(); font.LoadBMFont(item.FontDataFile); font.Texture = textureManager.Get(item.FontTextureFile, true); fonts.Add(item.FontFamily, font); } }
protected override void OnLoad(EventArgs e) { PackageManager.BasePath = "../../Assets/"; ShaderManager.LoadCollection("Shaders/collection.xml"); shader = ShaderManager.Get("Text"); //FontManager.LoadCollection("Fonts/fontCollection.fnt"); //font = FontManager.Get("Arial"); textures = new TextureManager(); font = new Font(); font.LoadBMFont("Fonts/OpenSans-Regular.ttf_sdf.txt"); font.Texture = textures.Get("Textures/OpenSans-Regular.ttf_sdf.tex", true); text = new GuiText(); text.Font = font; text.Text = "This is rendered with SDF technology! (now you should say ooooooooh!)"; text.HorizontalAlignment = HorizontalAlignment.Centered; }
protected override void OnLoad(EventArgs e) { // Initialize GL settings GPUCapabilities.Initialize(); GLState.DepthTest = true; GLState.CullFace = true; GLState.BlendFunc(BlendingFactorSrc.DstAlpha, BlendingFactorDest.OneMinusDstAlpha); PackageManager.BasePath = "../../Assets/"; // Load shaders ShaderManager.LoadCollection("Shaders/collection.xml"); fboShader = ShaderManager.Get("framebufferexample"); blurShader = ShaderManager.Get("framebufferexample.blur"); msaaShader = ShaderManager.Get("framebufferexample.msaa"); fxaaShader = ShaderManager.Get("framebufferexample.fxaa"); // Initialize framebuffer if(msaa) { fbo = new Framebuffer(Width, Height, 32); } else { fbo = new Framebuffer(Width, Height, 0); } // Load other stuff LoadMeshStuff(); textShader = ShaderManager.Get("Text"); font = new Font(); font.LoadBMFont("Fonts/OpenSans-Regular.ttf_sdf.txt"); font.Texture = textures.Get("Textures/OpenSans-Regular.ttf_sdf.tex", true); text = new GuiText(); text.Font = font; text.Text = GenerateInfoText(); }