Page 1 of 2
White Screen upon Startup
Posted: Sat Dec 17, 2011 11:04 am
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
Re: White Screen upon Startup
Posted: Sat Dec 17, 2011 11:08 am
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.
Re: White Screen upon Startup
Posted: Sat Dec 17, 2011 5:52 pm
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?
Re: White Screen upon Startup
Posted: Sat Dec 17, 2011 10:25 pm
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?
Re: White Screen upon Startup
Posted: Sun Dec 18, 2011 8:09 am
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
Re: White Screen upon Startup
Posted: Sun Dec 18, 2011 11:29 am
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?
Re: White Screen upon Startup
Posted: Sun Dec 18, 2011 9:19 pm
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.
Re: White Screen upon Startup
Posted: Sun Dec 18, 2011 11:32 pm
by fparedesg
Thanks for all your help!
Re: White Screen upon Startup
Posted: Tue Dec 20, 2011 8:27 pm
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
Re: White Screen upon Startup
Posted: Tue Dec 20, 2011 8:57 pm
by bartbes
He actually means Terminal.app
.