View Single Post
  #6 (permalink)  
Old May 24th, 2007, 09:55 PM
abi.exdream.com abi.exdream.com is offline
Wrox Author
 
Join Date: May 2007
Location: Hannover, , Germany.
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to abi.exdream.com
Default

Yup, width/height are just cached because they are accessed many times, especially in later games of the book. And it is not only faster this way, but also a lot easier to find out about the width/height of the render area by just typing BaseGame.Width, etc. later.

The reason it is in the Initialize method is because there was no LoadGraphicsContent in beta1, but I tried to refactor the code last month and put more stuff from the Initialize method to LoadGraphicsContent.

In more complex games you could also allow resizing and make sure that with every resize event the width/height values get updated correctly.

http://abi.exdream.com