Page 4 of 10

Re: I have a question.

Posted: Thu Oct 28, 2010 6:47 pm
by Robin
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

Re: I have a question.

Posted: Thu Oct 28, 2010 9:18 pm
by com_1

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

Re: I have a question.

Posted: Thu Oct 28, 2010 9:32 pm
by bartbes
Well, using 0 as width seems pretty useless.

Re: I have a question.

Posted: Thu Oct 28, 2010 9:41 pm
by Robin
com_1 wrote:Please update this - "printF" code
What do you mean? Is there a problem?

Re: I have a question.

Posted: Thu Oct 28, 2010 10:01 pm
by com_1
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")

Re: I have a question.

Posted: Thu Oct 28, 2010 10:11 pm
by nevon
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

Re: I have a question.

Posted: Thu Oct 28, 2010 10:52 pm
by com_1
Now everything is clear.

Code: Select all

scrx = 640; scry = 480; 
love.graphics.printf("start game" , 0, (scry/2), scrx, "center")
Thanks for help. :]

Re: I have a question.

Posted: Fri Nov 05, 2010 12:42 pm
by com_1
Nobody wants to create a joint project on "Love2D" ?

Separately to create a hard and together, we force(power).

Re: I have a question.

Posted: Fri Nov 05, 2010 12:56 pm
by zac352
I know this is off topic, but some BBcode formatting in printf would be nice...

Re: I have a question.

Posted: Fri Nov 05, 2010 2:20 pm
by Robin
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 :roll:
but for something not quite but similar to what you want, see RichText.