GOOi, an Android-Oriented GUI Library

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
alberto_lara
Party member
Posts: 372
Joined: Wed Oct 30, 2013 8:59 pm

Re: GOOi a GUI Library for Desktop and Touch screens.

Post by alberto_lara »

Hi guys, Game layout seems to work well, the goal of this one is to have an easy way to say "I want this in bottom-left, this on top-right of the screen", etc. and it's intended to be a layout for a gameplay screen.

The code below:

Code: Select all

pGame:add(gooi.newButton("btn_shot", "Shot", 0, 0, 80, 50):onRelease(function() shotBullet() end), "b-r")
pGame:add(gooi.newButton("btn_bomb", "Bomb", 0, 0, 80, 50):onRelease(function() shotBomb() end), "b-r")
pGame:add(gooi.newJoy("joy_1"), "b-l")
pGame:add(gooi.newLabel("lbl_score", "Score: 0"), "t-l")
pGame:add(gooi.newBar("bar_1"):setLength(pGame.w / 3):increase(1), "t-r")
pGame:add(gooi.newLabel("lbl_life", "Life:"), "t-r")
will add the components as in the panel in the right:

Image

The default spacing between components is 3px, this can be changed in layout.lua:3, and this applies for both grid and game layout.

.love for this demo:
git_gooi.love
(1.44 MiB) Downloaded 339 times
Please note, to use this (without problems) on your cellphone or tablet you need to remove the love.mousepressed/released functions and add the touchpressed,released and moved callbacks (https://bitbucket.org/MartinFelis/love- ... /wiki/Home) like this:

Code: Select all

--function love.mousepressed(x, y, button)  gooi.pressed() end
--function love.mousereleased(x, y, button) gooi.released() end

function love.touchpressed(id, x, y, pressure) gooi.pressed(id, x, y) end
function love.touchreleased(id, x, y, pressure) gooi.released(id, x, y) end
function love.touchmoved(id, x, y, pressure) gooi.moved(id, x, y) end
It would be nice if you star my repo when using my code (or not), thanks :)
User avatar
ejmr
Party member
Posts: 302
Joined: Fri Jun 01, 2012 7:45 am
Location: South Carolina, U.S.A.
Contact:

Re: GOOi, an Android-Oriented GUI Library

Post by ejmr »

It would be nice if you star my repo when using my code (or not), thanks
You just got a star from me. Very terrific work. Thank you for sharing this!
ejmr :: Programming and Game-Dev Blog, GitHub
南無妙法蓮華經
User avatar
alberto_lara
Party member
Posts: 372
Joined: Wed Oct 30, 2013 8:59 pm

Re: GOOi, an Android-Oriented GUI Library

Post by alberto_lara »

Thanks buddy, my goal is to make GOOi the most popular GUI library for LÖVE and beat the others muahahaha :joker:

just kidding (or not?)
User avatar
scissors61
Citizen
Posts: 76
Joined: Fri Jan 08, 2016 10:16 am

Re: GOOi, an Android-Oriented GUI Library

Post by scissors61 »

Really like it! good work man!, I tried to use it for a japanese card game I'm making, but it makes love2d unable to print japanese text, even though your app says that it is multiligual and with utf8 support. The thing is that in order to draw japanese text I have to set an external set of japanese fonts, maybe using "gooi.font" interferes when setting external fonts in love2d.
User avatar
alberto_lara
Party member
Posts: 372
Joined: Wed Oct 30, 2013 8:59 pm

Re: GOOi, an Android-Oriented GUI Library

Post by alberto_lara »

scissors61 wrote:Really like it! good work man!, I tried to use it for a japanese card game I'm making, but it makes love2d unable to print japanese text, even though your app says that it is multiligual and with utf8 support. The thing is that in order to draw japanese text I have to set an external set of japanese fonts, maybe using "gooi.font" interferes when setting external fonts in love2d.

GOOi uses utf8.lua (as external), maybe there's an issue related to that library, could you please send a .love showing that?

EDIT: Maybe I forget something like this in gooi.draw():

Code: Select all

function gooi.draw()
    local previousFont = love.graphics.getFont()
    -- Draw GOOi here with the custom font --
    love.graphics.setFont(previousFont)
end
User avatar
scissors61
Citizen
Posts: 76
Joined: Fri Jan 08, 2016 10:16 am

Re: GOOi, an Android-Oriented GUI Library

Post by scissors61 »

Here it is!
Attachments
japanese.love
(3.01 MiB) Downloaded 219 times
User avatar
alberto_lara
Party member
Posts: 372
Joined: Wed Oct 30, 2013 8:59 pm

Re: GOOi, an Android-Oriented GUI Library

Post by alberto_lara »

Thanks, going to take a look (sorry for the delay).

EDIT: OK, I think I need to test in my home (I'm at work in Win 8.1) and see if it's something system-dependent (I have Linux at home), maybe I hastened to say GOOi is multilingual. Let me check that out and I'll tell you, GOOi does support characters like 'дфгтычкилёё#$&$/%ЬЪ*Ъ)=ЖЖЭЭ!Ээээ' (if the font used can support them), so again, I need to do some tests. Thanks for the feedback!

EDIT2: After playing a little more, it seems this is just an issue in my code (the way GOOi interacts with the Font LÖVE's API, maybe), as you can see, it seems to work well in the demo I have in Github (using the font in the .love you gave). Let me do some more tests, but hopefuly this is an easy fix:

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

Re: GOOi, an Android-Oriented GUI Library

Post by alberto_lara »

It seems gooi.font = font doesn't work, I think I left some dead code or something, this code:

Code: Select all

require "gooi"

function love.load()
	gr = love.graphics
	kb = love.keyboard
	mo = love.mouse

	font = gr.newFont("mgenplus-1c-medium.ttf", 40)
	gooi.font = font
	gooi.newButton("btn_1", "おかきくけこさしすせそがдфгтычкилёё#")
end

function love.update(dt)
	gooi.update(dt)
end

function love.draw()
	gooi.draw()
end

function love.mousepressed(x, y, btn)
	gooi.pressed()
end
function love.mousereleased(x, y, btn)
	gooi.released()
end
gives this result:

Image

Using the setStyle() method it seems to work, changing love.load() to this:

Code: Select all

function love.load()
	gr = love.graphics
	kb = love.keyboard
	mo = love.mouse

	style = {
		font = gr.newFont("mgenplus-1c-medium.ttf", 40)
	}

	gooi.setStyle(style)	
	gooi.newButton("btn_1", "おかきくけこさしすせそがдфгтычкилёё#")
end
gives you this:

Image

So yes, I think I dropped the 'gooi.font = font' functionality when the setStyle method was added, please use this last one to create the style you need :)

EDIT: As an example, the black style you see in the README file is set with this code:

Code: Select all

seriousBlack = {
      bgColor = {0, 0, 0, 127},
      fgColor = {255, 255, 255, 255},
      howRound = 0,
      showBorder = false,
      font = gr.newFont(dirFonts.."ProggySquare.ttf", 16)
   }
gooi.setStyle(seriousBlack)
User avatar
scissors61
Citizen
Posts: 76
Joined: Fri Jan 08, 2016 10:16 am

Re: GOOi, an Android-Oriented GUI Library

Post by scissors61 »

Already set the fonts with setStyle, as you said, and now It works, really cool, I'll keep on doing the app, didn't want in other way because I don't find another multilingual and android compatible lib. Thanks!
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, post updated, GOOi is now GÖÖi, added some gifs so you can see it in action (updated README in Github as well).
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests