Example #1
0
        // checks if a resource is dirty, free's it if necessary and reaquires it
        // calls reaquireHandler if it is dirty and has to be recreated
        public static void checkIfResourceIsDirtyAndReaquire(
            ReaquireDrawCommandHandleDelegateType reaquireHandler,
            IGuiRenderer renderer,
            DirtyableDrawCommandHandle dirtyableDrawCommandHandle
            )
        {
            if (!dirtyableDrawCommandHandle.isDirty)
            {
                return;
            }

            if (dirtyableDrawCommandHandle.payload != null)
            {
                renderer.releaseGuiElementHandle(dirtyableDrawCommandHandle.payload);
            }

            dirtyableDrawCommandHandle.payload = reaquireHandler();
            dirtyableDrawCommandHandle.undirtyfy();
        }