123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
-
- namespace NRKernal
- {
- using System;
- using UnityEngine;
- using System.Runtime.InteropServices;
-
-
-
- public delegate void NRDisplayResolutionCallback(int width, int height);
-
- internal partial class NativeMultiDisplay
- {
-
- private UInt64 m_MultiDisplayHandle;
-
-
- public bool Create()
- {
- NativeResult result = NativeApi.NRDisplayCreate(ref m_MultiDisplayHandle);
- NativeErrorListener.Check(result, this, "Create", true);
- return result == NativeResult.Success;
- }
-
- public void InitColorSpace()
- {
- NativeColorSpace colorspace = QualitySettings.activeColorSpace == ColorSpace.Gamma ?
- NativeColorSpace.COLOR_SPACE_GAMMA : NativeColorSpace.COLOR_SPACE_LINEAR;
- NativeResult result = NativeApi.NRDisplayInitSetTextureColorSpace(m_MultiDisplayHandle, colorspace);
- NativeErrorListener.Check(result, this, "InitColorSpace");
- }
-
- public void Start()
- {
- NativeResult result = NativeApi.NRDisplayStart(m_MultiDisplayHandle);
- NativeErrorListener.Check(result, this, "Start", true);
- }
-
-
- public void ListenMainScrResolutionChanged(NRDisplayResolutionCallback callback)
- {
- NativeResult result = NativeApi.NRDisplaySetMainDisplayResolutionCallback(m_MultiDisplayHandle, callback);
- NativeErrorListener.Check(result, this, "ListenMainScrResolutionChanged");
- }
-
- public void Stop()
- {
- NativeResult result = NativeApi.NRDisplayStop(m_MultiDisplayHandle);
- NativeErrorListener.Check(result, this, "Stop");
- }
-
-
-
- public bool UpdateHomeScreenTexture(IntPtr rendertexture)
- {
- NativeResult result = NativeApi.NRDisplaySetMainDisplayTexture(m_MultiDisplayHandle, rendertexture);
- NativeErrorListener.Check(result, this, "UpdateHomeScreenTexture");
- return result == NativeResult.Success;
- }
-
-
- public bool Pause()
- {
- NativeResult result = NativeApi.NRDisplayPause(m_MultiDisplayHandle);
- NativeErrorListener.Check(result, this, "Pause");
- return result == NativeResult.Success;
- }
-
-
- public bool Resume()
- {
- NativeResult result = NativeApi.NRDisplayResume(m_MultiDisplayHandle);
- NativeErrorListener.Check(result, this, "Resume");
- return result == NativeResult.Success;
- }
-
-
- public bool Destroy()
- {
- NativeResult result = NativeApi.NRDisplayDestroy(m_MultiDisplayHandle);
- NativeErrorListener.Check(result, this, "Destroy");
- return result == NativeResult.Success;
- }
-
- private struct NativeApi
- {
-
-
-
- [DllImport(NativeConstants.NRNativeLibrary)]
- public static extern NativeResult NRDisplayCreate(ref UInt64 out_display_handle);
-
-
-
-
- [DllImport(NativeConstants.NRNativeLibrary)]
- public static extern NativeResult NRDisplaySetMainDisplayResolutionCallback(UInt64 display_handle,
- NRDisplayResolutionCallback resolution_callback);
-
-
-
-
- [DllImport(NativeConstants.NRNativeLibrary)]
- public static extern NativeResult NRDisplayInitSetTextureColorSpace(UInt64 display_handle,
- NativeColorSpace color_space);
-
-
-
- [DllImport(NativeConstants.NRNativeLibrary)]
- public static extern NativeResult NRDisplayStart(UInt64 display_handle);
-
-
-
- [DllImport(NativeConstants.NRNativeLibrary)]
- public static extern NativeResult NRDisplayStop(UInt64 display_handle);
-
-
-
- [DllImport(NativeConstants.NRNativeLibrary)]
- public static extern NativeResult NRDisplayPause(UInt64 display_handle);
-
-
-
- [DllImport(NativeConstants.NRNativeLibrary)]
- public static extern NativeResult NRDisplayResume(UInt64 display_handle);
-
-
-
-
- [DllImport(NativeConstants.NRNativeLibrary)]
- public static extern NativeResult NRDisplaySetMainDisplayTexture(UInt64 display_handle,
- IntPtr controller_texture);
-
-
-
- [DllImport(NativeConstants.NRNativeLibrary)]
- public static extern NativeResult NRDisplayDestroy(UInt64 display_handle);
- };
- }
- }
|