Aspect Ratio Question

Feb 16, 2011 at 7:36 PM

I've experimented a little with the "Farseer Physics Engine 3.2 SimpleSamples Silverlight" Stuff and I've hit one issue that I have a hard time to understand.

When I change the Dimensions of the Canvas defined in MainPage.xaml from the 500x500 Square Dimensions to let's say 800x600 everything gets skewed (the Square shape in Demo1Screen becomes a rectangle for example) as if the Aspect Ratio of the Canvas would somehow work like a pixel aspect ratio. 

Could anyone explain to me why this happens and how I can fix this? :)

Developer
Feb 23, 2011 at 8:35 AM

That is because the Screenmanager always returns a width and height of 50 (it is hardcoded) and calculates a scale factor to map that to the actual canvas resolution. That way the samples are resolution independent but your aspect ration breaks if the canvas' aspect ratio changes. Try setting screenmanager width and height based on the aspect ratio e.g. try something like width = 50, height = 50 * aspect ratio.