Example #1
0
        private static int EndSceneHook(IntPtr device)
        {
            try
            {
                if (FrameCount == -1)
                {
                    if (OnLastFrame != null)
                    {
                        OnLastFrame(null, new EventArgs());
                    }
                    Device = null;
                }
                else
                {
                    if (Device == null)
                    {
                        Device = Device.FromPointer(device);
                    }

                    if (FrameCount == 0)
                    {
                        if (OnFirstFrame != null)
                        {
                            OnFirstFrame(null, new EventArgs());
                        }
                    }

                    if (!Rendering.IsInitialized)
                    {
                        Rendering.Initialize(device);
                    }

                    Rendering.Pulse();

                    PrepareRenderState();
                    CallbackManager.Invoke();

                    // TEMP SOLUTION
                    // TODO: FIX THIS
                    IceFlake.Client.Scripts.ScriptManager.Pulse();
                }
            }
            catch (Exception e)
            {
                Log.WriteLine("Error: " + e.ToLongString());
            }

            if (FrameCount != -1)
            {
                FrameCount += 1;
            }

            return((int)_endSceneHook.CallOriginal(device));
        }