Drawing primitives like circles and rectangles

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.
iamwilhelm
Prole
Posts: 16
Joined: Thu Feb 12, 2009 5:53 pm
Contact:

Drawing primitives like circles and rectangles

Post by iamwilhelm »

It's not well documented in the docs, and it took me a bit to figure out. In order to draw primitives, first you need to set the width of the line.

Code: Select all

function load()
  love.graphics.setLine(1)
end
Then, the docs don't mention how to set the type of drawing. It's a constant, rather than a string

Code: Select all

love.graphics.rectangle(love.draw_line, 100, 100, 50, 50)
osuf oboys
Party member
Posts: 215
Joined: Sun Jan 18, 2009 8:03 pm

Re: Drawing primitives like circles and rectangles

Post by osuf oboys »

iamwilhelm wrote:It's not well documented in the docs, and it took me a bit to figure out. In order to draw primitives, first you need to set the width of the line.

Code: Select all

function load()
  love.graphics.setLine(1)
end
You do not need to set the line width.
Then, the docs don't mention how to set the type of drawing. It's a constant, rather than a string

Code: Select all

love.graphics.rectangle(love.draw_line, 100, 100, 50, 50)
Most examples cover this but you're right that the documentation should also mention it. Could you perhaps add it to the issue tracker (one of the links at the top of the page).
If I haven't written anything else, you may assume that my work is released under the LPC License - the LÖVE Community. See http://love2d.org/wiki/index.php?title=LPC_License.
iamwilhelm
Prole
Posts: 16
Joined: Thu Feb 12, 2009 5:53 pm
Contact:

Re: Drawing primitives like circles and rectangles

Post by iamwilhelm »

I tried it out again to reproduce it. It only happens with rectangles.

Code: Select all

love.graphics.rectangle(love.draw_line, 100, 100, 200, 200)
without setting the width, it doesn't show up. I'll put it as a bug in the issue tracker
osuf oboys
Party member
Posts: 215
Joined: Sun Jan 18, 2009 8:03 pm

Re: Drawing primitives like circles and rectangles

Post by osuf oboys »

iamwilhelm wrote:I tried it out again to reproduce it. It only happens with rectangles.

Code: Select all

love.graphics.rectangle(love.draw_line, 100, 100, 200, 200)
without setting the width, it doesn't show up. I'll put it as a bug in the issue tracker
What system are you using? I have not heard anyone voice such an issue before.
If I haven't written anything else, you may assume that my work is released under the LPC License - the LÖVE Community. See http://love2d.org/wiki/index.php?title=LPC_License.
iamwilhelm
Prole
Posts: 16
Joined: Thu Feb 12, 2009 5:53 pm
Contact:

Re: Drawing primitives like circles and rectangles

Post by iamwilhelm »

osuf oboys wrote:
iamwilhelm wrote:I tried it out again to reproduce it. It only happens with rectangles.

Code: Select all

love.graphics.rectangle(love.draw_line, 100, 100, 200, 200)
without setting the width, it doesn't show up. I'll put it as a bug in the issue tracker
What system are you using? I have not heard anyone voice such an issue before.
I'm using Ubuntu 8.10 Intrepid. Lua 5.1.3 and Love 0.5.0. Are there other system info that you need?
osuf oboys
Party member
Posts: 215
Joined: Sun Jan 18, 2009 8:03 pm

Re: Drawing primitives like circles and rectangles

Post by osuf oboys »

iamwilhelm wrote:
osuf oboys wrote:
iamwilhelm wrote:I tried it out again to reproduce it. It only happens with rectangles.

Code: Select all

love.graphics.rectangle(love.draw_line, 100, 100, 200, 200)
without setting the width, it doesn't show up. I'll put it as a bug in the issue tracker
What system are you using? I have not heard anyone voice such an issue before.
I'm using Ubuntu 8.10 Intrepid. Lua 5.1.3 and Love 0.5.0. Are there other system info that you need?
Yes, thank you.

Try running a LÖVE application that does not contain anything except

Code: Select all

function draw(); love.graphics.rectangle(love.draw_line, 100, 100, 200, 200); end
If I haven't written anything else, you may assume that my work is released under the LPC License - the LÖVE Community. See http://love2d.org/wiki/index.php?title=LPC_License.
User avatar
Skofo
Party member
Posts: 146
Joined: Mon Dec 22, 2008 10:55 pm

Re: Drawing primitives like circles and rectangles

Post by Skofo »

Remove the semicolon after 'function draw()', braw. ;)

EDIT: Actually, you can remove all semicolons. You don't ever need them, as far as I know.
Working on: Viator
Need a 64-bit Debian package for LÖVE? Here it is!
iamwilhelm
Prole
Posts: 16
Joined: Thu Feb 12, 2009 5:53 pm
Contact:

Re: Drawing primitives like circles and rectangles

Post by iamwilhelm »

osuf oboys wrote: Try running a LÖVE application that does not contain anything except

Code: Select all

function draw(); love.graphics.rectangle(love.draw_line, 100, 100, 200, 200); end
yeah, the same thing happens. no rectangle unless I set the line width.

Wil
User avatar
Skofo
Party member
Posts: 146
Joined: Mon Dec 22, 2008 10:55 pm

Re: Drawing primitives like circles and rectangles

Post by Skofo »

iamwilhelm wrote:
osuf oboys wrote: Try running a LÖVE application that does not contain anything except

Code: Select all

function draw(); love.graphics.rectangle(love.draw_line, 100, 100, 200, 200); end
yeah, the same thing happens. no rectangle unless I set the line width.

Wil
That is quite odd, I got a white rectangle. I'm running the same things as iamwillhelm. Did you try changing the background color to see if it's making a black rectangle for you?
Working on: Viator
Need a 64-bit Debian package for LÖVE? Here it is!
osuf oboys
Party member
Posts: 215
Joined: Sun Jan 18, 2009 8:03 pm

Re: Drawing primitives like circles and rectangles

Post by osuf oboys »

Skofo wrote:
iamwilhelm wrote:
osuf oboys wrote: Try running a LÖVE application that does not contain anything except

Code: Select all

function draw(); love.graphics.rectangle(love.draw_line, 100, 100, 200, 200); end
yeah, the same thing happens. no rectangle unless I set the line width.

Wil
That is quite odd, I got a white rectangle. I'm running the same things as iamwillhelm. Did you try changing the background color to see if it's making a black rectangle for you?
Might it be related to how, occasionally, drawing text without setting the font may cause the text to be drawn with some other font?
If I haven't written anything else, you may assume that my work is released under the LPC License - the LÖVE Community. See http://love2d.org/wiki/index.php?title=LPC_License.
Post Reply

Who is online

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