Lavis: Cross-Mode Library for Love2d

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
YoungNeer
Party member
Posts: 115
Joined: Wed May 15, 2019 7:49 am

Lavis: Cross-Mode Library for Love2d

Post by YoungNeer » Wed Dec 04, 2019 12:36 pm

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!
Attachments
lavisDemo.love
(268.43 KiB) Downloaded 24 times
Last edited by YoungNeer on Sun Dec 08, 2019 2:07 pm, edited 6 times in total.
My Github- your contribution is highly appreciated

User avatar
YoungNeer
Party member
Posts: 115
Joined: Wed May 15, 2019 7:49 am

Lavis is now updated!!

Post by YoungNeer » Sun Dec 08, 2019 2:02 pm

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
My Github- your contribution is highly appreciated

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests