浏览代码

merge similar codes for win32 and mac/ios

/siyaoH-1.17-PlatformMessage
xingweizhu 3 年前
当前提交
754b6c82
共有 1 个文件被更改,包括 2 次插入68 次删除
  1. 70
      com.unity.uiwidgets/Runtime/engine/UIWidgetsPanelWrapper.cs

70
com.unity.uiwidgets/Runtime/engine/UIWidgetsPanelWrapper.cs


using Path = Unity.UIWidgets.ui.Path;
namespace Unity.UIWidgets.engine {
#region Platform: Windows Specific Functionalities
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
public partial class UIWidgetsPanelWrapper {
Texture _renderTexture;
public Texture renderTexture {
get { return _renderTexture; }
}
void _createRenderTexture(int width, int height, float devicePixelRatio) {
D.assert(_renderTexture == null);
_width = width;
_height = height;
this.devicePixelRatio = devicePixelRatio;
}
void _destroyRenderTexture() {
D.assert(_renderTexture != null);
var releaseOK = UIWidgetsPanel_releaseNativeTexture(_ptr);
D.assert(releaseOK);
_renderTexture = null;
}
void _enableUIWidgetsPanel(string font_settings) {
D.assert(_renderTexture == null);
IntPtr native_tex_ptr = UIWidgetsPanel_onEnable(_ptr, _width, _height, devicePixelRatio,
Application.streamingAssetsPath, font_settings);
D.assert(native_tex_ptr != IntPtr.Zero);
_renderTexture =
Texture2D.CreateExternalTexture(_width, _height, TextureFormat.RGBAFloat, false, true, native_tex_ptr);
}
void _disableUIWidgetsPanel() {
_renderTexture = null;
}
void _resizeUIWidgetsPanel() {
D.assert(_renderTexture == null);
IntPtr native_tex_ptr = UIWidgetsPanel_onRenderTexture(_ptr, _width, _height, devicePixelRatio);
D.assert(native_tex_ptr != IntPtr.Zero);
#region Platform: MacOs/iOS/Windows Specific Functionalities
_renderTexture =
Texture2D.CreateExternalTexture(_width, _height, TextureFormat.RGBAFloat, false, true, native_tex_ptr);
}
[DllImport(NativeBindings.dllName)]
static extern IntPtr UIWidgetsPanel_onEnable(IntPtr ptr,
int width, int height, float dpi, string streamingAssetsPath, string font_settings);
[DllImport(NativeBindings.dllName)]
static extern bool UIWidgetsPanel_releaseNativeTexture(IntPtr ptr);
[DllImport(NativeBindings.dllName)]
static extern IntPtr UIWidgetsPanel_onRenderTexture(
IntPtr ptr, int width, int height, float dpi);
}
#endif
#endregion
#region Platform: MacOs/iOS Specific Functionalities
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IOS
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IOS || UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
public partial class UIWidgetsPanelWrapper {
Texture _renderTexture;

正在加载...
取消
保存