/*
* @author Valentin Simonov / http://va.lent.in/
*/
#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine;
namespace TouchScript.Devices.Display
{
///
/// A simple display device which inherits from and can be saved in Unity assets.
///
[HelpURL("http://touchscript.github.io/docs/html/T_TouchScript_Devices_Display_DisplayDevice.htm")]
public class DisplayDevice : ScriptableObject, IDisplayDevice
{
#if UNITY_EDITOR
//[MenuItem("Window/TouchScript/CreateDisplayDevice")]
private static DisplayDevice CreateDisplayDevice()
{
var dd = CreateInstance();
AssetDatabase.CreateAsset(dd, "Assets/DisplayDevice.asset");
return dd;
}
#endif
///
public string Name
{
get { return name; }
set
{
name = value;
base.name = value;
}
}
///
public virtual float DPI
{
get { return dpi; }
}
///
public virtual float NativeDPI
{
get { return nativeDPI; }
}
///
public virtual Vector2 NativeResolution
{
get { return nativeResolution; }
}
///
/// Serialized device name.
///
[SerializeField]
protected new string name = "Unknown Device";
///
/// Serialized device DPI.
///
[SerializeField]
protected float dpi = 96;
///
/// Native device dpi.
///
[SerializeField]
protected float nativeDPI = 96;
///
/// Native device resolution.
///
[SerializeField]
protected Vector2 nativeResolution = new Vector2(1920, 1080);
///
public virtual void UpdateDPI() {}
///
/// OnEnable Unity method.
///
protected virtual void OnEnable()
{
base.name = name;
}
}
}