-
Notifications
You must be signed in to change notification settings - Fork 10
Elements
Depso edited this page Dec 25, 2024
·
15 revisions
✨ Read the getting started here
Roblox properties are merged with the configuration of an element.
Label = string
-
Format = "%.d"
- :format Documentation (Value, MaxValue) Value = 0
MinValue = int
MaxValue = int
ReadOnly = false
:SetValue(Value: int)
:FireCallback(...)
:SetCallback(Callback: function)
Tab:Slider({
Label = "Slider",
Format = "%.d/%s",
Value = 5,
MinValue = 1,
MaxValue = 32,
Callback = function(self, Value)
print(self.Name, Value)
end,
})
Same methods and properties as a Slider
Tab:ProgressSlider({
Label = "Progress Slider",
Value = 8,
MinValue = 1,
MaxValue = 32,
})
Inherited methods and properties from a Slider
:SetPercentage(Percentage: float/int)
local ProgressBar = Tab:ProgressBar({
Label = "Loading...",
Percentage = 80
})
spawn(function()
local Percentage = 0
while wait(.02) do
Percentage += 1
ProgressBar:SetPercentage(Percentage % 100)
end
end)
Value = false
Callback = function
Label = string
:SetTicked(Value: boolean)
:Toggle()
:FireCallback(...)
:SetCallback(Callback: function)
Tab:Checkbox({
Label = "Check box",
Value = true,
Callback = function(self, Value)
print(self.Name, Value)
end,
})
Inherited methods and properties from a Checkbox
Tab:RadioButton({
Label = "Radio button",
Value = true,
Callback = function(self, Value)
print(self.Name, Value)
end,
})
-
Clone = false
(Otherwise will parent) Model = Model
:SetModel(Model: Model, PivotTo?: CFrame): Model
:SetCamera(Camera: Camera)
local RunService = game:GetService("RunService")
local Viewport = Tab:Viewport({
Size = UDim2.new(1, 0, 0, 200),
Clone = true, --// Otherwise will parent
Model = Rig,
Border = false
})
local NewRig = Viewport:SetModel(Rig, CFrame.new(0, -2.5, -5))
--// Spin rig
RunService.RenderStepped:Connect(function(deltaTime)
local YRotation = 30 * deltaTime
local cFrame = NewRig:GetPivot() * CFrame.Angles(0,math.rad(YRotation),0)
NewRig:PivotTo(cFrame)
end)
Label = string
IgnoreGameProcessed = false?
Callback = function
Value = Enum.KeyCode?
NullKey = Enum.KeyCode.Backspace
:SetValue(Key: Enum.Keycode)
:FireCallback(...)
:SetCallback(Callback: function)
local Checkbox = Tab:Checkbox({
Label = "Check box",
Value = true
})
Tab:Keybind({
Label = "Toggle checkbox",
Value = Enum.KeyCode.Q,
Callback = function(self, KeyCode)
print("Activated:", KeyCode)
Checkbox :Toggle()
end,
})
ReadOnly = false
LineNumbers = false
Border = true
Fill = false
RichText = false
TextWrapped = false
AutoScroll = false
Enabled = false
MaxLines = 100
:Clear()
:AppendText(...)
:UpdateLineNumbers()
:UpdateScroll()
:SetText(Value: string)
local Console = Tab:Console({
Text = "Console example",
ReadOnly = true,
Border = false,
Fill = true,
RichText = true,
Enabled = true,
AutoScroll = true,
MaxLines = 50
})
Tab:Button({ --// Toggle to enable the console
Text = "Pause",
Callback = function(self)
local Paused = shared.Pause
Paused = not (Paused or false)
shared.Pause = Paused
self.Text = Paused and "Paused" or "Pause"
Console.Enabled = not Paused
end,
})
spawn(function()
while wait() do
Console:AppendText( --// Passed parameters will be concatenated
`<font color="rgb(240, 40, 10)">[Random Math]</font>`,
math.random()
)
end
end)
-
Text = string
(Roblox property) Callback = function
:FireCallback(...)
:SetCallback(Callback: function)
Tab:Button({
Text = "Enter",
Callback = function(self)
print("Hello world from", self.Name)
end,
})
Spacing = int
:Fill()
local ButtonsRow = Tab:Row()
for i = 1,5 do
ButtonsRow:Button({
Text = "Hello"
})
end
ButtonsRow:Fill()
-
Text = string
(Roblox property) -
RichText = false
(Roblox property) -
TextWrapped = false
(Roblox property)
Tab:Label({
Text = "Hello from Depso's ImGui!"
})
-
Text = string
(Roblox property)
Tab:Separator({
Text = "Console Example:"
})
Tab:Separator()
Title = string
NoAnimation = false
Open = false
-
Image = string
(Example: rbxassetid://6403436054)
local Header = Tab:CollapsingHeader({
Title = "Click me"
})
Header:Label({
Text = "Boo! 👻"
})
Inherited methods and properties from a CollapsingHeader
local TreeNode = Tab:TreeNode({
Title = "Tree node",
})
TreeNode:Label({
Text = "Hello from Depso's ImGui!"
})
Image = int/string
Callback = function
:FireCallback(...)
:SetCallback(Callback: function)
Tab:Image({
Image = 8825666803,
Ratio = 16 / 9,
AspectType = Enum.AspectType.FitWithinMaxSize,
Size = UDim2.fromScale(1, 1)
})
Border = true
Fill = false
RowBackground = false
RowsFill = false
-
Align = "Center"
(Enum.VerticalAlignment)
:ClearRows()
:UpdateRows()
local Table = Tab:Table({
RowBackground = true,
Border = true,
RowsFill = false,
Size = UDim2.fromScale(1, 0)
})
coroutine.wrap(function()
local Rows = 10
local random = Random.new()
while wait(1) do
Table:ClearRows()
for i = 1,Rows do
local Row = Table:CreateRow()
local Columns = random:NextInteger(1, 8)
for x = 1, Columns do
local Column = Row:CreateColumn()
Column:Label({
Text = `#{x}`
})
end
end
end
end)()
Placeholder = string
Callback = function
Items = Dict/Array
NoAnimation = false
-
Value = string
(Previously .Selected)
:SetOpen(Open: boolean)
:SetValue(Item: string)
:GetValue()
:FireCallback(...)
:SetCallback(Callback: function)
Tab:Combo({
Selected = "Car", --// Cancels Placeholder
Label = "Vehicle",
Items = {
"Car",
"Bus",
"Train",
"Plane",
"Boat"
},
Callback = function(self, Value)
print("Selected:", Value)
end,
})
Tab:Combo({
Placeholder = "Select object",
Label = "Food",
Items = {
["Apple"] = "Good",
["Banana"] = "Bad",
["Mango"] = "Okay"
},
Callback = function(self, Value)
print("Selected:", Value, "Value:", self.Items[Value])
end,
})
Inherited properties from a Window
Inherited methods from a Tab
local ModalWindow = ImGui:CreateModal({ --// Returns a Tab class
Title = "Modal Example",
AutoSize = "Y"
})
ModalWindow:Label({
Text = "Hello, this is a modal."
})
ModalWindow:Separator()
ModalWindow:Button({
Text = "Okay",
Callback = function()
ModalWindow:Close()
end,
})