Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help,
read this.
-
WAWAWA
- Prole
- Posts: 32
- Joined: Fri Aug 13, 2021 5:10 pm
Post
by WAWAWA »
I am very confused, as I have never created buttons before. I don't understand this, the text goes off when I do the following equation:
Code: Select all
love.graphics.print(
text, font,
(w/2) - #text,y
)
text = "Play Game"
font = Normal font
w = width of the box
h = height of the box
x = x pos of the box
y = y pos of the box
-
dusoft
- Party member
- Posts: 705
- Joined: Fri Nov 08, 2013 12:07 am
- Location: Europe usually
-
Contact:
Post
by dusoft »
-
BrotSagtMist
- Party member
- Posts: 664
- Joined: Fri Aug 06, 2021 10:30 pm
Post
by BrotSagtMist »
May you give screenshot or actual code to what you get wrong?
Edit:
Actually i have a template for buttons, this is how i do them usually:
obey
-
bizziboi
- Citizen
- Posts: 57
- Joined: Sat Apr 16, 2011 9:24 am
Post
by bizziboi »
I am guessing your problem is that you subtract the number of characters in the the label in pixels.
You want to get the width of the rendered string and divide that by two instead?
Users browsing this forum: Bing [Bot], Google [Bot] and 8 guests