GithubHelp home page GithubHelp logo

apicici / cimgui-love Goto Github PK

View Code? Open in Web Editor NEW
75.0 75.0 6.0 708 KB

LÖVE module for Dear ImGui obtained by wrapping cimgui with LuaJIT FFI.

License: MIT License

Shell 0.14% Batchfile 0.11% Lua 99.75%

cimgui-love's People

Contributors

apicici avatar the-balthazar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cimgui-love's Issues

How to use PushFont?

I saw the README that telling me how to change the global default font.

If I just want to change a button font, I didn't find a way.

I have tried use PushFont, but it waill directly crash my game.


some crash log

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x00000000000002b8
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [2617]

VM Regions Near 0x2b8:
--> 
    __TEXT                 000000010d26e000-000000010d272000 [   16K] r-x/r-x SM=COW  /Applications/love.app/Contents/MacOS/love

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   cimgui.dylib                  	0x0000000113331a93 ImGui::PushFont(ImFont*) + 83
1   cimgui.dylib                  	0x00000001132febc5 igPushFont + 21
2   LuaJIT.LuaJIT                 	0x000000010d82ed4b 0x10d828000 + 27979
3   LuaJIT.LuaJIT                 	0x000000010d88e775 0x10d828000 + 419701

append font code to readme example , 'SFNS.ttf' is a MacOS font I copied from system Fonts folder

love.load = function()
    imgui.love.Init()

    local io = imgui.GetIO()
    local font = io.Fonts:AddFontFromFileTTF('SFNS.ttf', 16)
    imgui.love.BuildFontAtlas()
    imgui.PushFont(font)
end

ENV: cimgui-love 1.87-1
love2d: 11.4

FFI booleans doesn't work with imgui.Begin

When I change value of the boolean, or even create new boolean, imgui doesn't react to changes. But when I use FFI booleans with Checkbox, Checkbox works as expected.

love.load = function()
  imgui.love.Init()
  some_bool = ffi.new("bool[1]", true)
end

love.draw = function()
  print(some_bool[0]) -- prints value of boolean, when i click button its false, on startup its true
  if imgui.Begin("Test", some_bool) then
    if imgui.Button "Close" then
      some_bool = ffi.new("bool[1]", false)
      -- same
      -- some_bool[0] = false
    end

    imgui.End()
  end
  
  imgui.Render()
  imgui.love.RenderDrawLists()
end

ImGui.GetCursorScreenPos() returns wrong data (very close to 0)

Version 1.89.7
love 11.4
Given the following code

    imgui.Begin( self.txt ,nil)
    local sp = imgui.GetCursorScreenPos()
    local sc = imgui.GetContentRegionAvail()
    local mp = imgui.GetMousePos()

    if sc.x<50.0 then sc.x = 50 end
    if sc.y<50.0 then sc.y = 50 end
   imgui.InvisibleButton("canvas",sc,bit.bor(imgui.ImGuiButtonFlags_MouseButtonLeft,imgui.ImGuiButtonFlags_MouseButtonRight))
    local is_hovered = imgui.IsItemHovered()
    local is_active = imgui.IsItemActive()

    if imgui.IsMouseDown(0) then 
    	mouse_down = true
    end

    if imgui.IsMouseReleased(0) and mouse_down  and is_hovered then
        mouse_down = false
        points[#points+1] = { x= mp.x-sp.x,y= mp.y-sp.y }
    end

    local dl = imgui.GetWindowDrawList()
    dl:AddRect(
    	self.wp, 
    	imgui.ImVec2_Float(sp.x+sc.x, sp.y+sc.y), 
    	0xFFFF00FF
    )

    for j,v in ipairs(points) do
	    dl:AddCircleFilled(
	         imgui.ImVec2_Float(sp.x+v.x,sp.y+v.y),
	         5.0,
	         0xFFFF00FF,--color key error
	         12
    	)
    end
    imgui.End()
end

So the resulting is always (very close to) 0, basically. even when the drawinglist leng>5000 it will cause flicks

[Troubleshooting] Can't get cimgui-love set up on an m1 mac

I have not been able to get my love project to successfully load with cimgui-love.

  • I tried using the pre-built binary for Mac from the releases page. I got the following error:
Error: error loading module 'cimgui' from file 'imgui/cimgui.dylib':
        dlopen(imgui/cimgui.dylib, 0x0006): tried: '/Applications/love.app/Contents/MacOS/../Frameworks/imgui/cimgui.dylib' (no such file), '/Applications/love.app/Contents/MacOS/../Frameworks/imgui/cimgui.dylib' (no such file), 'imgui/cimgui.dylib' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e))), '/Users/javiermuhrer/things/whalin/imgui/cimgui.dylib' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))
  • Next, I tried compiling the library myself. I cloned the repo and cd'd into the cimgui subdirectory. I ran make and it generated a lot of errors:
