Opentk/Source/Examples/ExampleAttribute.cs

56 lines
1.6 KiB
C#
Raw Normal View History

#region --- License ---
2008-01-19 15:25:51 +00:00
/* Copyright (c) 2006-2008 the OpenTK team
* See license.txt for licensing details
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace Examples
{
[AttributeUsage(AttributeTargets.Class)]
public class ExampleAttribute : System.Attribute
{
2008-01-17 14:06:14 +00:00
string title;
bool visible = true;
2008-01-17 14:06:14 +00:00
public string Title { get { return title; } internal set { title = value; } }
public readonly ExampleCategory Category;
public readonly int Difficulty;
public bool Visible { get { return visible; } set { visible = value; } }
public ExampleAttribute(string title, ExampleCategory category)
: this(title, category, 0, true) { }
public ExampleAttribute(string title, ExampleCategory category, int difficulty)
: this(title, category, difficulty, true) { }
public ExampleAttribute(string title, ExampleCategory category, int difficulty, bool visible)
{
this.Title = title;
this.Category = category;
this.Difficulty = difficulty;
this.Visible = visible;
}
public override string ToString()
{
if (Difficulty != 0)
return String.Format("{0} {1}: {2}", Category, Difficulty, Title);
return String.Format("{0}: {1}", Category, Title);
}
}
public enum ExampleCategory
{
OpenGL = 0,
OpenAL,
Tutorial,
GLSL,
WinForms,
Test,
Last
}
}