ImGui LÖVE module

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
portify
Prole
Posts: 18
Joined: Sun Feb 15, 2015 10:15 pm
Location: Locating
Contact:

Re: ImGui LÖVE module

Post by portify »

Thanks a lot for this, it's really helpful

Image
Zireael wrote:I was using my own code for UI but realized I need input for character creation and movable, semi-transparent GUI dock for the hotbar with skills and the like. I think imgui would help for both but I can't tell how to actually create a list or a console window such as the one portify made...
Well what have you tried so far? I mostly just referenced the imgui C source and various samples. What are you stuck on? Making a window, a scrollable region or just a list of text in general?
Zireael
Party member
Posts: 139
Joined: Fri Sep 02, 2016 10:52 am

Re: ImGui LÖVE module

Post by Zireael »

I know how to do a list of text in pure Lua, I can't figure out the imgui part. I'm really bad at reading/using C of any kind :P
alloyed
Citizen
Posts: 80
Joined: Thu May 28, 2015 8:45 pm
Contact:

Re: ImGui LÖVE module

Post by alloyed »

So I'm having a good time with imgui so far, but I'm having some issues with the docks: namely that I can't find a way to set the default ratios between each dock pane.
This is what my editor looks like when I boot it up:
2017-02-28-144657_800x600_scrot.png
2017-02-28-144657_800x600_scrot.png (15.34 KiB) Viewed 27984 times
the main view, the editor, only takes 1/4 of the screen here. This:
2017-02-28-144829_800x600_scrot.png
2017-02-28-144829_800x600_scrot.png (15.16 KiB) Viewed 27984 times
Is what I want, but I have to manually drag each dock to get this.
fxva
Prole
Posts: 8
Joined: Sat Jul 13, 2013 4:54 am

Re: ImGui LÖVE module

Post by fxva »

Hello guys.
I will speak from my heart with google translate(c)

How to change the default font?

here's what I found:

Code: Select all

Load .TTF file with:

ImGuiIO& io = ImGui::GetIO();
io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels);
But it does not help me. :emo:
User avatar
Fenrir
Party member
Posts: 222
Joined: Wed Nov 27, 2013 9:44 am
Contact:

Re: ImGui LÖVE module

Post by Fenrir »

alloyed wrote: Tue Feb 28, 2017 7:51 pm So I'm having a good time with imgui so far, but I'm having some issues with the docks: namely that I can't find a way to set the default ratios between each dock pane.
This is what my editor looks like when I boot it up:
2017-02-28-144657_800x600_scrot.png
the main view, the editor, only takes 1/4 of the screen here. This:
2017-02-28-144829_800x600_scrot.png
Is what I want, but I have to manually drag each dock to get this.
Hmm have you tried the classic imgui.SetNextWindowSize to try to control its size? As not being official, the dock support seems quite limited, not sure it was a good idea to include it... If I would need to create on a new editor with imgui, I would probably go for something like that:
Image
It was made by the imgui creator for his game (Wonder Boy: The Dragon's Trap).
fxva wrote: Wed Mar 01, 2017 3:10 pm Hello guys.
I will speak from my heart with google translate(c)

How to change the default font?

here's what I found:

Code: Select all

Load .TTF file with:

ImGuiIO& io = ImGui::GetIO();
io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels);
But it does not help me. :emo:
It's still not possible for now, it's part of what I need to include but I have no time for it currently... :/
alloyed
Citizen
Posts: 80
Joined: Thu May 28, 2015 8:45 pm
Contact:

Re: ImGui LÖVE module

Post by alloyed »

Fenrir wrote: Thu Mar 02, 2017 12:43 pm
Hmm have you tried the classic imgui.SetNextWindowSize to try to control its size? As not being official, the dock support seems quite limited, not sure it was a good idea to include it... If I would need to create on a new editor with imgui, I would probably go for something like that:
I just tried, and got nothing. I did do some sourcediving though, and there are a few places I can probably try to modify to suit my needs:

https://github.com/Alloyed/love-imgui/b ... k.cpp#L751

Since I'm going to be modifying the library anyways, I'll also try to see if I can't get state serialization working too.
If I get anywhere I'll try to send my changes as PRs~

