コード例 #1
0
ファイル: GLFW.cs プロジェクト: spicysoft/h5-count-shape
 protected override void OnDestroy()
 {
     // close window
     if (initialized)
     {
         Debug.Log("GLFW Window shutdown.");
         GLFWNativeCalls.shutdown(0);
         initialized = false;
     }
 }
コード例 #2
0
ファイル: GLFW.cs プロジェクト: spicysoft/h5-count-shape
        protected override void OnUpdate()
        {
            if (!initialized)
            {
                return;
            }
            GLFWNativeCalls.swapBuffers();
            var env = World.TinyEnvironment();
            var config = env.GetConfigData <DisplayInfo>();
            int winw = 0, winh = 0;

            GLFWNativeCalls.getWindowSize(ref winw, ref winh);
            if (winw != config.width || winh != config.height)
            {
                if (config.autoSizeToFrame)
                {
                    config.width       = winw;
                    config.height      = winh;
                    config.frameWidth  = winw;
                    config.frameHeight = winh;
                    int fbw = 0, fbh = 0;
                    GLFWNativeCalls.getFramebufferSize(ref fbw, ref fbh);
                    config.framebufferWidth  = fbw;
                    config.framebufferHeight = fbh;
                    env.SetConfigData(config);
                }
                else
                {
                    GLFWNativeCalls.resize(config.width, config.height);
                }
            }
            if (!GLFWNativeCalls.messagePump())
            {
                Debug.Log("GLFW message pump exit.");
                GLFWNativeCalls.shutdown(1);
                World.QuitUpdate = true;
                initialized      = false;
                return;
            }
#if DEBUG
            GLFWNativeCalls.debugClear();
#endif
            double newFrameTime = GLFWNativeCalls.time();
            env.StepWallRealtimeFrame(newFrameTime - frameTime);
            frameTime = newFrameTime;
        }
コード例 #3
0
        protected override void OnDestroy()
        {
            // close window
            if (windowOpen)
            {
                GLFWNativeCalls.destroy_window();
                windowOpen = false;
            }

            if (initialized)
            {
                GLFWNativeCalls.shutdown(0);
                initialized = false;
            }

            base.OnDestroy();
        }
コード例 #4
0
        protected override void OnDestroy()
        {
            // close window
            if (windowOpen)
            {
#if UNITY_EDITOR
                GLFWNativeCalls.show_window(0);
#else
                GLFWNativeCalls.destroy_window();
#endif
                windowOpen = false;
            }

#if UNITY_DOTSPLAYER
            if (initialized)
            {
                GLFWNativeCalls.shutdown(0);
                initialized = false;
            }
#endif
        }