GOOi, an Android-Oriented GUI Library

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
xopxe
Prole
Posts: 4
Joined: Fri Apr 22, 2016 3:49 am

Re: GÖÖi, an Android-Oriented GUI Library

Post by xopxe »

Is it possible / will it be possible to have vertical sliders?
User avatar
alberto_lara
Party member
Posts: 372
Joined: Wed Oct 30, 2013 8:59 pm

Re: GÖÖi, an Android-Oriented GUI Library

Post by alberto_lara »

xopxe wrote:You're right, I never get love.touchpressed events... Any idea what can be wrong?

(I'm on Ubuntu 14.04 with gooi from git)
I've just tested with this code and everything seems to work fine:

Code: Select all

require "gooi"

function love.load()
	gr = love.graphics

	ball = {
		x = 300,
		y = 300,
		color = {255, 255, 255},
		radius = 50
	}

	joy = gooi.newJoy({size = 200})
	panel = gooi.newPanel(0, 0, gr.getWidth(), gr.getHeight(), "game")
	panel:add(joy, "b-l")
	panel:add(gooi.newButton({text = "Color", w = 220, h = 70}):onRelease(function()
		ball.color = {r(), r(), r()}
	end), "b-r")
	panel:add(gooi.newButton({text = "Size", w = 220, h = 70}):onRelease(function()
		ball.radius = r() / 2
	end), "b-r")
end

function love.update(dt)
	gooi.update(dt)
	ball.x = ball.x + joy:xValue() * 200 * dt
	ball.y = ball.y + joy:yValue() * 200 * dt
end

function love.draw()
	gooi.draw()
	gr.setColor(ball.color)
	gr.circle("fill", ball.x, ball.y, ball.radius)
end

function r() return love.math.random(0, 255) end

function love.touchpressed(id, x, y)  gooi.pressed(id, x, y) end
function love.touchmoved(id, x, y)  gooi.moved(id, x, y) end
function love.touchreleased(id, x, y) gooi.released(id, x, y) end

function love.keypressed(key)
	if key == "escape" then
		love.event.quit()
	end
end
Please note: This was tested in Android only (GÖÖi it's oriented to this), I don't know how this behaves in touchscreen laptops or other environments.
gooi.moved() and gooi.update() are necessary (at least in this example), sorry if I forgot to mention it.

Also, I've updated the repo, a "3D mode" was added so you can make GÖÖi to have 2 modes, plain or 3D:

Image
Image

This is set in the style object:

Code: Select all

style= {
	font = gr.newFont(fontDir.."ProggySquare.ttf", 16),
	fgColor = "#FFFFFF",
	bgColor = {22, 99, 140, 240},
	mode3d = true -- Or false for plain aspect
}
Last edited by alberto_lara on Fri May 27, 2016 5:10 pm, edited 1 time in total.
User avatar
alberto_lara
Party member
Posts: 372
Joined: Wed Oct 30, 2013 8:59 pm

Re: GÖÖi, an Android-Oriented GUI Library

Post by alberto_lara »

xopxe wrote:Is it possible / will it be possible to have vertical sliders?
Sure, let me add it to the list :)
User avatar
alberto_lara
Party member
Posts: 372
Joined: Wed Oct 30, 2013 8:59 pm

Re: GÖÖi, an Android-Oriented GUI Library

Post by alberto_lara »

Hi, just a quick update: I've changed spinners to look like this:

Image

And now they're much more user-friendly, if you touch/click it in the left half, the value decreases and the same for the half on the right. So you don't necessarily need to touch the arrows.

EDIT: Also, joysticks support now an image as stick:

Image

just call :setImage([string|Image])
User avatar
whitebear
Citizen
Posts: 86
Joined: Sun Mar 15, 2009 1:50 am

Re: GÖÖi, an Android-Oriented GUI Library

Post by whitebear »

I have few ideas for UI elements
First suggestion would be something like this:
Image
Basically line that end-user can manipulate into segments. The "flags" could have simply string label (or dynamic number based where it is.) or colour label.
And my second suggestion would be button matrix with multiple states (not just on/off)
User avatar
alberto_lara
Party member
Posts: 372
Joined: Wed Oct 30, 2013 8:59 pm

Re: GÖÖi, an Android-Oriented GUI Library

Post by alberto_lara »

whitebear wrote:I have few ideas for UI elements
First suggestion would be something like this:
Image
Basically line that end-user can manipulate into segments. The "flags" could have simply string label (or dynamic number based where it is.) or colour label.
And my second suggestion would be button matrix with multiple states (not just on/off)
A button with multiple states seems like an interesting idea (or a toggle button, which is a basic one I forgot). About the slider, maybe a "range" slider like the ones used in jQuery UI would be something nice:

Image
User avatar
alberto_lara
Party member
Posts: 372
Joined: Wed Oct 30, 2013 8:59 pm

Re: GÖÖi, an Android-Oriented GUI Library

Post by alberto_lara »

Hi, another update regarding GÖÖi looking, I added a glossy effect and I think it looks nice :)

Image

Just add "glass = true" in the style used.

Repo updated as well.
User avatar
farvardin
Party member
Posts: 167
Joined: Sat Jun 28, 2008 6:46 pm

Re: GÖÖi, an Android-Oriented GUI Library

Post by farvardin »

thanks a lot for this conveniant library!
User avatar
LordSeaworth
Prole
Posts: 22
Joined: Tue Jun 07, 2016 10:29 pm

Re: GÖÖi, an Android-Oriented GUI Library

Post by LordSeaworth »

Just saw this thread.

Is this lib compatible with latest löve and with pc support? With pc support i mean just using the lib in a non android löve2d game?
User avatar
alberto_lara
Party member
Posts: 372
Joined: Wed Oct 30, 2013 8:59 pm

Re: GÖÖi, an Android-Oriented GUI Library

Post by alberto_lara »

You're welcome, and yes, GÖÖi works in LÖVE 0.10.1 and in desktop environments.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests