Page 1 of 1

Lavis: Cross-Mode Library for Love2d

Posted: Wed Dec 04, 2019 12:36 pm
by YoungNeer
Retained GUI, ImGUI, Retained GUI, ImGUI, .....

And the battle was never-ending until someone came up with a solution "Why not instead have something like a "cross-mode" GUI??? The people who like retained-mode will use the retained-architecture and the imgui people will use the immediate-model!"

Lavis aims just that - to allow the user to create GUIs in any way they wish which makes it a cross-mode GUI library. Let's say you want a image-button that when clicked says 'button pressed'. Here's how you might do this with Lavis:

In Retained Mode:

Code: Select all

lavis=require 'lavis'

lavis.imageButton('button.png',400,300):addEventListener('click',function()
  print('button clicked')
end)
In Immediate Mode:

Code: Select all

lavis=require 'lavis'

function love.draw()
  lavis.drawImageButton(1,'button.png',400,300)  --id for this button is 1
end

lavis.imgui.onClick=function(id)
  if id==1 then print('button clicked') end
end
And this is the complete code not part of the code!! It's not that Lavis takes control of the runtime it's just that Lavis overrides love functions with its own functions so you don't have to redefine them if you don't need them!!

Here's a look of GUI created with Lavis:-

Image

Github-link

Read the documenation here

Note: Currently only the minimal version has been uploaded. Still it's powerful enough for you to create your own custom widgets!

Lavis is now updated!!

Posted: Sun Dec 08, 2019 2:02 pm
by YoungNeer
Lavis is now cross-mode: You can now create widgets immediately with little memory consumption (compared to retained-mode)
Lavis now supports canvases (for performance-related reasons)
Added functionality (more callback functions and variables so to speak)
Btw the demo uses an older version so I recommend you clone from the github link:
https://github.com/YoungNeer/lavis