Comments (2)
I've noticed that comp:setAlign("center")
throws it off as well, but sometimes using component.align = "center"
or just calling center in gooi.newButton({align = "center"})
agruments works. Sometimes... Not always
from gooi.
The issue about the buttons not fitting the text is now fixed in version 0.0.2, I was unable to reproduce the second issue about the text alignment, a small snippet reproducing the issue may help me.
I had to make some decisions about how the buttons react to changes in the font size, take a look at this example (and run it if you have a chance):
require "gooi"
function love.load()
gr = love.graphics
kb = love.keyboard
mo = love.mouse
bigFont = gr.newFont(18)
btn1 = gooi.newButton("gooi.alert()"):onRelease(function()
gooi.alert("alert!");
end)
btn2 = gooi.newButton("gooi.confirm()"):onRelease(function()
gooi.confirm("Choose", function()
gooi.alert("You clicked yes! :)");
end, function()
gooi.confirm("Are you sure? :(", function()
gooi.alert("I'M CRYIIIIING")
end, function()
gooi.alert("Good, I have a chance :)")
end)
end)
end)
btn3 = gooi.newButton("button 3")
joyGame = gooi.newJoy()
btnShoot = gooi.newButton("Shoot")
lblLife = gooi.newLabel("Life:")
lblLife.w = 60
barLife = gooi.newBar(0.9)
gridPanel = gooi.newPanel(320, 140, 450, 100, "grid 3x3"):add(btn1, btn2):add(btn3, "3,2")
gamePanel = gooi.newPanel(320, 260, 350, 250, "game")
gamePanel:add(joyGame, "b-l")
gamePanel:add(btnShoot, "b-r")
gamePanel:add(lblLife, "t-l")
gamePanel:add(barLife, "t-l")
comps = {
gooi.newLabel("this is a label", 10, 10):setOpaque(true),
gooi.newButton("Tooltip button", 10, 60, 300, 20):setTooltip("this is a tooltip"),
gooi.newSlider(.75, 10, 110),
gooi.newCheck("this is a check box", 10, 160),
gooi.newRadio("this is a radio", "rg1", 10, 210),
gooi.newText("this is a text box", 10, 260),
gooi.newBar(.7, 10, 310),
gooi.newSpinner(0, 200000, 150, 10, 360),
gooi.newJoy(10, 410),
gooi.newKnob(.9, 320, 10),
gridPanel,
btn1,
btn2,
btn3,
gooi.newButton("Change style", 320, 520):onRelease(function()
for i = 1, #comps do
comps[i]:setStyle({
font = bigFont,
bgColor = "#FF8800AA"
})
end
end):bg("#00FF0088"),
joyGame,
btnShoot,
lblLife,
barLife,
}
-- This enables tooltips and make dialogs smaller:
gooi.desktopMode()
end
function love.update(dt)
gooi.update(dt)
end
function love.draw()
gr.rectangle("line", gridPanel.x, gridPanel.y, gridPanel.w, gridPanel.h)
gr.rectangle("line", gamePanel.x, gamePanel.y, gamePanel.w, gamePanel.h)
gooi.draw()
gr.print("FPS: "..love.timer.getFPS())
end
function love.mousereleased(x, y, button) gooi.released() end
function love.mousepressed(x, y, button) gooi.pressed() end
function love.textinput(text)
gooi.textinput(text)
end
function love.keypressed(key)
gooi.keypressed(key)
if key == "escape" then
quit()
end
end
function quit()
love.event.quit()
end
Before pressing "Change style":
After:
Note:
- Components inside a panel don't change their proportions
- Free components with no text attribute (Joysticks, Progress bars, etc.) keep their bounds too
- Only free elements with a text component react to font size changes
- The component bounds fit the text of the new font
from gooi.
Related Issues (20)
- nested panel example HOT 2
- attempt to call field 'toPixels' (a nil value) HOT 1
- Image background for buttons, sliders etc... HOT 2
- slider seems to be broken when following the wiki's getting started examples HOT 2
- gooi.confirm() font does not scale correctly HOT 1
- exit button fails from example one HOT 1
- Textfield's `setText` should probably set the text rather than merely append to it. HOT 2
- Add button before call "panel:setVisible(false)" will not hide those button HOT 3
- Documentation Images 404ing HOT 2
- phone devices `setTextInput` with area parameters HOT 2
- Is there a way to completely treat components as visual? HOT 1
- Version mismatch HOT 1
- How to use multitouch joysticks, buttons in android screen, and if gooi suport that HOT 3
- Stopping all other touch input besides pressed button. HOT 2
- Scrolling HOT 1
- keep button pressed perform constant action HOT 2
- setStyle component change width and height HOT 1
- how i can change text size ? HOT 2
- how i can change colore ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gooi.