EDIT: it looks like the original original docks author has been working in this direction! This makes my life slightly easier:
https://github.com/nem0/LumixEngine/com ... 2a1333f660
User avatar
ArchAngel075
Party member
Posts: 319
Joined: Mon Jun 24, 2013 5:16 am

Re: ImGui LÖVE module

Post by ArchAngel075 »

Fantastic library, well apart from the lack of documentation that makes sense to me :P

I am struggling to have a dock space contain my game rendering. I want to constrain my game rendering to one dock and another set of windows to another.

Code: Select all

imgui.SetNextWindowPos(0, 0)
  if imgui.Begin("PrimaryDock", nil, { "NoTitleBar", "NoMove" }) then
    imgui.BeginDockspace() --start the dock
    ---
    if imgui.BeginDock("dock_".."Game") then
      --draw game here
      imgui.EndDock()
    end
    --
    if imgui.BeginDock("dock_".."Editor") then
      imgui.Begin("MainEditorScreen")
      --eventually will fill with all editor related shenanigans 
      imgui.End()
      imgui.EndDock()
    end
    --
    imgui.EndDockspace() -- end the dock
  end
  imgui.End()
  
  imgui.Render();
This does make my game render when dock_Game dock is selected.
Though i noticed the game rendering is not constrained to the dock, it simply only happens when that dock is selected and it appears asif though the docks pane/window is drawn over my game.

The same happens for the MainEditorScreen window, it is drawn behind and outside the dock.

How would I go about getting better documentation than using the imgui.cpp and imgui.h files and rendering my game inside of a dock?
User avatar
Fenrir
Party member
Posts: 222
Joined: Wed Nov 27, 2013 9:44 am
Contact:

Re: ImGui LÖVE module

Post by Fenrir »

ArchAngel075 wrote: Fri Mar 31, 2017 11:22 am Fantastic library, well apart from the lack of documentation that makes sense to me :P

I am struggling to have a dock space contain my game rendering. I want to constrain my game rendering to one dock and another set of windows to another.

Code: Select all

imgui.SetNextWindowPos(0, 0)
  if imgui.Begin("PrimaryDock", nil, { "NoTitleBar", "NoMove" }) then
    imgui.BeginDockspace() --start the dock
    ---
    if imgui.BeginDock("dock_".."Game") then
      --draw game here
      imgui.EndDock()
    end
    --
    if imgui.BeginDock("dock_".."Editor") then
      imgui.Begin("MainEditorScreen")
      --eventually will fill with all editor related shenanigans 
      imgui.End()
      imgui.EndDock()
    end
    --
    imgui.EndDockspace() -- end the dock
  end
  imgui.End()
  
  imgui.Render();
This does make my game render when dock_Game dock is selected.
Though i noticed the game rendering is not constrained to the dock, it simply only happens when that dock is selected and it appears asif though the docks pane/window is drawn over my game.

The same happens for the MainEditorScreen window, it is drawn behind and outside the dock.

How would I go about getting better documentation than using the imgui.cpp and imgui.h files and rendering my game inside of a dock?
To render your game inside imgui, you'll need to render it into a LÖVE Canvas, and then, into your dock, just call imgui.Image(your_canvas, width, height).
User avatar
Tjakka5
Party member
Posts: 243
Joined: Thu Dec 26, 2013 12:17 pm

Re: ImGui LÖVE module

Post by Tjakka5 »

Hi!

Im trying to build Imgui for Ubuntu 14.04 LTS, but Im having some difficulty.
imgui.png
imgui.png (26.17 KiB) Viewed 27695 times
Any idea on what I'm doing wrong?
User avatar
Fenrir
Party member
Posts: 222
Joined: Wed Nov 27, 2013 9:44 am
Contact:

Re: ImGui LÖVE module

Post by Fenrir »

Tjakka5 wrote: Fri Mar 31, 2017 1:02 pm Hi!

Im trying to build Imgui for Ubuntu 14.04 LTS, but Im having some difficulty.

imgui.png

Any idea on what I'm doing wrong?
Erf I must admit than I have no idea on how to use luarocks, I added support for it thanks to a pull request... On my side I'm just building it with cmake, and the only dependency is LuaJIT.
Post Reply

Who is online

Users browsing this forum: No registered users and 43 guests