
update_queue = {}

local pause = false
function set_pause(state)
    pause = state

    if pause then
        if HOLevel:isOpened() then
            pause_ho()
        end
    end
end

function pause_ho()
    if HOLevel:isOpened() and pause then
        if not Panel:onPauseClick() then
            timer_mgr:add_timer(function() pause_ho() end, 0.5, 1)
        end
    end
end

function isGameFocusOff()
    return pause
end

----------------------------------------------------------------------------------------------------
function update_frame(dt)

--	app_update_fade(dt)


					input_mgr():update()

					layer_mgr():update(dt)
					--ho:update(dt)

    if QuitConfirm.visible then
        return
    end

                    table.foreach(update_queue,
                        function(idx)
                            update_queue[idx]:update(dt)
                        end)
					
					if is_show_debug_info == true then
						show_debug_info()
					end			
					
					timer_mgr:update(dt)

	--if not app():isPaused() then
--		update_timers(dt)
		update_particles(dt)
	--end
	
--	update_script_timers(dt, app():isPaused())
	
--	update_media(dt)

end

----------------------------------------------------------------------------------------------------
function addUpdateListener(aListener)
    removeUpdateListener(aListener)
    table.insert(update_queue, #update_queue + 1, aListener)
end

----------------------------------------------------------------------------------------------------
function removeUpdateListener(aListener)
    local index = 0
    table.foreach(update_queue,
        function(idx)
            if update_queue[idx] == aListener then
                index = idx
            end
        end)

    if index > 0 then
        table.remove(update_queue, index)
    end
end