c++ -O2 -fno-exceptions -fno-rtti -I/usr/local/include -Wall -c -o cimgui.o cimgui.cpp
In file included from cimgui.cpp:13:
././imgui/imgui.h:262:5: error: unknown type name 'constexpr'
    constexpr ImVec2()                      : x(0.0f), y(0.0f) { }
    ^
././imgui/imgui.h:262:15: error: constructor cannot have a return type
    constexpr ImVec2()                      : x(0.0f), y(0.0f) { }
              ^~~~~~
././imgui/imgui.h:263:5: error: unknown type name 'constexpr'
    constexpr ImVec2(float _x, float _y)    : x(_x), y(_y) { }
    ^
././imgui/imgui.h:263:15: error: constructor cannot have a return type
    constexpr ImVec2(float _x, float _y)    : x(_x), y(_y) { }
              ^~~~~~
././imgui/imgui.h:275:5: error: unknown type name 'constexpr'
    constexpr ImVec4()                                        : x(0.0f), y(0.0f), z(0.0f), w(0.0f) { }
    ^
././imgui/imgui.h:275:15: error: constructor cannot have a return type
    constexpr ImVec4()                                        : x(0.0f), y(0.0f), z(0.0f), w(0.0f) { }
              ^~~~~~
././imgui/imgui.h:276:5: error: unknown type name 'constexpr'
    constexpr ImVec4(float _x, float _y, float _z, float _w)  : x(_x), y(_y), z(_z), w(_w) { }
    ^
././imgui/imgui.h:276:15: error: constructor cannot have a return type
    constexpr ImVec4(float _x, float _y, float _z, float _w)  : x(_x), y(_y), z(_z), w(_w) { }
              ^~~~~~
././imgui/imgui.h:347:81: error: no matching constructor for initialization of 'ImVec2'
    IMGUI_API bool          BeginChild(const char* str_id, const ImVec2& size = ImVec2(0, 0), bool border = false, ImGuiWindowFlags flags = 0);
                                                                                ^      ~~~~
././imgui/imgui.h:259:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
struct ImVec2
       ^
././imgui/imgui.h:259:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 2 were provided
././imgui/imgui.h:348:73: error: no matching constructor for initialization of 'ImVec2'
    IMGUI_API bool          BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0, 0), bool border = false, ImGuiWindowFlags flags = 0);
                                                                        ^      ~~~~
././imgui/imgui.h:259:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
struct ImVec2
       ^
././imgui/imgui.h:259:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 2 were provided
././imgui/imgui.h:367:107: error: no matching constructor for initialization of 'ImVec2'
    IMGUI_API void          SetNextWindowPos(const ImVec2& pos, ImGuiCond cond = 0, const ImVec2& pivot = ImVec2(0, 0)); // set next window position. call before Begin(). use pivot=(0.5f,0.5f) to center on given point, etc.
                                                                                                          ^      ~~~~
