I'm looking for a lightweight GUI/control pack

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
togFox
Party member
Posts: 828
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

I'm looking for a lightweight GUI/control pack

Post by togFox »

I've used SLAB and it's great but I don't need an entire framework. I need a text box, I guess a button, perhaps a 'spinner' (up/down buttons). IDK what else yet. Just checking if anyone has something that's not a full-blown framework. I'm also happy to 'rip and fit' from existing code if ppl have samples that is not in a tidy module.

Cheers n beers.
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/idle-gridiron
User avatar
darkfrei
Party member
Posts: 1204
Joined: Sat Feb 08, 2020 11:09 pm

Re: I'm looking for a lightweight GUI/control pack

Post by darkfrei »

Can you make the small GUI by yourself?

Just several objects with x, y positions and width and height, by hovering change the active gui element an by clicking check the position and return the clicked gui element.
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
User avatar
knorke
Party member
Posts: 274
Joined: Wed Jul 14, 2010 7:06 pm
Contact:

Re: I'm looking for a lightweight GUI/control pack

Post by knorke »

I attached clickbuttons. It is clickable buttons. You can use mouse or arrow keys up/up and return key.
There are also "toggle" buttons, if you click them they cycle through pre-defined toggles.
(like a difficulty button and it each click it changes from "easy" to "medium" to "advanced" to "hard")
It is used in this game:
viewtopic.php?p=250233#p250233
except not as a seperate module but inside main.lua where it says -- BUTTONS ---
You fill the buttons table like this:

Code: Select all

add_button (buttons, res_w/2-220, res_h-60, 400, 20, "back to menu", "button_to_menu")
you read the clicks like

Code: Select all

local clicked_button_name, clicked_button_i = clicked_button (buttons)
	if (clicked_button_name == "button_to_menu") then change_gamestatus ("MENU") end
and draw the buttons like

Code: Select all

	draw_buttons (buttons)
There are some global variables like mouse_was_down and active_button (the button that is currently selected by keyboard) etc
Wow, this code is just the best.
Attachments
clickbuttons.lua
(3.41 KiB) Downloaded 80 times
User avatar
togFox
Party member
Posts: 828
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: I'm looking for a lightweight GUI/control pack

Post by togFox »

Thanks. I wasn't expecting a module and I'm happy to extract from your code. :)

I could do this myself but I've no experience and it'd take me a while to fumble through it.

Someone else here has 'textinput' I'll also look into.

Cheers!
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/idle-gridiron
User avatar
BrotSagtMist
Party member
Posts: 659
Joined: Fri Aug 06, 2021 10:30 pm

Re: I'm looking for a lightweight GUI/control pack

Post by BrotSagtMist »

What text input are you planning/looking for?
I have a full editor box with marking/copypaste/mouse/tabs/highlight etc. with only 500 lines size.
I just kinda stalled working on it midway and forgot how it works. Not sure if i can turn this into a module to be randomly deployed in other peoples projects.
obey
User avatar
togFox
Party member
Posts: 828
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: I'm looking for a lightweight GUI/control pack

Post by togFox »

I'm after basic controls for my OPTIONS screen. You know - the usual - check boxes for music, maybe a text box to enter player name, an OKAY button to exit. Perhaps up/down arrows to adjust bot difficulty. Normal stuff. Nothing demanding.

If you agree - there is no harm in sharing. I'll either use it or I won't. :)
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/idle-gridiron
User avatar
BrotSagtMist
Party member
Posts: 659
Joined: Fri Aug 06, 2021 10:30 pm

Re: I'm looking for a lightweight GUI/control pack

Post by BrotSagtMist »

Nah, this is total overkill. Its a code editor, the work needed to adjust it for "player names" is probably more than just rewriting it.
obey
User avatar
pgimeno
Party member
Posts: 3674
Joined: Sun Oct 18, 2015 2:58 pm

Re: I'm looking for a lightweight GUI/control pack

Post by pgimeno »

Gspöt is quite lightweight (single file, albeit somewhat big). It's what I use for simple things like what you're describing.
User avatar
togFox
Party member
Posts: 828
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: I'm looking for a lightweight GUI/control pack

Post by togFox »

pgimeno wrote: Sat Dec 03, 2022 6:46 am Gspöt is quite lightweight (single file, albeit somewhat big). It's what I use for simple things like what you're describing.
I took your suggestion and I'm trying it now. I like it. :) I have to use the example code + the old docs because the example alone doesn't demonstrate everything (not surprising). For example, I had to read the docs to see how to :hide() and :show() buttons. (Not complaining - just saying - the docs have SOME value).

This has absolutely got me started with my basic GUI. Thanks!!
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/idle-gridiron
Post Reply

Who is online

Users browsing this forum: Google [Bot], Semrush [Bot] and 2 guests