A unified system for managing multiple drawtext resources.
Each supported resource is organized into a table of handlers, with functions for show
and hide
operations.
This approach enables easy integration and switching between resources.
Developers can simply extend the handlers
table to add support for additional resources if required.
Copy local handlers = {
default = {
show = function ( options )
TriggerEvent ( 'boii_utils:show_drawtext' , options)
end ,
hide = function ()
TriggerEvent ( 'boii_utils:hide_drawtext' , options)
end
},
boii_ui = {
show = function ( options )
exports.boii_ui: show_drawtext (options.header, options.message, options.icon)
end ,
hide = function ()
exports.boii_ui: hide_drawtext ()
end
},
ox_lib = {
show = function ( options )
lib. showTextUI (options.message, { icon = options.icon })
end ,
hide = function ()
lib. hideTextUI ()
end
},
[ 'qb-core' ] = {
show = function ( options )
exports[ 'qb-core' ]: DrawText (options.message)
end ,
hide = function ()
exports[ 'qb-core' ]: HideText ()
end
},
es_extended = {
show = function ( options )
exports.es_extended: TextUI (options.message)
end ,
hide = function ()
exports.es_extended: HideUI ()
end
},
okokTextUI = {
show = function ( options )
exports[ 'okokTextUI' ]: Open (options.message, 'lightgrey' , 'left' , true )
end ,
hide = function ()
exports[ 'okokTextUI' ]: Close ()
end
},
--- Add other resources here
custom = {
show = function ( options )
--- Add custom implementation here
end ,
hide = function ()
--- Add custom implementation here
end
}
}
Used to show the chosen drawtext ui, if handler is missing or not provided will default to boii_ui
Copy --- Utils object
utils.ui. show_drawtext ({
header = 'Test Drawtext' ,
message = 'Just another test..' ,
icon = 'fa-solid fa-gear'
})
--- Direct export
exports.boii_utils: show_drawtext ( ... )
Used to hide the current shown drawtext ui.
Copy --- Utils object
utils.ui. hide_drawtext ({
header = 'Test Drawtext' ,
message = 'Just another test..' ,
icon = 'fa-solid fa-gear'
})
--- Direct export
exports.boii_utils: hide_drawtext ( ... )