I have a question.

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.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: I have a question.

Post 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
Help us help you: attach a .love.
User avatar
com_1
Prole
Posts: 44
Joined: Fri Oct 22, 2010 11:54 pm
Location: No Comment

Re: I have a question.

Post 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
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: I have a question.

Post by bartbes »

Well, using 0 as width seems pretty useless.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: I have a question.

Post by Robin »

com_1 wrote:Please update this - "printF" code
What do you mean? Is there a problem?
Help us help you: attach a .love.
User avatar
com_1
Prole
Posts: 44
Joined: Fri Oct 22, 2010 11:54 pm
Location: No Comment

Re: I have a question.

Post 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")
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: I have a question.

Post 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
User avatar
com_1
Prole
Posts: 44
Joined: Fri Oct 22, 2010 11:54 pm
Location: No Comment

Re: I have a question.

Post 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. :]
User avatar
com_1
Prole
Posts: 44
Joined: Fri Oct 22, 2010 11:54 pm
Location: No Comment

Re: I have a question.

Post by com_1 »

Nobody wants to create a joint project on "Love2D" ?

Separately to create a hard and together, we force(power).
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: I have a question.

Post by zac352 »

I know this is off topic, but some BBcode formatting in printf would be nice...
Hello, I am not dead.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: I have a question.

Post 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.
Help us help you: attach a .love.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 2 guests