Vein is a FiveM IMGUI framework.
It’s written on Lua and makes use of exports to be obtainable for different sources.
Showcase
Getting Started
-
Download and put into
sources/
listing - Add
guarantee vein
toserver.cfg
Usage
Vein is responsible for layouting/drawing UI and input handling only.
Organizing and managing data for it is user task as a programmer.
Here is the example to illustrate IMGUI concepts:
local vein = exports.vein -- Store it in local variable for performance reasons
while true do
Citizen.Wait(0)
vein:beginWindow() -- Mandatory
-- Draw widgets in column
if vein:button('Press Me Carefully!') then -- Draw button and check if it were pressed
break
end
vein:beginRow()
-- Draw widgets in row
vein:endRow()
vein:endWindow() -- Mandatory
end
Check this repository to study extra from Vein demo.
Limitations
These features are not supported due to RAGE API limitations:
- Clipping
- Rotation
- Circle drawing
These features are not supported by design (can be a subject to change though):
- Custom widget sizes (Vein is out-of-box solution)
- Custom widget colors (Vein tries to be close to FiveM color style and provides dark/light color themes)
- Nested rows
API
General
setDebugEnabled([enabled])
local isEnabled --[[boolean]] = isDebugEnabled()
beginWindow()
endWindow()
Layout
beginRow()
endRow()
spacing([count]) -- Horizontal if in row mode, otherwise vertical
Color Themes
setDarkColorTheme()
setLightColorTheme()
Widgets
pushTextEntry(entry, ...) -- Apply specified text entry until popTextEntry() will be called
popTextEntry()
pushWidgetWidth(w) -- Apply specified width until popWidgetWidth() will be called
popWidgetWidth()
local hasPressed --[[boolean]] = button([text])
local hasChecked --[[boolean]] = checkBox(isChecked [, text])
dummy(w, h)
heading([text])
label([text])
progressBar(min, value, max [, w]) -- Requires to specify width or use pushWidgetWidth(w)
separator([w])
local hasValueChanged --[[boolean]], value --[[number]] = slider(min, value, max [, w]) -- Requires to specify width or use pushWidgetWidth(w)
sprite(dict, name, w, h)
local hasPressed --[[boolean]] = spriteButton(dict, name [, text])
local hasTextChanged --[[boolean]], text --[[string]] = textEdit(text, keyboardTitle, maxTextLength [, isSecretMode])