GOOi, an Android-Oriented GUI Library

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

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

Post by Positive07 »

Post a .love file with an example of the problem
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
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 »

Hey guys just to let you know I just released version 0.0.3 of GÖÖi, the main changes are these:
  • Added multiline labels
    Now labels can have a text with new line ("\n") characters, multiline alignment works fine now.
  • Added multiline buttons
    Same for buttons
  • Modal improvements
    Modals can be created like this now:

    Code: Select all

    gooi.alert({
        msg = "This is an alert!",
        ok = function()
            gooi.alert("You pressed Yup")
        end,
        okText = "Yup"
    })
    gooi.confirm({
        msg = "Do you like GÖÖi?",
        ok = function()
            gooi.alert("Yay!")
        end,
        cancel = function()
            gooi.alert(":(")
        end,
        okText = "Yup",
        cancelText = "Nope"
    })
    
  • Joystick improvements
    Now the Joystick component is probably the most flexible one, it can be used/created with these configurations (and they can be used in any combination):
    • Code: Select all

      -- Normal joystick, it will be moved when clicking/touching over the white circle or image:
      gooi.newJoy()
      
    • Code: Select all

      -- Image Joystick, it will replace the white circle by an image, scaled to keep the same proportions:
      gooi.newJoy():setImage("/imgs/cat.png")
      
    • Code: Select all

      -- No spring, the image or circle won't return to the center place once released:
      gooi.newJoy():noSpring()
      
    • Code: Select all

      -- This will cause to draw the image with scale = 1:
      gooi.newJoy():setImage("/imgs/cat.png"):noScaling()
      
    • Code: Select all

      -- So you don't need to touch/click over the circle or image to actually move the joystick:
      gooi.newJoy():anyPoint()
      
    • Code: Select all

      -- Converts from analog to a digital one, 8 directions
      -- (with this enabled, use Joystick:direction() to get the value, not xValue() or yValue()):
      gooi.newJoy():setDigital()
      
  • Fixed: apply style to children when applying to panel
User avatar
yetneverdone
Party member
Posts: 448
Joined: Sat Sep 24, 2016 11:20 am
Contact:

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

Post by yetneverdone »

Im having problem using the joystick, it seems that I can't make the circle move

EDIT:
It seems that the gooi.pressed and gooi.released need argument to properly work.

Althought it is misbehaving since im using these mouse coordinates

Code: Select all

local mx = love.mouse.getX()/ratio
local my = love.mouse.getY()/ratio
Any idea on how to properly make it work?
animation.gif
animation.gif (140.76 KiB) Viewed 9469 times
User avatar
yetneverdone
Party member
Posts: 448
Joined: Sat Sep 24, 2016 11:20 am
Contact:

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

Post by yetneverdone »

Ooooops. Nevermind, Ive fixed it though.

Apparently i need to change gooi.sx and gooi.sy to my game's ratio

OP, you should definitely add the instruction to change the gooi.sx and gooi.sy to the game's proper ratio in the wiki. (Or i might just do that seeing that the wiki page is open for changes :))
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 »

Hey, sorry for the delay... and you're right, you should use gooi.setCanvas(myCanvas) right after you create the canvas for your game (this changes gooi.sx and gooi.sy)
User avatar
yetneverdone
Party member
Posts: 448
Joined: Sat Sep 24, 2016 11:20 am
Contact:

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

Post by yetneverdone »

alberto_lara wrote: Mon Apr 10, 2017 3:09 pm Hey, sorry for the delay... and you're right, you should use gooi.setCanvas(myCanvas) right after you create the canvas for your game (this changes gooi.sx and gooi.sy)
Apparently ive also tried that method,it didn't work. What worked was that changing then gooi.sx and gooi.sy even wthout a canvas.
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 »

I'm going to check that out, thanks for the heads up!
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, I've made some changes to GOOi and it's now in version 0.0.4. (not "GÖÖi" anymore, just GOOi)

This is the new "official" logo:
Image

And here's the new look:
Image
Last edited by alberto_lara on Wed Apr 26, 2017 9:40 pm, edited 3 times 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 »

yetneverdone wrote: Mon Apr 10, 2017 3:52 pm
alberto_lara wrote: Mon Apr 10, 2017 3:09 pm Hey, sorry for the delay... and you're right, you should use gooi.setCanvas(myCanvas) right after you create the canvas for your game (this changes gooi.sx and gooi.sy)
Apparently ive also tried that method,it didn't work. What worked was that changing then gooi.sx and gooi.sy even wthout a canvas.
I've used this code in the new version and it seems to work well, I didn't move anything related to scaling so it should work in version 0.0.3 as well:

Code: Select all

require "gooi"

function love.load()
    gr = love.graphics

    canvas = gr.newCanvas(150, 100)
    canvas:setFilter("nearest", "nearest")
    sx = gr.getWidth() / canvas:getWidth()
    sy = gr.getHeight() / canvas:getHeight()

    gooi.setCanvas(canvas)
    gooi.newJoy({size = 30})
end

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

function love.draw()
    gr.setCanvas(canvas)
    gr.clear(0, 0, 0)
    gooi.draw()
    gr.setCanvas()
    gr.draw(canvas, 0, 0, 0, sx, sy)
end

function love.mousepressed(x, y, btn)  gooi.pressed() end
function love.mousereleased(x, y, btn) gooi.released() end
lgktg
Prole
Posts: 2
Joined: Tue May 02, 2017 7:17 am

Re: GOOi, an Android-Oriented GUI Library

Post by lgktg »

I tried to adapt the librairy to work with cameras (http://nova-fusion.com/2011/04/19/camer ... he-basics/) by modifying gooi.pressed() but i wasn't able to make it work. Any advices ?
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests