GUI library with non-mouse navigation?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
SFX
Prole
Posts: 9
Joined: Tue Jul 03, 2012 4:56 pm
Contact:

GUI library with non-mouse navigation?

Post by SFX »

I want to add gamepad support to the game I'm making for the October Challenge, and I've run into a bit of a problem: the GUI library I'm using (gspot) doesn't support non-mouse navigation. Does anybody know of a GUI library that supports non-mouse navigation? I've yet to find one, and I'm trying to avoid reinventing the wheel.
Where's my big, fat hammock time?
I should pimp my neglected game dev blog.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: GUI library with non-mouse navigation?

Post by Roland_Yonaba »

If by "non-mouse navigation" you meant being able to cycle though GUI items (buttons, inputs, etc...) using keyboard or/joysticks,
I don't think there's such a Gui lib.
But, you can still pick one of the existing GUis (or stick with Gspöt), require it, and add that feature by yourself.
User avatar
bartoleo
Party member
Posts: 118
Joined: Wed Jul 14, 2010 10:57 am
Location: Savigliano

Re: GUI library with non-mouse navigation?

Post by bartoleo »

you are looking for a complete GUI?
or only basic controls to use in menu and options?
Bartoleo
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: GUI library with non-mouse navigation?

Post by vrld »

Quickie allows keyboard navigation. Because there is still no documentation, here is a shortened example taken from Spaceout. Cycling order is defined by order of appearance of the widgets.

Code: Select all

function st:init()
	gui.keyboard.cycle.prev = {key = 'up'}
	gui.keyboard.cycle.next = {key = 'down'}
	gui.mouse.disable()
end

function st:update(dt)
	love.graphics.setFont(Font.slkscr[40])
	gui.group.push{grow = "down", size = {400,40}, spacing = 5, pos = {(W-400)/2, H-230}}
	if not show_credits then
		if gui.Button{text = "Start"} then
			tween(1, fade_color, {0,0,0,255}, 'linear', function() GS.switch(State.game) end)
		end
		if gui.Button{text = "Highscores"} then
			tween(1, fade_color, {0,0,0,255}, 'linear', function() GS.switch(State.highscores) end)
		end
		if gui.Button{text = "Credits"} then
			show_credits = true
		end
		if gui.Button{text = "Exit"} then
			love.event.push("quit")
		end
	else
		-- omitted: credits
		if gui.Button{text = "Back"} then
			show_credits = false
			gui.keyboard.clearFocus() -- necessary so we highlight <Start> when going back
		end
	end
	gui.group.pop{}
end

function st:draw()
	-- stuff
	gui.core.draw()
	-- more stuff
end

function st:keypressed(key, code)
	-- propagate keyboard events to quickie
	return gui.keyboard.pressed(key, code)
end
For joystick navigation, simply call gui.keyboard.pressed(key, code) in love.joystickpressed.

Edit: just updated quickie to include gui.mouse.disable()
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
Zeliarden
Party member
Posts: 139
Joined: Tue Feb 28, 2012 4:40 pm

Re: GUI library with non-mouse navigation?

Post by Zeliarden »

maybe MinimalMenu? viewtopic.php?f=5&t=11199
SFX
Prole
Posts: 9
Joined: Tue Jul 03, 2012 4:56 pm
Contact:

Re: GUI library with non-mouse navigation?

Post by SFX »

Thanks for the suggestions. I think I'll just go with vrld's suggestion for now and use Quickie. It has automatic layouts, which will be absurdly useful. If I have time (which seems to be an increasingly large if), I may try to make my own tiny GUI library.
Where's my big, fat hammock time?
I should pimp my neglected game dev blog.
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: GUI library with non-mouse navigation?

Post by josefnpat »

You can also check out my LoveMenu if you like, but there isn't any documentation.
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 5 guests