Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to draw icons and textures in ImGui menus #388

Merged
merged 6 commits into from
May 16, 2024

Conversation

WarZone762
Copy link
Contributor

@WarZone762 WarZone762 commented May 6, 2024

Initial draft for drawing icons and textures in ImGui menus.

Overview

Add 2 lua functions, AddImage and AddIcon, for drawing textures and icons
from their IDs.

Showcase

Code used:

W = Ext.IMGUI.NewWindow("Image and Icon Showcase")

W:AddText("A Random Noise Texture")
T = W:AddImage("019e6e85-0a62-7987-2196-0e77f7e107a8", 128, 256, 0, 0, 0.5, 1)
SWidth = W:AddSlider("Width")
SWidth.Value = { 128, 0, 0, 0 }
SWidth.Max = { 512, 0, 0, 0 }
SWidth.OnChange = function(_, x) T.Width = x[1] end
SHeight = W:AddSlider("Height")
SHeight.Value = { 256, 0, 0, 0 }
SHeight.Max = { 512, 0, 0, 0 }
SHeight.OnChange = function(_, x) T.Height = x[1] end
SU1 = W:AddSlider("U1")
SU1.Value = { 0, 0, 0, 0 }
SU1.OnChange = function(_, x) T.U1 = x[1] end
SV1 = W:AddSlider("V1")
SV1.Value = { 0, 0, 0, 0 }
SV1.OnChange = function(_, x) T.V1 = x[1] end
SU2 = W:AddSlider("U2")
SU2.Value = { 0.5, 0, 0, 0 }
SU2.OnChange = function(_, x) T.U2 = x[1] end
SV2 = W:AddSlider("V2")
SV2.Value = { 1, 0, 0, 0 }
SV2.OnChange = function(_, x) T.V2 = x[1] end

Icons = {}

local templates = Ext.Template.GetAllRootTemplates();
for _, v in pairs(templates) do
    if #Icons >= 20 then break end
    if v.TemplateType == "item" then
        table.insert(Icons, v)
    end
end

for _, v in pairs(Icons) do
    W:AddIcon(v.Icon)
    W:AddText(v.Name).SameLine = true
end
bg3-texture-showcase.mp4

@WarZone762 WarZone762 changed the title Add the ability to draw icons and textures in ImGui menus for Vulkan Add the ability to draw icons and textures in ImGui menus May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants