Skip to content

Commit

Permalink
- Updated ImGui.Script, added ImGui demo for it.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zly-u committed Feb 17, 2024
1 parent 56873f2 commit 3411816
Show file tree
Hide file tree
Showing 2 changed files with 7,979 additions and 1 deletion.
30 changes: 29 additions & 1 deletion _Templates/ImGui_Script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,19 @@

-- @noindex

-- Allows to require scripts relatively to this current script's path.
local function get_script_path()
local filename = debug.getinfo(1, "S").source:match("^@?(.+)$")
return filename:match("^(.*)[\\/](.-)$")
end
local function add_to_package_path(subpath)
package.path = subpath .. "/?.lua;" .. package.path
end
add_to_package_path(get_script_path())

--[[===================================================]]--
--[[============== TEMP CODE FOR DEBUG ================]]--
--[[===================================================]]--
--[[vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv]]--

_G._print = print
_G.print = function(...)
Expand Down Expand Up @@ -57,6 +67,24 @@ local function printTable(t, show_details)
end
end

--[[===================================================]]--

do
local demo = require("ImGui_demo")
local demo_ctx = reaper.ImGui_CreateContext("Demo")
local function loop()
demo.PushStyle(demo_ctx)
demo.ShowDemoWindow(demo_ctx)
if reaper.ImGui_Begin(demo_ctx, "Dear ImGui Style Editor") then
demo.ShowStyleEditor(demo_ctx)
reaper.ImGui_End(demo_ctx)
end
demo.PopStyle(demo_ctx)
reaper.defer(loop)
end
reaper.defer(loop)
end

--[[===================================================]]--
--[[=================== HELPERS =======================]]--
--[[===================================================]]--
Expand Down
Loading

0 comments on commit 3411816

Please sign in to comment.