Re: GÖÖi, an Android-Oriented GUI Library
Posted: Wed Feb 22, 2017 12:44 pm
Post a .love file with an example of the problem
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"
})
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()
Code: Select all
local mx = love.mouse.getX()/ratio
local my = love.mouse.getY()/ratio
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.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)
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:yetneverdone wrote: ↑Mon Apr 10, 2017 3:52 pmApparently ive also tried that method,it didn't work. What worked was that changing then gooi.sx and gooi.sy even wthout a canvas.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)
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