add logging and use smart pointers for buffers.

This commit is contained in:
hecomi
2016-11-09 19:40:05 +09:00
parent 43ba445623
commit 620762dba7
16 changed files with 214 additions and 90 deletions
+10 -6
View File
@@ -61,6 +61,9 @@ public class Manager : MonoBehaviour
public delegate void ReinitializeHandler();
public static event ReinitializeHandler onReinitialized;
private Lib.DebugLogDelegate logFunc = msg => Debug.Log(msg);
private Lib.DebugLogDelegate errorFunc = msg => Debug.LogError(msg);
void Awake()
{
Lib.InitializeUDD();
@@ -81,10 +84,16 @@ public class Manager : MonoBehaviour
void OnEnable()
{
renderCoroutine_ = StartCoroutine(OnRender());
Lib.SetLogFunc(logFunc);
Lib.SetErrorFunc(errorFunc);
}
void OnDisable()
{
Lib.SetLogFunc(null);
Lib.SetErrorFunc(null);
if (renderCoroutine_ != null) {
StopCoroutine(renderCoroutine_);
renderCoroutine_ = null;
@@ -96,12 +105,6 @@ public class Manager : MonoBehaviour
Lib.Update();
ReinitializeIfNeeded();
UpdateMessage();
/*
foreach (var monitor in monitors_) {
Debug.LogFormat("[{0}] {1}", monitor.id, monitor.state);
}
*/
}
[ContextMenu("Reinitialize")]
@@ -168,6 +171,7 @@ public class Manager : MonoBehaviour
void CreateMonitors()
{
monitors.Clear();
for (int i = 0; i < monitorCount; ++i) {
monitors.Add(new Monitor(i));
}