コード例 #1
0
ファイル: Font.cs プロジェクト: majorsilence/Eto
		/// <summary>
		/// Creates a new instance of the Font class with a specified <paramref name="systemFont"/> and optional custom <paramref name="size"/>
		/// </summary>
		/// <remarks>
		/// The system fonts are the same fonts that the standard UI of each platform use for particular areas
		/// given the <see cref="SystemFont"/> enumeration.
		/// </remarks>
		/// <param name="generator">Generator to create the font for</param>
		/// <param name="systemFont">Type of system font to create</param>
		/// <param name="size">Optional size of the font, in points. If not specified, the default size of the system font is used</param>
		public Font (Generator generator, SystemFont systemFont, float? size = null)
			: base(generator, typeof(IFont))
		{
			inner = (IFont)Handler;
			inner.Create(systemFont, size);
		}
コード例 #2
0
ファイル: Font.cs プロジェクト: majorsilence/Eto
		/// <summary>
		/// Creates a new instance of the Font class with a specified <paramref name="family"/>, <paramref name="size"/>, and <paramref name="style"/>
		/// </summary>
		/// <param name="generator">Generator to create the font for</param>
		/// <param name="family">Family of font to use</param>
		/// <param name="size">Size of the font, in points</param>
		/// <param name="style">Style of the font</param>
		public Font (Generator generator, FontFamily family, float size, FontStyle style = FontStyle.Normal)
			: base(generator, typeof(IFont))
		{
			inner = (IFont)Handler;
			inner.Create(family, size, style);
		}
コード例 #3
0
ファイル: Font.cs プロジェクト: modulexcite/Eto-1
 /// <summary>
 /// Creates a new instance of the Font class with a specified <paramref name="systemFont"/> and optional custom <paramref name="size"/>
 /// </summary>
 /// <remarks>
 /// The system fonts are the same fonts that the standard UI of each platform use for particular areas
 /// given the <see cref="SystemFont"/> enumeration.
 /// </remarks>
 /// <param name="generator">Generator to create the font for</param>
 /// <param name="systemFont">Type of system font to create</param>
 /// <param name="size">Optional size of the font, in points. If not specified, the default size of the system font is used</param>
 public Font(Generator generator, SystemFont systemFont, float?size = null)
     : base(generator, typeof(IFont))
 {
     inner = (IFont)Handler;
     inner.Create(systemFont, size);
 }
コード例 #4
0
ファイル: Font.cs プロジェクト: modulexcite/Eto-1
 /// <summary>
 /// Creates a new instance of the Font class with a specified <paramref name="family"/>, <paramref name="size"/>, and <paramref name="style"/>
 /// </summary>
 /// <param name="generator">Generator to create the font for</param>
 /// <param name="family">Family of font to use</param>
 /// <param name="size">Size of the font, in points</param>
 /// <param name="style">Style of the font</param>
 public Font(Generator generator, FontFamily family, float size, FontStyle style = FontStyle.Normal)
     : base(generator, typeof(IFont))
 {
     inner = (IFont)Handler;
     inner.Create(family, size, style);
 }
