{"id":13526427,"url":"https://github.com/slages/love-imgui","last_synced_at":"2025-04-01T07:32:33.706Z","repository":{"id":54429861,"uuid":"63331069","full_name":"slages/love-imgui","owner":"slages","description":"imgui module for the LÖVE game engine","archived":false,"fork":false,"pushed_at":"2023-12-03T04:30:39.000Z","size":778,"stargazers_count":315,"open_issues_count":26,"forks_count":62,"subscribers_count":19,"default_branch":"master","last_synced_at":"2024-08-02T06:20:56.712Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/slages.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2016-07-14T11:27:01.000Z","updated_at":"2024-07-23T11:50:54.000Z","dependencies_parsed_at":"2024-04-12T03:03:11.395Z","dependency_job_id":null,"html_url":"https://github.com/slages/love-imgui","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slages%2Flove-imgui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slages%2Flove-imgui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slages%2Flove-imgui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slages%2Flove-imgui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slages","download_url":"https://codeload.github.com/slages/love-imgui/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222709602,"owners_count":17026763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T06:01:29.554Z","updated_at":"2024-11-02T11:30:59.623Z","avatar_url":"https://github.com/slages.png","language":"C++","funding_links":[],"categories":["C++","UI"],"sub_categories":[],"readme":"# LOVE-IMGUI\n\n[imgui](https://github.com/ocornut/imgui) module for the [LÖVE](https://love2d.org/) game engine including lua bindings based on this [project](https://github.com/patrickriordan/imgui_lua_bindings).\n**The main difference is that now by default in this version the return values ordering is reverted.** For instance to retrieve the value from a slider, you need to do:\n```lua\nfloatValue, status = imgui.SliderFloat(\"SliderFloat\", floatValue, 0.0, 1.0);\n```\nOr if you're not interested to know if the field was modified, just:\n```lua\nfloatValue = imgui.SliderFloat(\"SliderFloat\", floatValue, 0.0, 1.0);\n```\nTo reverse this behavior and receive back the return values from a function first before the modified fields, just call at the beginning of your application:\n```lua\nimgui.SetReturnValueLast(false)\n```\n\nAnother notable difference is that enum values are handled using strings (and array of strings) instead of numerical values, for instance to create a window:\n```lua\nimgui.Begin(\"Test Window\", true, { \"ImGuiWindowFlags_AlwaysAutoResize\", \"ImGuiWindowFlags_NoTitleBar\" });\n```\nOr for a single flag:\n```lua\nimgui.Begin(\"Test Window\", true, \"ImGuiWindowFlags_AlwaysAutoResize\");\n```\n\nIt uses imgui 1.53 and supports 275 functions (43 unsupported), and is based on LÖVE 11.1.\n\nIt also includes the docks extension by @adcox (https://github.com/adcox/imgui) (it's deprecated and will be replaced by imgui native dock management as soon as it's available).\n\n## Getting Started\n\nJust build the project, and copy the generated dynamic module next to your love executable or into the LÖVE application data folder (for instance \"C:/Users/\u003cuser\u003e/AppData/Roaming/LOVE\" on Windows or ~/.local/shared/love on Linux).\n\nPre-built binaries for Windows and Mas OSX are provided in the [releases](https://github.com/slages/love-imgui/releases) page.\n\n## Examples\n\nSimple integration:\n```lua\nrequire \"imgui\"\n\nlocal showTestWindow = false\nlocal showAnotherWindow = false\nlocal floatValue = 0;\nlocal sliderFloat = { 0.1, 0.5 }\nlocal clearColor = { 0.2, 0.2, 0.2 }\nlocal comboSelection = 1\nlocal textValue = \"text\"\n\n--\n-- LOVE callbacks\n--\nfunction love.load(arg)\nend\n\nfunction love.update(dt)\n    imgui.NewFrame()\nend\n\nfunction love.draw()\n\n    -- Menu\n    if imgui.BeginMainMenuBar() then\n        if imgui.BeginMenu(\"File\") then\n            imgui.MenuItem(\"Test\")\n            imgui.EndMenu()\n        end\n        imgui.EndMainMenuBar()\n    end\n\n    -- Debug window\n    imgui.Text(\"Hello, world!\");\n    clearColor[1], clearColor[2], clearColor[3] = imgui.ColorEdit3(\"Clear color\", clearColor[1], clearColor[2], clearColor[3]);\n    \n    -- Sliders\n    floatValue = imgui.SliderFloat(\"SliderFloat\", floatValue, 0.0, 1.0);\n    sliderFloat[1], sliderFloat[2] = imgui.SliderFloat2(\"SliderFloat2\", sliderFloat[1], sliderFloat[2], 0.0, 1.0);\n    \n    -- Combo\n    comboSelection = imgui.Combo(\"Combo\", comboSelection, { \"combo1\", \"combo2\", \"combo3\", \"combo4\" }, 4);\n\n    -- Windows\n    if imgui.Button(\"Test Window\") then\n        showTestWindow = not showTestWindow;\n    end\n    \n    if imgui.Button(\"Another Window\") then\n        showAnotherWindow = not showAnotherWindow;\n    end\n    \n    if showAnotherWindow then\n        imgui.SetNextWindowPos(50, 50, \"ImGuiCond_FirstUseEver\")\n        showAnotherWindow = imgui.Begin(\"Another Window\", true, { \"ImGuiWindowFlags_AlwaysAutoResize\", \"ImGuiWindowFlags_NoTitleBar\" });\n        imgui.Text(\"Hello\");\n        -- Input text\n        textValue = imgui.InputTextMultiline(\"InputText\", textValue, 200, 300, 200);\n        imgui.End();\n    end\n\n    if showTestWindow then\n        showTestWindow = imgui.ShowDemoWindow(true)\n    end\n\n    love.graphics.clear(clearColor[1], clearColor[2], clearColor[3])\n    imgui.Render();\nend\n\nfunction love.quit()\n    imgui.ShutDown();\nend\n\n--\n-- User inputs\n--\nfunction love.textinput(t)\n    imgui.TextInput(t)\n    if not imgui.GetWantCaptureKeyboard() then\n        -- Pass event to the game\n    end\nend\n\nfunction love.keypressed(key)\n    imgui.KeyPressed(key)\n    if not imgui.GetWantCaptureKeyboard() then\n        -- Pass event to the game\n    end\nend\n\nfunction love.keyreleased(key)\n    imgui.KeyReleased(key)\n    if not imgui.GetWantCaptureKeyboard() then\n        -- Pass event to the game\n    end\nend\n\nfunction love.mousemoved(x, y)\n    imgui.MouseMoved(x, y)\n    if not imgui.GetWantCaptureMouse() then\n        -- Pass event to the game\n    end\nend\n\nfunction love.mousepressed(x, y, button)\n    imgui.MousePressed(button)\n    if not imgui.GetWantCaptureMouse() then\n        -- Pass event to the game\n    end\nend\n\nfunction love.mousereleased(x, y, button)\n    imgui.MouseReleased(button)\n    if not imgui.GetWantCaptureMouse() then\n        -- Pass event to the game\n    end\nend\n\nfunction love.wheelmoved(x, y)\n    imgui.WheelMoved(y)\n    if not imgui.GetWantCaptureMouse() then\n        -- Pass event to the game\n    end\nend\n```\n\nDocks:\n```lua\nrequire \"imgui\"\n\n--\n-- LOVE callbacks\n--\nfunction love.load(arg)\nend\n\nfunction love.update(dt)\n    imgui.NewFrame()\nend\n\nfunction love.draw()\n    imgui.SetNextWindowPos(0, 0)\n    imgui.SetNextWindowSize(love.graphics.getWidth(), love.graphics.getHeight())\n    if imgui.Begin(\"DockArea\", nil, { \"ImGuiWindowFlags_NoTitleBar\", \"ImGuiWindowFlags_NoResize\", \"ImGuiWindowFlags_NoMove\", \"ImGuiWindowFlags_NoBringToFrontOnFocus\" }) then\n        imgui.BeginDockspace()\n\n        -- Create 10 docks\n        for i = 1, 10 do\n            if imgui.BeginDock(\"dock_\"..i) then\n                imgui.Text(\"Hello, dock \"..i..\"!\");\n            end\n            imgui.EndDock()\n        end\n\n        imgui.EndDockspace()\n    end\n    imgui.End()\n\n    love.graphics.clear(0.2, 0.2, 0.2)\n    imgui.Render();\nend\n\nfunction love.quit()\n    imgui.ShutDown();\nend\n\n--\n-- User inputs\n--\nfunction love.textinput(t)\n    imgui.TextInput(t)\nend\n\nfunction love.keypressed(key)\n    imgui.KeyPressed(key)\nend\n\nfunction love.keyreleased(key)\n    imgui.KeyReleased(key)\nend\n\nfunction love.mousemoved(x, y)\n    imgui.MouseMoved(x, y)\nend\n\nfunction love.mousepressed(x, y, button)\n    imgui.MousePressed(button)\nend\n\nfunction love.mousereleased(x, y, button)\n    imgui.MouseReleased(button)\nend\n\nfunction love.wheelmoved(x, y)\n    imgui.WheelMoved(y)\nend\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslages%2Flove-imgui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslages%2Flove-imgui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslages%2Flove-imgui/lists"}