Box2D Forums

It is currently Tue May 21, 2013 12:19 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue May 29, 2012 1:46 am 
Offline

Joined: Thu Oct 06, 2011 6:20 am
Posts: 8
Guys... am I missing the point or has someone not put much thought into what should be b2internal and what should be private?
I've just come to subclass b2DebugDraw, I could write my own class to handle all the drawing but I figured it'd be convenient to subclass b2DebugDraw and override a few functions..

All I want to do is specify a LineScaleMode when drawing shapes, and either I have to write a class from scratch to draw the world, or I have to swap all the references to member variables to a local variable and function call, what a load of ball baggery for the want of changing one thing!!

It's not the first time I've had to fiddle about thanks to some things being private that would be really handy if exposed. Like I asked, am I missing the point here? If not, I'd be more than happy to contribute!!


Top
 Profile  
 
PostPosted: Tue May 29, 2012 11:16 am 
Offline

Joined: Sun Oct 25, 2009 3:28 am
Posts: 242
Yeah, there are no direct way to set the LineScaleMode. Although Box2D's debug draw can be used as the main way to draw the world, you'll be limited with what you can do (i.e. images and line types). I think you can still override the actual drawing functions of debug draw so you won't have to make everything from the ground up, but you will have to update the debug draw yourself in the update loop rather than through the world (because the drawing functions are not virtual).


Top
 Profile  
 
PostPosted: Wed May 30, 2012 1:40 am 
Offline

Joined: Thu Oct 06, 2011 6:20 am
Posts: 8
Man what a pain, I did end up just overriding the debug draw functions (they are virtual, at least in 2.1a) and had to switch all the m_ variables for local variables which I set with functions

Would be really nice if box2d was a bit more extensible


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group