コード例 #5
0
ファイル: SampleForm.cs プロジェクト: raygoe/OpenGL.Net
        /// <summary>
        /// Allocate resources for rendering.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ObjectsControl_ContextCreated(object sender, GlControlEventArgs e)
        {
            // Wrap GL context with GraphicsContext
            _Context = new GraphicsContext(e.DeviceContext, e.RenderContext);
            // Scene
            _CubeScene = new SceneGraph();
            _CubeScene.Link(new SceneObjectCamera());

            fontTitle = FontFactory.CreateFont(System.Drawing.FontFamily.GenericSerif, 24, System.Drawing.FontStyle.Regular, FontFactory.FontType.Textured);
            fontTitle.Create(_Context);

            fontTitleV = FontFactory.CreateFont(System.Drawing.FontFamily.GenericSerif, 24, System.Drawing.FontStyle.Regular, FontFactory.FontType.Vector);
            fontTitleV.Create(_Context);

            fontPatch = FontFactory.CreateFont(System.Drawing.FontFamily.GenericMonospace, 16, System.Drawing.FontStyle.Regular, FontFactory.FontType.Vector);
            fontPatch.Create(_Context);

            // Global lighting
            SceneObjectLightZone globalLightZone = new SceneObjectLightZone();

            _GlobalLightObject           = new SceneObjectLightDirectional();
            _GlobalLightObject.Direction = (-Vertex3f.UnitX + Vertex3f.UnitY - Vertex3f.UnitZ).Normalized;
            globalLightZone.Link(_GlobalLightObject);

            SceneObjectLightPoint localLightObject = new SceneObjectLightPoint();

            localLightObject.LocalModel.Translate(0.0, -5.0f, 0.0);
            localLightObject.AttenuationFactors.Y = 0.1f;
            //globalLightZone.AddChild(localLightObject);

            _CubeScene.Link(globalLightZone);

            // Horizontal plane
            globalLightZone.Link(CreatePlane());

            // Cube
            float       Size       = (float)Math.Sqrt(0);
            const float Multiplier = 10.0f;

            int materialIndex = 0;

            for (float x = -Size / 2.0f * Multiplier; x < Size / 2.0f * Multiplier; x += Multiplier)
            {
                for (float y = -Size / 2.0f * Multiplier; y < Size / 2.0f * Multiplier; y += Multiplier, materialIndex++)
                {
                    SceneObjectGeometry cubeInstance = CreateCubeGeometry();

                    cubeInstance.LocalModel.Translate(x, 0.0f, y);
                    cubeInstance.LocalModel.Scale(0.25f);

                    // Enable/Disable blending
                    if ((materialIndex % 2) == 0)
                    {
                        cubeInstance.ObjectState.DefineState(new BlendState(BlendEquationModeEXT.FuncAdd, BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha));
                    }

                    // Enable/Disable blending
                    switch (materialIndex % 1)
                    {
                    case 0:
                        cubeInstance.ProgramTag = ShadersLibrary.Instance.CreateProgramTag("OpenGL.Standard+LambertVertex", new ShaderCompilerContext("GLO_COLOR_PER_VERTEX"));
                        break;

                    case 1:
                        cubeInstance.ProgramTag = ShadersLibrary.Instance.CreateProgramTag("OpenGL.Standard+Color");
                        break;

                    case 2:
                        cubeInstance.ProgramTag = ShadersLibrary.Instance.CreateProgramTag("OpenGL.Standard+PhongFragment");
                        break;
                    }

                    globalLightZone.Link(cubeInstance);
                }
            }

            //SceneObjectGeometry cubeLambert = CreateCubeGeometry();
            //cubeLambert.ProgramTag = ShadersLibrary.Instance.CreateProgramTag("OpenGL.Standard+LambertVertex", new ShaderCompilerContext("GLO_COLOR_PER_VERTEX"));
            //globalLightZone.Link(cubeLambert);

            //SceneObjectGeometry cubeBlinn = CreateCubeGeometry();
            //cubeBlinn.ProgramTag = ShadersLibrary.Instance.CreateProgramTag("OpenGL.Standard+PhongFragment", new ShaderCompilerContext("GLO_COLOR_PER_VERTEX"));
            //cubeBlinn.LocalModel.Translate(0.0f, 10.0f, 0.0f);
            //globalLightZone.Link(cubeBlinn);

            //SceneObjectGeometry cubeColored = CreateCubeGeometry();
            //cubeColored.ProgramTag = ShadersLibrary.Instance.CreateProgramTag("OpenGL.Standard+Color");
            //cubeColored.LocalModel.Translate(0.0f, 5.0f, 0.0f);
            //globalLightZone.Link(cubeColored);

            globalLightZone.Link(CreateBumbleBeeVH());
            globalLightZone.Link(CreateBumbleBeeRB());
            globalLightZone.Link(CreateSphere("squarebricks"));

            // Skybox
            //if ((sceneObject = CreateSkyBoxObject()) != null)
            //	_CubeScene.AddChild(sceneObject);

            _CubeScene.Create(_Context);

            Gl.ClearColor(0.1f, 0.1f, 0.1f, 0.0f);

            Gl.Enable(EnableCap.Multisample);
        }
コード例 #6
0
 /// <summary>
 /// Creates a new instance of the Font class with a specified <paramref name="family"/>, <paramref name="size"/>, and <paramref name="style"/>
 /// </summary>
 /// <param name="family">Family of font to use</param>
 /// <param name="size">Size of the font, in points</param>
 /// <param name="style">Style of the font</param>
 /// <param name="decoration">Decorations to apply to the font</param>
 /// <param name="generator">Generator to create the font for</param>
 public Font(string family, float size, FontStyle style = FontStyle.None, FontDecoration decoration = FontDecoration.None, Generator generator = null)
     : base(generator, typeof(IFont))
 {
     Handler.Create(new FontFamily(family), size, style, decoration);
 }