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

Compilation and usage for LOVE2D #20

Closed
GeTechG opened this issue Aug 14, 2020 · 31 comments
Closed

Compilation and usage for LOVE2D #20

GeTechG opened this issue Aug 14, 2020 · 31 comments

Comments

@GeTechG
Copy link

GeTechG commented Aug 14, 2020

Can you please give instructions on how to compile for linux?

@sonoro1234
Copy link
Owner

sonoro1234 commented Aug 14, 2020

From a sibling folder to the repo folder

cmake  -DCMAKE_BUILD_TYPE=RelWithDebInfo -DGLFW_PATH="Where to find GLFW package" -DIMPL_GLFW=yes -DIMPL_OPENGL2=yes -DIMPL_OPENGL3=yes -DIMPL_EXTRAS=yes -DLUAJIT_BIN="where LuaJIT is" ../luajit-imgui

make install

but if you use https://github.com/sonoro1234/anima it will build GLFW, SDL and LuaJIT-ImGui for you

@GeTechG
Copy link
Author

GeTechG commented Aug 14, 2020

Okay, honestly, I rarely collect anything because it's hard. What's an anima? I don't know what to do with it, so I need to clarify it for SDL2. If it's not difficult, how do you build it in more detail?

@sonoro1234
Copy link
Owner

https://github.com/sonoro1234/anima is my repo for working with opengl.
You should clone it.
From a sibling folder type
cmake -DLUAJIT_BIN="where you want to install everything" ../anima
make install

@GeTechG
Copy link
Author

GeTechG commented Aug 14, 2020

Okay, thanks, maybe I'll figure it out later, but I couldn't. Here's the conclusion. Maybe I should specify luajit in DLUAJIT_BIN, I did it in an empty folder.

cmake -DLUAJIT_BIN="./" ../anima
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:70 (add_subdirectory):
  The source directory

    /home/sergey/LuaTextureEditor/anima/mirror-im

  does not contain a CMakeLists.txt file.


CMake Error at /usr/share/cmake-3.16/Modules/ExternalProject.cmake:2630 (message):
  No download info given for 'project_luajit' and its source directory:

   /home/sergey/LuaTextureEditor/anima/LuaJIT/LuaJIT

  is not an existing non-empty directory.  Please specify one of:

   * SOURCE_DIR with an existing non-empty directory
   * DOWNLOAD_COMMAND
   * URL
   * GIT_REPOSITORY
   * SVN_REPOSITORY
   * HG_REPOSITORY
   * CVS_REPOSITORY and CVS_MODULE
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/ExternalProject.cmake:3236 (_ep_add_download_command)
  LuaJIT/CMakeLists.txt:14 (ExternalProject_Add)


CMake Error at CMakeLists.txt:93 (add_subdirectory):
  The source directory

    /home/sergey/LuaTextureEditor/anima/LuaJIT-SDL2

  does not contain a CMakeLists.txt file.


CMake Error at CMakeLists.txt:111 (add_subdirectory):
  The source directory

    /home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui

  does not contain a CMakeLists.txt file.


CMake Error at CMakeLists.txt:120 (add_subdirectory):
  The source directory

    /home/sergey/LuaTextureEditor/anima/luajit-async

  does not contain a CMakeLists.txt file.


-- Found OpenMP_C: -fopenmp (found version "4.5") 
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5")  
-- openmp flags-fopenmp-fopenmp
-- Found OpenMP_C: -fopenmp  
-- Found OpenMP_CXX: -fopenmp  
-- Found OpenMP: TRUE   
-- Configuring incomplete, errors occurred!
See also "/home/sergey/LuaTextureEditor/build/CMakeFiles/CMakeOutput.log".

@sonoro1234
Copy link
Owner

sonoro1234 commented Aug 14, 2020

When you clone the repo you should do it recursively to also clone the git submodules.

For LUAJIT_BIN use ""/home/sergey/anima" for example

@GeTechG
Copy link
Author

GeTechG commented Aug 14, 2020

Okay, I did the first item, some files were not found there, but it went well. And "make install" at the end gave me errors.