././imgui/imgui.h:259:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
struct ImVec2
       ^
././imgui/imgui.h:259:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 2 were provided
././imgui/imgui.h:509:76: error: no matching constructor for initialization of 'ImVec2'
    IMGUI_API bool          Button(const char* label, const ImVec2& size = ImVec2(0, 0));   // button
                                                                           ^      ~~~~
././imgui/imgui.h:259:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
struct ImVec2
       ^
././imgui/imgui.h:259:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 2 were provided
././imgui/imgui.h:518:82: error: no matching constructor for initialization of 'ImVec2'
    IMGUI_API void          ProgressBar(float fraction, const ImVec2& size_arg = ImVec2(-FLT_MIN, 0), const char* overlay = NULL);
                                                                                 ^      ~~~~~~~~~~~
././imgui/imgui.h:259:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
struct ImVec2
       ^
././imgui/imgui.h:259:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 2 were provided
././imgui/imgui.h:523:104: error: no matching constructor for initialization of 'ImVec2'
    IMGUI_API void          Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), const ImVec4& tint_col = ImVec4(1, 1, 1, 1), const ImVec4& border_col = ImVec4(0, 0, 0, 0));
                                                                                                       ^      ~~~~
././imgui/imgui.h:259:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
struct ImVec2
       ^
././imgui/imgui.h:259:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 2 were provided
././imgui/imgui.h:523:138: error: no matching constructor for initialization of 'ImVec2'
    IMGUI_API void          Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), const ImVec4& tint_col = ImVec4(1, 1, 1, 1), const ImVec4& border_col = ImVec4(0, 0, 0, 0));
                                                                                                                                         ^      ~~~~
././imgui/imgui.h:259:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
struct ImVec2
       ^
././imgui/imgui.h:259:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 2 were provided
././imgui/imgui.h:523:177: error: no matching constructor for initialization of 'ImVec4'
    IMGUI_API void          Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), const ImVec4& tint_col = ImVec4(1, 1, 1, 1), const ImVec4& border_col = ImVec4(0, 0, 0, 0));
                                                                                                                                                                                ^      ~~~~~~~~~~
././imgui/imgui.h:272:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 4 were provided
struct ImVec4
       ^
././imgui/imgui.h:272:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 4 were provided
././imgui/imgui.h:523:224: error: no matching constructor for initialization of 'ImVec4'
    IMGUI_API void          Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), const ImVec4& tint_col = ImVec4(1, 1, 1, 1), const ImVec4& border_col = ImVec4(0, 0, 0, 0));
                                                                                                                                                                                                                               ^      ~~~~~~~~~~
././imgui/imgui.h:272:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 4 were provided
struct ImVec4
       ^
././imgui/imgui.h:272:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 4 were provided
././imgui/imgui.h:524:130: error: no matching constructor for initialization of 'ImVec2'
    IMGUI_API bool          ImageButton(const char* str_id, ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), const ImVec4& bg_col = ImVec4(0, 0, 0, 0), const ImVec4& tint_col = ImVec4(1, 1, 1, 1));
                                                                                                                                 ^      ~~~~
././imgui/imgui.h:259:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
struct ImVec2
       ^
././imgui/imgui.h:259:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 2 were provided
././imgui/imgui.h:524:164: error: no matching constructor for initialization of 'ImVec2'
    IMGUI_API bool          ImageButton(const char* str_id, ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), const ImVec4& bg_col = ImVec4(0, 0, 0, 0), const ImVec4& tint_col = ImVec4(1, 1, 1, 1));
                                                                                                                                                                   ^      ~~~~
././imgui/imgui.h:259:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
struct ImVec2
       ^
././imgui/imgui.h:259:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 2 were provided
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [cimgui.o] Error 1
  • Then, I tried building the Makefile myself using cmake CMakelists.txt. This seemed to work. I ran make again and this time it succeeded. I copied cimgui.dylib into my project directory under cimgui/cimgui.dylib and tried to load this from my project. I got the following error:
