View Single Post
  #5 (permalink)  
Old May 18th, 2007, 05:59 PM
phsarjk phsarjk is offline
Registered User
Join Date: May 2007
Location: , , Denmark.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts

You're welcome. :D

Just be warned that i haven't checked the performance implications of accessing the GraphicsDevice.Viewport several times each frame. There just might be a reason Benjamin meant it was necessary to keep them in seperate variables. ;)

The solution in the book should have been:
int width,height;

protected override void LoadGraphicsContent(bool loadAllContent)
    if (loadAllContent)

    width = graphics.GraphicsDevice.Viewport.Width;
    height = graphics.GraphicsDevice.Viewport.Height;
However, I think Benjamin put the width and height in the Initialize method, which im a bit sceptical about.