2009-02-22 11:43:35 +01:00
|
|
|
|
#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;
|
2009-04-20 09:20:25 +02:00
|
|
|
|
public readonly string Subcategory;
|
|
|
|
|
public int Difficulty;
|
|
|
|
|
public string Documentation;
|
2009-02-22 11:43:35 +01:00
|
|
|
|
public bool Visible { get { return visible; } set { visible = value; } }
|
|
|
|
|
|
2009-04-20 09:20:25 +02:00
|
|
|
|
public ExampleAttribute(string title, ExampleCategory category, string subcategory)
|
|
|
|
|
: this(title, category, subcategory, 0, true) { }
|
2009-02-22 11:43:35 +01:00
|
|
|
|
|
2009-04-20 09:20:25 +02:00
|
|
|
|
public ExampleAttribute(string title, ExampleCategory category, string subcategory, int difficulty)
|
|
|
|
|
: this(title, category, subcategory, difficulty, true) { }
|
2009-02-22 11:43:35 +01:00
|
|
|
|
|
2009-04-20 09:20:25 +02:00
|
|
|
|
public ExampleAttribute(string title, ExampleCategory category, string subcategory, int difficulty, bool visible)
|
2009-02-22 11:43:35 +01:00
|
|
|
|
{
|
|
|
|
|
this.Title = title;
|
|
|
|
|
this.Category = category;
|
2009-04-20 09:20:25 +02:00
|
|
|
|
this.Subcategory = subcategory;
|
2009-02-22 11:43:35 +01:00
|
|
|
|
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
|
|
|
|
|
{
|
2009-04-20 09:20:25 +02:00
|
|
|
|
Default = 0,
|
|
|
|
|
OpenTK = Default,
|
|
|
|
|
OpenGL,
|
2009-02-22 11:43:35 +01:00
|
|
|
|
OpenAL,
|
|
|
|
|
}
|
|
|
|
|
}
|