draw box2d world bigger than screen

BlitzMax Forums/Brucey's Modules/draw box2d world bigger than screen

slenkar(Posted 2008) [#1]
How would I draw a box2d world bigger than the screen?

I was thinking of adding 2 global integer variables camerax and cameray

but then how would I offset the drawing commands?


slenkar(Posted 2008) [#2]
I wanted the camera to track the player and I put offsets in the drawing code and it worked to a degree...the lines stayed in the same place but the rigid-bodies moved correctly.
Also the screen jumps frames for some reason, I put the update code in dostep() maybe thats why.


Brucey(Posted 2008) [#3]
So long as you aren't using debugdraw - is only really for... debugging. The "test" framework gives you an idea for handling update/draw etc, but it probably isn't what you want to use as a final implementation.

I've been meaning to look into this same problem for a project of mine.
It shouldn't be too difficult. Once you scale up your coordinates it should be relatively easy to centre your drawing around your main character.
You can step-through all bodies for drawing, and if they are on-screen, draw them relative to your character.


slenkar(Posted 2008) [#4]
yeah im using the 'test framework'
how would i scale the co-ords?


jkrankie(Posted 2008) [#5]
couldn't you do this with viewports?

Cheers
Charlie