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 .
Robin
The Omniscient
Posts: 6506 Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:
Post
by Robin » Thu Oct 28, 2010 6:47 pm
zac352 wrote: "Thanks" "people" of course wouldn't, unless you set the metatable of strings to automatically concatenate when __call is used.
Not even then, because you'd need to surround the first literal in parentheses.
Code: Select all
> getmetatable('').__call = function(self, other) return self..other end
> ='a' 'b'
stdin:1: '<eof>' expected near ''b''
> =('a') 'b'
ab
com_1
Prole
Posts: 44 Joined: Fri Oct 22, 2010 11:54 pm
Location: No Comment
Post
by com_1 » Thu Oct 28, 2010 9:18 pm
Code: Select all
function love.load()
scrx = 640; scry = 480; zx = (scrx/2); zy = (scry/2); zi = 200;
love.graphics.setMode(scrx, scry, false, true, 0);
love.graphics.setFont(30);
end
function love.draw()
love.graphics.line(zx - zi, zy, zx + zi, zy);
love.graphics.line(zx, zy - zi, zx, zy + zi);
-- please update this - "printF" code
love.graphics.printf("start".." ".."game" ,zx, zy, 0, "center")
end
Please update this - "printF" code
bartbes
Sex machine
Posts: 4946 Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:
Post
by bartbes » Thu Oct 28, 2010 9:32 pm
Well, using 0 as width seems pretty useless.
Robin
The Omniscient
Posts: 6506 Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:
Post
by Robin » Thu Oct 28, 2010 9:41 pm
com_1 wrote: Please update this - "printF" code
What do you mean? Is there a problem?
com_1
Prole
Posts: 44 Joined: Fri Oct 22, 2010 11:54 pm
Location: No Comment
Post
by com_1 » Thu Oct 28, 2010 10:01 pm
I want to add a simple word "start game" in the center of the screen.
Instead, the command "printF" divides it ("start game") in half.
what is wrong.
Here is the code.
love.graphics.printf("start game" ,320, 240, 0, "center")
nevon
Commander of the Circuloids
Posts: 938 Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:
Post
by nevon » Thu Oct 28, 2010 10:11 pm
com_1 wrote: I want to add a simple word "start game" in the center of the screen.
Instead, the command "printF" divides it ("start game") in half.
what is wrong.
Here is the code.
love.graphics.printf("start game" ,320, 240, 0, "center")
Your fourth argument is the limit. How far the string can go before it's split into more lines.
So if your screen is 800x600, and you want "start game" in the middle, you'd do:
Code: Select all
love.graphics.printf("Start game", 0, 300, 800, "center")
Just read the docs:
http://love2d.org/wiki/love.graphics.printf
com_1
Prole
Posts: 44 Joined: Fri Oct 22, 2010 11:54 pm
Location: No Comment
Post
by com_1 » Thu Oct 28, 2010 10:52 pm
Now everything is clear.
Code: Select all
scrx = 640; scry = 480;
love.graphics.printf("start game" , 0, (scry/2), scrx, "center")
Thanks for help. :]
com_1
Prole
Posts: 44 Joined: Fri Oct 22, 2010 11:54 pm
Location: No Comment
Post
by com_1 » Fri Nov 05, 2010 12:42 pm
Nobody wants to create a joint project on "Love2D" ?
Separately to create a hard and together, we force(power).
zac352
Party member
Posts: 496 Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:
Post
by zac352 » Fri Nov 05, 2010 12:56 pm
I know this is off topic, but some BBcode formatting in printf would be nice...
Hello, I am not dead.
Robin
The Omniscient
Posts: 6506 Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:
Post
by Robin » Fri Nov 05, 2010 2:20 pm
com_1 wrote: Nobody wants to create a joint project on "Love2D" ?
Separately to create a hard and together, we force(power).
Try practising some little things before trying to delve right into a big project.
@zac: very offtopic
but for something not quite but similar to what you want, see
RichText .
Users browsing this forum: Google [Bot] and 2 guests