Error: error loading module 'cimgui' from file 'cimgui/cimgui.dylib':
        dlsym(0x20a1576a0, luaopen_cimgui): symbol not found

Some googling told me this might mean a mismatch between the LOVE version targeted in cimgui.dylib and my project, but I don't think this is the case. I'm running LOVE 11.4.

Any suggestions for how to troubleshoot this?

Could you create a font texture by r8 format and draw it with a shader?

C.ImFontAtlas_GetTexDataAsAlpha8(io.Fonts, pixels, width, height, nil)
local imgdata = love.image.newImageData(width[0], height[0], "r8", ffi.string(pixels[0], width[0]*height[0]))

local FontShader = love.graphics.newShader([[
    #pragma language glsl3

    vec4 effect(vec4 color, Image tex, vec2 tex_coord, vec2 sc) {
        float alpha = Texel(tex, tex_coord).r;
        return vec4(color.rgb, color.a * alpha);
    }
]])

It will save 3/4 font texture memory.

And, I think the textureObject rename to FontTextureObject is better.

"Invalid Draw Range" error when trying to use BeginPopupModal

Hello,

I'm working on porting an app from your earlier love-imgui library to cimgui-love, as the old library stopped working under LÖVE 11.4. It's been a bit of a learning curve as I am not very familiar with C or the FFI, but for the most part things have been going smoothly.

The first roadblock I've run into has been getting popups to work. If I define a new popup using the BeginPopupModal function, and attempt to open it using the OpenPopup_Str function, I get the following "Invalid Draw Range" error:

Error: cimgui/love.lua:189: Invalid draw range.
stack traceback:
	[love "boot.lua"]:345: in function <[love "boot.lua"]:341>
	[C]: in function 'setDrawRange'
	cimgui/love.lua:189: in function 'RenderDrawLists'
	main.lua:27: in function 'draw'
	[love "callbacks.lua"]:168: in function <[love "callbacks.lua"]:144>
	[C]: in function 'xpcall'

Here is a love.draw() method that raises the above error:

love.draw = function()
    if imgui.Begin("testing") then
        if imgui.Button("Open Popup") then
            imgui.OpenPopup_Str("Popup")
        end
        if imgui.BeginPopupModal("Popup") then
            imgui.Text("This is in a popup")
            imgui.EndPopup()
        end
    end
    imgui.End()

    -- code to render imgui
    imgui.Render()
    imgui.RenderDrawLists()
end

I'm not sure if this is a bug with the library, or if it's just something that I'm doing wrong. Interestingly, if I use BeginPopup instead of BeginPopupModal it works correctly (although the popup is not a modal window, which is what I want).

I'm using an Intel Mac running MacOS 12.1 and Love 11.4, with the cimgui-love 1.86-1 release.

Thanks so much for your hard work on this library (and the last one)!

Copy to clipboard causes panic

Having a fantastic time with this lib, it was very easy to set up and start using with my existing project. :)

I noticed that on the imgui demo window, some of the buttons that are (seemingly) supposed to copy things to the clipboard cause a crash.

PANIC: unprotected error in call to Lua API (bad callback)

To reproduce: show the demo window, Examples > Console, click Copy button.
I'm using the Windows x86 prebuilt from 1.83-1 release.

Huge and long lag spikes

There are large (up to hundreds of ms) and long (10-20 frames) lag spikes, probably caused by garbage collection of ImageDatas and Meshes. I did not manage to achieve this in the new project, but in my current project these lag spikes are noticeable even if I open the imgui demo window. The solution for me was to manually free the Meshes and create a new ImageData only when needed. You can check the changes in my fork, maybe you will find a better solution to this problem, but mine suits me.

local meshdata = love.image.newImageData(VtxSize/4, 1)

