Example #1
0
        private void OnDeviceOrientationChanged(int orientation)
        {
            var deviceOrientation = ConvertFromiOSOrientation(orientation);

            if (deviceOrientation != m_deviceOrientation)
            {
                PlatformEvents.SendDeviceOrientationEvent(this, new DeviceOrientationEvent((int)deviceOrientation));
                m_deviceOrientation = deviceOrientation;
            }
        }
Example #2
0
        private void OnDeviceOrientationChanged(int orientation)
        {
            var deviceOrientation = ConvertFromAndroidOrientation(orientation);

            if (deviceOrientation != m_DeviceOrientation)
            {
                PlatformEvents.SendDeviceOrientationEvent(this, new DeviceOrientationEvent((int)deviceOrientation));
                if ((deviceOrientation & m_ScreenOrientationMask) != 0)
                {
                    AndroidNativeCalls.setOrientation(orientation);
                }
                m_DeviceOrientation = deviceOrientation;
            }
        }
Example #3
0
        private void UpdateDisplayInfo(bool firstTime)
        {
            int screenOrientation = 0;

            iOSNativeCalls.getScreenOrientation(ref screenOrientation);
            m_screenOrientation = ConvertFromiOSOrientation(screenOrientation);
            var config = GetSingleton <DisplayInfo>();

            if (firstTime)
            {
                config.focused        = true;
                config.visible        = true;
                config.screenDpiScale = 1.0f;
                config.orientation    = m_screenOrientation;
            }
            int sw = 0, sh = 0;

            iOSNativeCalls.getScreenSize(ref sw, ref sh);
            int winw = 0, winh = 0;

            iOSNativeCalls.getWindowSize(ref winw, ref winh);
            if (firstTime || m_screenOrientation != config.orientation ||
                sw != config.screenWidth || sh != config.screenHeight ||
                winw != config.width || winh != config.height ||
                config.framebufferWidth != config.width || config.framebufferHeight != config.height)
            {
                Console.WriteLine($"iOS Window update, screen size {sw} x {sh}, window size {winw} x {winh}, orientation {(int)m_screenOrientation}");
                if (config.orientation != m_screenOrientation)
                {
                    PlatformEvents.SendScreenOrientationEvent(this, new ScreenOrientationEvent((int)m_screenOrientation));
                    config.orientation = m_screenOrientation;
                }
                config.screenWidth  = sw;
                config.screenHeight = sh;
                if (config.autoSizeToFrame)
                {
                    config.width  = sw;
                    config.height = sh;
                }
                iOSNativeCalls.setWindowSize(config.width, config.height);
                config.frameWidth        = config.width;
                config.frameHeight       = config.height;
                config.framebufferWidth  = config.width;
                config.framebufferHeight = config.height;
                SetSingleton(config);
            }
        }
Example #4
0
 static void ManagedOnDestroyCallback()
 {
     PlatformEvents.SendQuitEvent(sWindowSystem, new QuitEvent());
 }
Example #5
0
 static void ManagedOnPauseCallback(int pause)
 {
     PlatformEvents.SendSuspendResumeEvent(sWindowSystem, new SuspendResumeEvent(pause != 0));
 }