mirror of
https://github.com/edubart/otclient.git
synced 2025-10-16 20:43:26 +02:00
ui and graphics changes
* implement draw clipping using opengl stencil buffers * allow to create Widgets by style name with g_ui.createWidgetByStyle * styles can now have children widgets * make proper use of the isNotPathable in pathfinding * add scrollbar skin
This commit is contained in:
@@ -12,27 +12,12 @@ function displayUI(otui, parent)
|
||||
return g_ui.loadUI(otuiFilePath, parent)
|
||||
end
|
||||
|
||||
function createWidget(style, parent)
|
||||
local className = g_ui.getStyleClass(style)
|
||||
if className == "" then
|
||||
error('could not find style ' .. style)
|
||||
return
|
||||
function createWidget(stylename, parent)
|
||||
if type(parent) == 'string' then
|
||||
parent = rootWidget:recursiveGetChildById(parent)
|
||||
end
|
||||
|
||||
local class = _G[className]
|
||||
if not class then
|
||||
error('could not find widget class ' .. className)
|
||||
return
|
||||
end
|
||||
|
||||
local widget = class.create()
|
||||
if parent then
|
||||
if type(parent) == 'string' then
|
||||
parent = rootWidget:recursiveGetChildById(parent)
|
||||
end
|
||||
parent:addChild(widget)
|
||||
end
|
||||
widget:setStyle(style)
|
||||
local widget = g_ui.createWidgetFromStyle(stylename, parent)
|
||||
--widget:setStyle(stylename)
|
||||
return widget
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user