local mesh = love.graphics.newMesh(vertexformat, meshdata, "triangles", "static")

The love2d wiki doesn't recommend calling these functions every frame.

Silent crash with DrawList.AddImage()

Hi,

Love2D crash as soon as I try to draw an image via a DrawList in a window. Regular widgets (text, image, separator, etc) work fine.

Maybe I'm doing something wrong and there is actually no bugs, but without documentation regarding DrawList it's a bit hard to be sure if there should be specific setup compared to normal Imgui commands. Usually an incorrect setup lead to an Imgui assert or similar.

System and version:

  • Love2D version: 11.4
  • cimgui version: 1.88.2
  • OS: Linux x64 5.17.15-1-MANJARO
  • Graphics platform: X11
  • GPU: AMD Radeon RX 5600 XT (navi10, LLVM 14.0.6, DRM 3.44, 5.17.15-1-MANJARO) (0x731f)
  • Mesa version: 22.1.3

Steps to reproduce:

With the following script, Love2D starts but freeze before drawing anything and then crash without any callstack/imgui error message:

---------------------------------------------------------
-- Pre-Imgui setup
local lib_ext 	= ""
local lib_path 	= love.filesystem.getSource() .. "bin/"

if jit.os == "Windows" then
	lib_ext = "dll"
	lib_path = lib_path .. "win64"
else
	lib_ext = "so"
	lib_path = lib_path .. "linux"
end

package.cpath = string.format( "%s;%s/?.%s", package.cpath, lib_path, lib_ext )
---------------------------------------------------------
local IMGUI = require( "lib.cimgui" )
IMGUI.love.RevertToOldNames()

local CANVAS = -1

function love.load( Args )
	IMGUI.Init()

	local CanvasSettings = {
		["type"] = "2d",
		["format"]= "rgba16f",
		["readable"] = true,
		["msaa"] = 0,
		["dpiscale"] = 1.0,
		["mipmaps"] = "none"
	}

	CANVAS = love.graphics.newCanvas( 256, 32, CanvasSettings )
end

----------------------------------------
function love.update( DeltaTime )
	IMGUI.Update( DeltaTime )
	IMGUI.NewFrame()

	local Flags = IMGUI.WindowFlags(
		"NoMove",
		"NoResize",
		"NoTitleBar",
		"NoBackground",
		"NoScrollbar",
		"NoNav"
	)

	IMGUI.SetNextWindowPos( IMGUI.ImVec2_Float( 0.0, 0.0 ) )
	IMGUI.SetNextWindowSize( IMGUI.ImVec2_Float( 600, 300 ) )
	IMGUI.Begin( "Picker", nil, Flags )

	local DrawList = IMGUI.GetWindowDrawList()

	DrawList.AddImage(
		CANVAS,
		IMGUI.ImVec2_Float( 0.0, 0.0 ), -- Start
		IMGUI.ImVec2_Float( 256.0, 32.0 ), -- End
		IMGUI.ImVec2_Float( 0.0, 0.0 ), -- UV min
		IMGUI.ImVec2_Float( 1.0, 1.0 )  -- UV max
	)

	IMGUI.End()
end

----------------------------------------
function love.draw()
	love.graphics.setColor( 1, 1, 1, 1 )
	love.graphics.setShader()

	IMGUI.Render()
	IMGUI.RenderDrawLists()
end

function love.quit()
	IMGUI.Shutdown()
end

function love.keypressed( Key, ScanCode )
	IMGUI.KeyPressed( Key )
	if Key == "escape" then
		love.event.quit()
	end
end

DockBuilder methods not available

As the title says, none of the DockBuilder* methods are available to use. The referenced cimgui.h for the generator has them stripped out. Can these be added back in? I tried building the files myself with the official cimgui.h (with FILE stuff stripped out) and it's not working. Were these removed for a reason?

love.graphics.setColor affects cimgui-love

