UnityView.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #pragma once
  2. @interface UnityRenderingView : UIView {}
  3. + (void)InitializeForAPI:(UnityRenderingAPI)api;
  4. @end
  5. @interface UnityView : UnityRenderingView
  6. {
  7. @private ScreenOrientation _curOrientation;
  8. @private BOOL _shouldRecreateView;
  9. }
  10. // we take scale factor into account because gl backbuffer size depends on it
  11. - (id)initWithFrame:(CGRect)frame scaleFactor:(CGFloat)scale;
  12. - (id)initWithFrame:(CGRect)frame;
  13. - (id)initFromMainScreen;
  14. // in here we will go through subviews and call onUnityUpdateViewLayout selector (if present)
  15. // that allows to handle simple overlay child view layout without doing view controller magic
  16. - (void)layoutSubviews;
  17. - (void)recreateRenderingSurfaceIfNeeded;
  18. - (void)recreateRenderingSurface;
  19. // will match script-side Screen.orientation
  20. @property (nonatomic, readonly) ScreenOrientation contentOrientation;
  21. @end
  22. @interface UnityView (Deprecated)
  23. - (void)recreateGLESSurfaceIfNeeded __deprecated_msg("use recreateRenderingSurfaceIfNeeded instead.");
  24. - (void)recreateGLESSurface __deprecated_msg("use recreateRenderingSurface instead.");
  25. @end
  26. #if PLATFORM_IOS
  27. #include "UnityView+iOS.h"
  28. #elif PLATFORM_TVOS
  29. #include "UnityView+tvOS.h"
  30. #endif
  31. void ReportSafeAreaChangeForView(UIView* view);
  32. // Computes safe area for a view in Unity coordinate system (origin of the view
  33. // is bottom-left, as compared to standard top-left)
  34. CGRect ComputeSafeArea(UIView* view);