[ 95%] Building CXX object LuaJIT-ImGui/CMakeFiles/cimgui_sdl.dir/cimplot/cimplot.cpp.o
In file included from /home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp:5:
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.h:196:12: error: ‘ImPlotInputMap’ does not name a type
  196 | CIMGUI_API ImPlotInputMap* ImPlotInputMap_ImPlotInputMap(void);
      |            ^~~~~~~~~~~~~~
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.h:197:40: error: variable or field ‘ImPlotInputMap_destroy’ declared void
  197 | CIMGUI_API void ImPlotInputMap_destroy(ImPlotInputMap* self);
      |                                        ^~~~~~~~~~~~~~
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.h:197:40: error: ‘ImPlotInputMap’ was not declared in this scope
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.h:197:56: error: ‘self’ was not declared in this scope
  197 | CIMGUI_API void ImPlotInputMap_destroy(ImPlotInputMap* self);
      |                                                        ^~~~
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.h:253:12: error: ‘ImPlotInputMap’ does not name a type
  253 | CIMGUI_API ImPlotInputMap* ImPlot_GetInputMap(void);
      |            ^~~~~~~~~~~~~~
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp:61:12: error: ‘ImPlotInputMap’ does not name a type
   61 | CIMGUI_API ImPlotInputMap* ImPlotInputMap_ImPlotInputMap(void)
      |            ^~~~~~~~~~~~~~
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp:65:40: error: variable or field ‘ImPlotInputMap_destroy’ declared void
   65 | CIMGUI_API void ImPlotInputMap_destroy(ImPlotInputMap* self)
      |                                        ^~~~~~~~~~~~~~
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp:65:40: error: ‘ImPlotInputMap’ was not declared in this scope
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp:65:56: error: ‘self’ was not declared in this scope
   65 | CIMGUI_API void ImPlotInputMap_destroy(ImPlotInputMap* self)
      |                                                        ^~~~
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp: In function ‘void ImPlot_PlotShadedFloatPtrFloatPtrFloatPtr(const char*, const float*, const float*, const float*, int, int, int)’:
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp:135:20: error: ‘PlotShaded’ is not a member of ‘ImPlot’
  135 |     return ImPlot::PlotShaded(label_id,xs,ys1,ys2,count,offset,stride);
      |                    ^~~~~~~~~~
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp:135:70: error: return-statement with a value, in function returning ‘void’ [-fpermissive]
  135 |     return ImPlot::PlotShaded(label_id,xs,ys1,ys2,count,offset,stride);
      |                                                                      ^
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp: In function ‘void ImPlot_PlotShadeddoublePtrdoublePtrdoublePtr(const char*, const double*, const double*, const double*, int, int, int)’:
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp:139:20: error: ‘PlotShaded’ is not a member of ‘ImPlot’
  139 |     return ImPlot::PlotShaded(label_id,xs,ys1,ys2,count,offset,stride);
      |                    ^~~~~~~~~~
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp:139:70: error: return-statement with a value, in function returning ‘void’ [-fpermissive]
  139 |     return ImPlot::PlotShaded(label_id,xs,ys1,ys2,count,offset,stride);
      |                                                                      ^
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp: In function ‘void ImPlot_PlotShadedFloatPtrFloatPtrIntFloat(const char*, const float*, const float*, int, float, int, int)’:
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp:143:20: error: ‘PlotShaded’ is not a member of ‘ImPlot’
  143 |     return ImPlot::PlotShaded(label_id,xs,ys,count,y_ref,offset,stride);
      |                    ^~~~~~~~~~
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp:143:71: error: return-statement with a value, in function returning ‘void’ [-fpermissive]
  143 |     return ImPlot::PlotShaded(label_id,xs,ys,count,y_ref,offset,stride);
      |                                                                       ^
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp: In function ‘void ImPlot_PlotShadeddoublePtrdoublePtrIntdouble(const char*, const double*, const double*, int, double, int, int)’:
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp:147:20: error: ‘PlotShaded’ is not a member of ‘ImPlot’
  147 |     return ImPlot::PlotShaded(label_id,xs,ys,count,y_ref,offset,stride);
      |                    ^~~~~~~~~~
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp:147:71: error: return-statement with a value, in function returning ‘void’ [-fpermissive]
  147 |     return ImPlot::PlotShaded(label_id,xs,ys,count,y_ref,offset,stride);
      |                                                                       ^
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp: In function ‘bool ImPlot_IsPlotXAxisHovered()’:
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp:263:20: error: ‘IsPlotXAxisHovered’ is not a member of ‘ImPlot’; did you mean ‘IsPlotHovered’?
  263 |     return ImPlot::IsPlotXAxisHovered();
      |                    ^~~~~~~~~~~~~~~~~~
      |                    IsPlotHovered
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp: In function ‘bool ImPlot_IsPlotYAxisHovered(int)’:
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp:267:20: error: ‘IsPlotYAxisHovered’ is not a member of ‘ImPlot’; did you mean ‘IsPlotHovered’?
  267 |     return ImPlot::IsPlotYAxisHovered(y_axis);
      |                    ^~~~~~~~~~~~~~~~~~
      |                    IsPlotHovered
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp: In function ‘bool ImPlot_IsLegendEntryHovered(const char*)’:
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp:287:20: error: ‘IsLegendEntryHovered’ is not a member of ‘ImPlot’
  287 |     return ImPlot::IsLegendEntryHovered(label_id);
      |                    ^~~~~~~~~~~~~~~~~~~~
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp: At global scope:
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimplot/cimplot.cpp:289:12: error: ‘ImPlotInputMap’ does not name a type
  289 | CIMGUI_API ImPlotInputMap* ImPlot_GetInputMap()
      |            ^~~~~~~~~~~~~~
