g_imgui

All of these functions can only be executed within a D3D hook. https://github.com/ocornut/imgui

function myButtonCallback()
	g_logger.log_info("Callback called")
end

function myToggleCallback(value)
	myBool = value
end

function myD3DHook()
	if g_gui.is_open() then
		g_imgui.set_next_window_size(vec2(400, 600))
		if  g_imgui.begin_window("Test Window", ImGuiWindowFlags_NoResize) then
			g_imgui.begin_child("Test Child", vec2(), true)
			g_imgui.add_button("Test Button", vec2(), myButtonCallback)
			g_imgui.add_checkbox("Test Checkbox", myToggleCallback)
			
			if g_imgui.add_button("Test Button 2", vec2(), function() g_logger.log_info("Callback in scripting thread") end) then
                		g_logger.log_info("Pressed")
            		end 	
			
			g_imgui.end_child()
			g_imgui.end_window()	
		end
	end

	if myBool then
		g_imgui.add_circle_filled(g_imgui.get_display_size() / 2, 50.0, 105, 205, 255)
		g_imgui.add_line(vec2(), g_imgui.get_display_size(), 45, 155, 255)
	end
end

g_lua.register();

id = g_hooking.register_D3D_hook(myD3DHook);

while g_isRunning do
	g_util.yield(100)
end

g_hooking.unregister_hook(id);
g_lua.unregister();

Last updated