mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
rework on graphics.cpp, implement some GFX with lua
This commit is contained in:
@@ -14,6 +14,7 @@ Module
|
||||
require 'util'
|
||||
require 'widget'
|
||||
require 'messagebox'
|
||||
require 'dispatcher'
|
||||
|
||||
rootWidget = getRootWidget()
|
||||
return true
|
||||
|
28
modules/core/dispatcher.lua
Normal file
28
modules/core/dispatcher.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
local eventId = 1
|
||||
local events = { }
|
||||
local orig = { scheduleEvent = scheduleEvent,
|
||||
addEvent = addEvent }
|
||||
|
||||
-- fix original scheduleEvent
|
||||
function scheduleEvent(func, delay)
|
||||
eventId = eventId + 1
|
||||
local id = eventId + 1
|
||||
local function proxyFunc()
|
||||
func()
|
||||
table[id] = nil
|
||||
end
|
||||
table[id] = proxyFunc
|
||||
orig.scheduleEvent(proxyFunc, delay)
|
||||
end
|
||||
|
||||
-- fix original addEvent
|
||||
function addEvent(func)
|
||||
eventId = eventId + 1
|
||||
local id = eventId + 1
|
||||
local function proxyFunc()
|
||||
func()
|
||||
table[id] = nil
|
||||
end
|
||||
table[id] = proxyFunc
|
||||
orig.addEvent(proxyFunc)
|
||||
end
|
Reference in New Issue
Block a user