White Screen upon Startup

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.
fparedesg
Prole
Posts: 13
Joined: Thu Dec 15, 2011 8:47 am

White Screen upon Startup

Post by fparedesg »

Hi there!

I've been trying out the physics module, just so I can get the hang of it. However, when trying to create a polygon shape, it fails. The löve file simply opens, shows a white screen, and crashes/closes.

I've removed all the non-error-causing code, and am left with this:

Code: Select all

function love.load()
	world = love.physics.newWorld(0, 0, 800, 600)
	world:setGravity(0, 0)
	body = love.physics.newBody(world, 400, 300, 100, 0)
	shape = love.physics.newPolygonShape(body, 0, 0, 1, 0, 0, 1)
end
This snippet of code still causes the error. I've pinpointed the error to be caused by the fourth line (if commented, nothing happens). What am I doing wrong?

Thanks!

EDIT: I've attached the .love file
Attachments
love.love
(662 Bytes) Downloaded 191 times
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: White Screen upon Startup

Post by Robin »

The error (which is printed in the terminal) is:

Code: Select all

love: modules/physics/box2d/Source/Collision/Shapes/b2PolygonShape.cpp:224: b2PolygonShape::b2PolygonShape(const b2ShapeDef*): Assertion `d.x >= 0.0f' failed.
Basically, your polygon is too small. It's about 2x2 pixels. If you change it to

Code: Select all

   shape = love.physics.newPolygonShape(body, 0, 0, 10, 0, 0, 10)
it doesn't crash.
Help us help you: attach a .love.
fparedesg
Prole
Posts: 13
Joined: Thu Dec 15, 2011 8:47 am

Re: White Screen upon Startup

Post by fparedesg »

Awesome! Thanks!

Also, I also noticed that this polygon failed:

Code: Select all

shape = love.physics.newPolygonShape(body, 0, -10, 0, 10, 30, 0)
which seems to be a decently sized polygon. Why is that so?

Also, how can I check said terminal?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: White Screen upon Startup

Post by Robin »

fparedesg wrote:which seems to be a decently sized polygon. Why is that so?
It's counterclockwise. Box2d needs polygons to be clockwise. Switch two points around and it should be good.
fparedesg wrote:Also, how can I check said terminal?
Just run LÖVE in the terminal. What OS are you on?
Help us help you: attach a .love.
fparedesg
Prole
Posts: 13
Joined: Thu Dec 15, 2011 8:47 am

Re: White Screen upon Startup

Post by fparedesg »

Robin wrote:It's counterclockwise. Box2d needs polygons to be clockwise. Switch two points around and it should be good.
I didn't see that in the module..my bad. Thanks!
Robin wrote:Just run LÖVE in the terminal. What OS are you on?
I'm using OS X 10.7.2
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: White Screen upon Startup

Post by Robin »

fparedesg wrote:I'm using OS X 10.7.2
Can one of the Mac guys please explain how to run LÖVE in the terminal?
Help us help you: attach a .love.
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: White Screen upon Startup

Post by Jasoco »

Robin wrote:
fparedesg wrote:I'm using OS X 10.7.2
Can one of the Mac guys please explain how to run LÖVE in the terminal?
Easy. The love binary is contained inside the love.app package. So assuming your love.app is in /Applications and your .love file is on the ~/Desktop:

Code: Select all

/Applications/love.app/Contents/MacOS/love ~/Desktop/yourgame.love
If your path has a space in its folder name, make sure to either surround the whole path with quotes, or place a \ before the spaces.
For instance:

Code: Select all

"/Applications/Love Apps/love.app/Contents/MacOS/love"
~/Desktop/My\ Game/yourgame.love
Where the first line demonstrates the first method and the second line demonstrates the other method. Note the backslash before the space in "My Game" or the quotes around the entire command in the first line.

I find it easier to navigate to the love binary via the Finder (Right-click or Control-Click or two-finger click -- depending on your input method -- on the love.app bundle and choose "Show Package Contents" then keep navigating into Contents/MacOS/ and drag the "love" file into the Terminal FIRST. Then go to the desktop, or wherever the .love file is located and drag it into the Terminal SECOND. Then you won't have to worry about typing the whole thing. Soooo much easier.

Using Löve this way will let you print stuff to the console for debugging purposes. I never run without the Terminal.
fparedesg
Prole
Posts: 13
Joined: Thu Dec 15, 2011 8:47 am

Re: White Screen upon Startup

Post by fparedesg »

Thanks for all your help!
coffee
Party member
Posts: 1206
Joined: Wed Nov 02, 2011 9:07 pm

Re: White Screen upon Startup

Post by coffee »

Robin wrote:
fparedesg wrote:I'm using OS X 10.7.2
Can one of the Mac guys please explain how to run LÖVE in the terminal?
The terminal you are perhaps thinking is called (in osx) console.app. You can see the LOVE output there. I call it for some LOVE debugging.

EDITED: is something like this you were thinking robin?

EDITED2: fparedesg see inside Applications/Utilities folder for console.app or call it from the Spotlight
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: White Screen upon Startup

Post by bartbes »

He actually means Terminal.app ;).
Post Reply

Who is online

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