Opentk/Source/Examples/ExampleAttribute.cs
the_fiddler 989be84c96 Moved and renamed examples to match the new example structurs.
Made example source code visible for all examples in example browser.
Updated Prebuild.exe to newest SVN version (resolves issues with resources).
Added .rtf and .resx files to Examples project in Prebuild.xml.
2009-04-20 09:48:33 +00:00

58 lines
1.9 KiB
C#

#region --- License ---
/* 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
{
string title;
bool visible = true;
public string Title { get { return title; } internal set { title = value; } }
public readonly ExampleCategory Category;
public readonly string Subcategory;
public int Difficulty;
public string Documentation;
public bool Visible { get { return visible; } set { visible = value; } }
public ExampleAttribute(string title, ExampleCategory category, string subcategory)
: this(title, category, subcategory, 0, true) { }
public ExampleAttribute(string title, ExampleCategory category, string subcategory, int difficulty)
: this(title, category, subcategory, difficulty, true) { }
public ExampleAttribute(string title, ExampleCategory category, string subcategory, bool visible)
: this(title, category, subcategory, 0, visible) { }
public ExampleAttribute(string title, ExampleCategory category, string subcategory, int difficulty, bool visible)
{
this.Title = title;
this.Category = category;
this.Subcategory = subcategory;
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
{
Default = 0,
OpenTK = Default,
OpenGL,
OpenAL,
}
}