make[2]: *** [LuaJIT-ImGui/CMakeFiles/cimgui_sdl.dir/build.make:128: LuaJIT-ImGui/CMakeFiles/cimgui_sdl.dir/cimplot/cimplot.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:639: LuaJIT-ImGui/CMakeFiles/cimgui_sdl.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

@sonoro1234
Copy link
Owner

implot source was not up to date.
Now corrected.
do a new clone and try again please

@GeTechG
Copy link
Author

GeTechG commented Aug 15, 2020

Now it was 96% I decided to restart, but it didn't help.

[ 94%] Building C object LuaJIT-ImGui/CMakeFiles/cimgui_sdl.dir/cimgui/imgui/examples/libs/gl3w/GL/gl3w.c.o
/home/sergey/LuaTextureEditor/anima/LuaJIT-ImGui/cimgui/imgui/examples/libs/gl3w/GL/gl3w.c:67:10: fatal error: GL/glx.h: No such file or directory
   67 | #include <GL/glx.h>
      |          ^~~~~~~~~~
compilation terminated.
make[2]: *** [LuaJIT-ImGui/CMakeFiles/cimgui_sdl.dir/build.make:180: LuaJIT-ImGui/CMakeFiles/cimgui_sdl.dir/cimgui/imgui/examples/libs/gl3w/GL/gl3w.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:639: LuaJIT-ImGui/CMakeFiles/cimgui_sdl.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

@sonoro1234
Copy link
Owner

sonoro1234 commented Aug 15, 2020

Yes, it did help.
error is now saying that you need to install opengl developing files in your system.

google linux opengl

@GeTechG
Copy link
Author

GeTechG commented Aug 15, 2020

Ugh, it helped, the assembly was successful. I take it now everything has to be searched in the directory I indicated?

@sonoro1234
Copy link
Owner

I take it now everything has to be searched in the directory I indicated?

Yes

In the anima\examples\LuaJIT-ImGui\examples folder you will find the LuaJIT examples, you should run them from a terminal (or your prefered code editor) ./anima_launcher script_to_run_path

@GeTechG
Copy link
Author

GeTechG commented Aug 15, 2020

The thing is that I'm using the LOVE2D framework and I need to run it, I thought it would be at the end of the .so dynamic library and I could connect them.

@sonoro1234
Copy link
Owner

sonoro1234 commented Aug 15, 2020

It is not a LOVE2D module but just a LuaJIT module. Someone has to port it to LOVE2D. Perhaps https://github.com/Jarodwr/love-imgui-wip but I have not tried it and it seems to need more work for linux building.

without using LuaJIT-imgui you have https://github.com/YoungNeer/lovely-imgui but I guess it will be not up to date with latest imgui

@GeTechG
Copy link
Author

GeTechG commented Aug 15, 2020

Just LOVE2D is assembled with LuaJIT

@GeTechG
Copy link
Author

GeTechG commented Aug 15, 2020

I was able to run your implementation in LOVE2D by copying the libraries to LOVE2D. And I put https://github.com/Jarodwr/love-imgui-wip, but alas, it didn't work. Thank you for trying to help me, I think you can close the issue. Next, if the author builds for linux, it'll be great.

Error: imgui/init.lua:228: Invalid draw range.
stack traceback:
	[string "boot.lua"]:777: in function <[string "boot.lua"]:773>
	[C]: in function 'setDrawRange'
	imgui/init.lua:228: in function 'render'
	main.lua:15: in function 'draw'
	[string "boot.lua"]:618: in function <[string "boot.lua"]:594>
	[C]: in function 'xpcall'

@GeTechG
Copy link
Author

GeTechG commented Aug 15, 2020

Decided to show you what I've achieved, maybe you know how to fix it. I combined sdl.lua and its init.lua, and the result worked, except that the window looks weird, but it works and moves.
изображение

@sonoro1234
Copy link
Owner

sonoro1234 commented Aug 15, 2020

I combined sdl.lua and its init.lua, and the result worked,

Without a more detailed description of what you have done I wont be able to help you.

Besides that:
What init.lua from https://github.com/Jarodwr/love-imgui-wip is trying to achieve is what should be done by https://github.com/ocornut/imgui/blob/9418dcb69355558f70de260483424412c5ca2fce/examples/imgui_impl_opengl3.cpp and https://github.com/ocornut/imgui/blob/9418dcb69355558f70de260483424412c5ca2fce/examples/imgui_impl_sdl.cpp which are the SDL2-opengl3 implementations done by @ocornut himself. They are plenty of subtileties and instead of trying to emulate that, the correct solution would be to use them as I have done in LuaJIT-imgui. But for doing this I would need the SDL_Window handle and the opengl context handle. As I dont know how to get them in LOVE2D I have posted and issue there: love2d/love#1610


Actually it was quite simple to run imgui in LOVE2D without any modification at all:
(tested in windows)

put imgui folder inside love/lua
copy cimgui_sdl.so to love folder
then create LOVE2D project with this main.lua

main.lua

local imgui = require "imgui.sdl"

local ffi = require"ffi"
ffi.cdef[[
typedef struct SDL_Window SDL_Window;
SDL_Window *SDL_GL_GetCurrentWindow(void);
void* SDL_GL_GetCurrentContext(void);
]]
local sdl = jit.os == "Windows" and ffi.load("SDL2") or ffi.C

local instance
love.load = function(table)
	local sdlwindow = sdl.SDL_GL_GetCurrentWindow()
	local openglctx = sdl.SDL_GL_GetCurrentContext()
    instance = imgui.Imgui_Impl_SDL_opengl3()
	instance:Init(sdlwindow, openglctx)
end

love.draw = function()
	instance:NewFrame()
	if imgui.Button("Hello") then print("Hello") end
    instance:Render()
end

Tell me if this is working for you so I will make imgui.love2d.lua in order to avoid sdl stuff on main.lua

@ocornut Could you please add LuaJIT-imgui to the list of LÖVE+LUA bindings?

@sonoro1234 sonoro1234 changed the title Compilation for linux. Compilation and usage for LOVE2D Aug 15, 2020
@sonoro1234 sonoro1234 pinned this issue Aug 15, 2020
@GeTechG
Copy link
Author

GeTechG commented Aug 15, 2020

Probably should have said that I got it then, I just imgui put it in love/lua, but with a direct request SDL I did not. At https://github.com/Jarodwr/love-imgui-wip the renderer is not via SDL but via LOVE2D, so imgui takes a table of what to draw but with LOVE2D renderer. I'll try yours later.

function imgui:render()
    lib.igRender()
    local drawData = lib.igGetDrawData()
    do --Check if the frame buffer dimensions are both above 0
        local io = lib.igGetIO()
        local frameBufferWidth = io.DisplaySize.x * io.DisplayFramebufferScale.x
        local frameBufferHeight = io.DisplaySize.y * io.DisplayFramebufferScale.y

        if frameBufferWidth == 0 or frameBufferHeight == 0 then
            return
        end
        lib.ImDrawData_ScaleClipRects(drawData, io.DisplayFramebufferScale)
    end

    for i = 0, drawData.CmdListsCount - 1 do
        local cmdList = drawData.CmdLists[i]

        local idx = {}
        for j = 1, cmdList.IdxBuffer.Size do
            idx[j] = cmdList.IdxBuffer.Data[j - 1] + 1
        end

        local verticesSize = cmdList.VtxBuffer.Size * ffi.sizeof "ImDrawVert"
        local verticesData = ffi.string(cmdList.VtxBuffer.Data, verticesSize)

        local renderMesh =
            love.graphics.newMesh(
            {
                {"VertexPosition", "float", 2},
                {"VertexTexCoord", "float", 2},
                {"VertexColor", "byte", 4}
            },
            love.image.newImageData(verticesSize / 4, 1, "rgba8", verticesData)
        )
        renderMesh:setTexture(self.textureObject)
        renderMesh:setVertexMap(idx)

        local position = 1

        for cmd_i = 0, cmdList.CmdBuffer.Size-1 do
            local pcmd = cmdList.CmdBuffer.Data[cmd_i]
            local vertexCount = pcmd.ElemCount
            local vertexPosition = position
            position = position + pcmd.ElemCount

            love.graphics.setBlendMode "alpha"
            if pcmd.TextureId == nil then
                renderMesh:setTexture(self.textureObject)
            else
                local currentTexture = pcmd.TextureId[0]
                local texture = self.textures[currentTexture]
                if texture:typeOf "Canvas" then
                    love.graphics.setBlendMode("alpha", "premultiplied")
                end
                renderMesh:setTexture(texture)
            end

            love.graphics.setScissor(
                pcmd.ClipRect.x,
                pcmd.ClipRect.y,
                pcmd.ClipRect.z - pcmd.ClipRect.x,
                pcmd.ClipRect.w - pcmd.ClipRect.y
            )
            
            renderMesh:setDrawRange(vertexPosition, vertexCount)
            love.graphics.draw(renderMesh)
        end

        love.graphics.setScissor()
    end
end

@GeTechG
Copy link
Author

GeTechG commented Aug 15, 2020

Everything is working fine, thank you for taking the initiative and even creating an offer for the developers to make a bridge. Even though it's a trifle, so far all I can do is to point you in the information to my application as contributing to its development, because I was even thinking about switching to some other language.
I added a bit, so I think that's a bit more correct.

local imgui = require "imgui.sdl"

local ffi = require"ffi"
ffi.cdef[[
typedef struct SDL_Window SDL_Window;
SDL_Window *SDL_GL_GetCurrentWindow(void);
void* SDL_GL_GetCurrentContext(void);
]]
local sdl = jit.os == "Windows" and ffi.load("SDL2") or ffi.C

local instance
love.load = function(table)
	local sdlwindow = sdl.SDL_GL_GetCurrentWindow()
	local openglctx = sdl.SDL_GL_GetCurrentContext()
        instance = imgui.Imgui_Impl_SDL_opengl3()
	instance:Init(sdlwindow, openglctx)
end

love.draw = function()
	instance:NewFrame()
	if imgui.Button("Hello") then print("Hello") end
        instance:Render()
end

love.quit = function()
  instance:destroy()
end

изображение
UPD1
I found that typing wasn't working, so I was able to do a peek at Jarodwr, but I couldn't erase the text and a couple more hotkeys.
main.lua

love.textinput = function(text)
    instance:__textInput(text)
end

sdl.lua

function Imgui_Impl_SDL_opengl3:__textInput(text)
    lib.ImGuiIO_AddInputCharactersUTF8(lib.igGetIO(),text)
end

@sonoro1234
Copy link
Owner

Yes, sdl events were missing now there is imgui.love module and a love example.
Could you give it a try?

@GeTechG
Copy link
Author

GeTechG commented Aug 16, 2020

Error

imgui/sdl.lua:2365: /home/sergey/love2d/lib/x86_64-linux-gnu/libcimgui.so: undefined symbol: igGetBackgroundDrawList


Traceback

[C]: in function '__index'
imgui/sdl.lua:2365: in main chunk
[C]: in function 'require'
imgui/love.lua:252: in main chunk
[C]: in function 'require'
main.lua:1: in main chunk
[C]: in function 'require'
[C]: in function 'xpcall'
[C]: in function 'xpcall'

@sonoro1234
Copy link
Owner

I think you are mixing the imgui lua modules from master branch with the module compiled from docking_inter branch (this is the module included in anima).
I can see also that you changed the module name from cimgui_sdl to libcimgui,
Please just do a fresh intall and move to love folder what was in anima folder.
( or perhaps try to directly compile LuaJIT-ImGui without anima and pointing -DLUAJIT_BIN="path to love")

@GeTechG
Copy link
Author

GeTechG commented Aug 16, 2020

So, I have to rebuild? I downloaded from github, copied from lua's folder, that's all.

@sonoro1234
Copy link
Owner

sonoro1234 commented Aug 16, 2020

Or dont rebuild but take the lua modules from docking_inter branch (the one you get when you clone anima)

@GeTechG
Copy link
Author

GeTechG commented Aug 16, 2020

Everything's okay, and it's working.

@sonoro1234
Copy link
Owner

sonoro1234 commented Aug 17, 2020

I have also improved building LuaJIT-ImGui alone (without anima) with dependencies in the readme and a new linux script.
Remember to check-out the desired branch (master or docking-inter)

@GeTechG
Copy link
Author

GeTechG commented Aug 17, 2020

Okay, I'll check.

@sonoro1234
Copy link
Owner

sonoro1234 commented Aug 20, 2020

Added use_imgui_viewport, will only work in docking-inter branch.
Only left to do overloading of love.window.setMode and love.window.updateMode because using them after imgui.love_load would make LuaJIT-ImGui to loose window and context.
The overloading will do instance:destroy() and call imgui.love_load again

@GeTechG
Copy link
Author

GeTechG commented Aug 30, 2020

Error

imgui/sdl.lua:1342: /home/sergey/love2d/lib/x86_64-linux-gnu/libcimgui_sdl.so: undefined symbol: ImGuiLastItemDataBackup_Backup


Traceback

[C]: in function '__index'
imgui/sdl.lua:1342: in main chunk
[C]: in function 'require'
imgui/love.lua:253: in main chunk
[C]: in function 'require'
main.lua:8: in main chunk
[C]: in function 'require'
[C]: in function 'xpcall'
[C]: in function 'xpcall'

@sonoro1234
Copy link
Owner

sonoro1234 commented Aug 30, 2020

imgui/sdl.lua:1342: /home/sergey/love2d/lib/x86_64-linux-gnu/libcimgui_sdl.so: undefined symbol: ImGuiLastItemDataBackup_Backup

First of all: This is not a general imgui.love issue, (Compilation and usage for LOVE2D) you should open a new issue for things happening in the future.

You should provide context information about the issue: version, commit, branch ...

This error you are posting is not according to current imgui.sdl docking_inter branch https://github.com/sonoro1234/LuaJIT-ImGui/blob/docking_inter/lua/imgui/sdl.lua#L1342

@sonoro1234 sonoro1234 unpinned this issue Aug 30, 2020
@sonoro1234
Copy link
Owner

sonoro1234 commented Aug 30, 2020

please open new issue with this. Should be called undefined symbol
meanwhile try to recompile from correct git source
https://github.com/sonoro1234/LuaJIT-ImGui#cloning

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

No branches or pull requests

2 participants