If you call love.graphics.setColor it will affect the color that cimgui-love renders on the next frame.

example issue image

See line 13 of the below code:

-- Make sure the shared library can be found through package.cpath before loading the module.
-- For example, if you put it in the LÖVE save directory, you could do something like this:
local lib_path = love.filesystem.getWorkingDirectory() .. "/lib"
local extension = jit.os == "Windows" and "dll" or jit.os == "Linux" and "so" or jit.os == "OSX" and "dylib"
package.cpath = string.format("%s;%s/?.%s", package.cpath, lib_path, extension)

local imgui = require "cimgui" -- cimgui is the folder containing the Lua module (the "src" folder in the github repository)

love.load = function()
  love.window.setMode(1920, 1080)
  imgui.love.Init() -- or imgui.love.Init("RGBA32") or imgui.love.Init("Alpha8")

  love.graphics.setBackgroundColor(0.41, 0.53, 0.97) --set the background color to a nice blue
end

love.draw = function()
  -- example window
  imgui.ShowDemoWindow()

  -- code to render imgui
  imgui.Render()
  imgui.love.RenderDrawLists()
  
  love.graphics.setColor(1,0,0,1) -- Causes weird issues
end

love.update = function(dt)
  imgui.love.Update(dt)
  imgui.NewFrame()
end

love.mousemoved = function(x, y, ...)
  imgui.love.MouseMoved(x, y)
  if not imgui.love.GetWantCaptureMouse() then
    -- your code here
  end
end

love.mousepressed = function(x, y, button, ...)
  imgui.love.MousePressed(button)
  if not imgui.love.GetWantCaptureMouse() then
    -- your code here 
  end
end

love.mousereleased = function(x, y, button, ...)
  imgui.love.MouseReleased(button)
  if not imgui.love.GetWantCaptureMouse() then
    -- your code here 
  end
end

love.wheelmoved = function(x, y)
  imgui.love.WheelMoved(x, y)
  if not imgui.love.GetWantCaptureMouse() then
    -- your code here 
  end
end

love.keypressed = function(key, ...)
  imgui.love.KeyPressed(key)
  if not imgui.love.GetWantCaptureKeyboard() then
    -- your code here 
  end
end

love.keyreleased = function(key, ...)
  imgui.love.KeyReleased(key)
  if not imgui.love.GetWantCaptureKeyboard() then
    -- your code here 
  end
end

love.textinput = function(t)
  imgui.love.TextInput(t)
  if imgui.love.GetWantCaptureKeyboard() then
    -- your code here 
  end
end

love.quit = function()
  return imgui.love.Shutdown()
end

-- for gamepad support also add the following:

love.joystickadded = function(joystick)
  imgui.love.JoystickAdded(joystick)
  -- your code here 
end

love.joystickremoved = function(joystick)
  imgui.love.JoystickRemoved()
  -- your code here 
end

love.gamepadpressed = function(joystick, button)
  imgui.love.GamepadPressed(button)
  -- your code here 
end

love.gamepadreleased = function(joystick, button)
  imgui.love.GamepadReleased(button)
  -- your code here 
end

-- choose threshold for considering analog controllers active, defaults to 0 if unspecified
local threshold = 0.2 

love.gamepadaxis = function(joystick, axis, value)
  imgui.love.GamepadAxis(axis, value, threshold)
  -- your code here 
end

90% of functions are broken or un documented

90% of functions are broken or there is no documentation on how to use them, not to mention that the error messages are useless.

For example: "Cannot convert number to 'float *'" what kind of error is that, a number is a float in lua

imgui.ColorPicker4("Color", 1.0,1.0,1.0)

Rounding property in styles does not affect windows

When setting the FrameRounding and GrabRounding style properties, only the docking icons that pop up seem to be affected.

local ImGui = require("lib.cimgui")
local style = ImGui.GetStyle();
style.FrameRounding = 20;
style.GrabRounding = 2;

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.