示例#1
0
        /// <summary>
        /// Gets the required demo
        /// </summary>
        public static IDemo GetDemo(char id)
        {
            IDemo demo = null;

            var assembly = Assembly.GetExecutingAssembly();

            // use reflection to find all classes tagged with DemoAttribute
            foreach (Type t in assembly.GetTypes())
            {
                var att = t.GetCustomAttribute <DemoAttribute>();

                if (att != null && att.Id == id)
                {
                    demo = Activator.CreateInstance(t) as IDemo;
                    break;
                }
            }

            // if we haven't found the demo class with the id we want then just
            // default to first demo.
            if (demo == null)
            {
                demo = new TriangleDemo();
            }

            return(demo);
        }
示例#2
0
 /// <summary>
 /// Constructor
 /// </summary>
 public ViewportDemo()
 {
     m_Demo01 = new TriangleDemo();
     m_Demo02 = new LineDemo();
 }
示例#3
0
        /// <summary>
        /// Constructor
        /// </summary>
        public FrameBufferDemo()
        {
            m_TriangleDemo = new TriangleDemo();

            m_Shader = new TextureShader();
        }