Wrox Programmer Forums
|
BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6
This is the forum to discuss the Wrox book Professional XNA Game Programming: For Xbox 360 and Windows by Benjamin Nitschke; ISBN: 9780470126776
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 26th, 2007, 09:37 PM
Authorized User
 
Join Date: Feb 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jnbutler
Default Trying to understand execution flow

I think I have my brain around how the XNA game execution flows but correct me if I have this wrong.

When you start the game the <yourgame>Game.StartGame() is called from the Program.cs class file which creates a new <yourgame>Game object(all of the variables get assigned initial values and the constructor creates a new Graphics Device Manager, and a new Content Manager) then calls game.run().
This calls Initialize() and executes all the code there and at the end calls base.Initialize() and this calls LoadGraphicsContent()
(base.Initialize() I assume is something within XNA framework behind the scenes?) then it returns to Initialize() and goes on to the Update().

From what I could tell stepping through it with the debugger, this is where the loop starts. Update() runs it's code and at the bottom base.Update() calls Draw() runs it's code and then at the bottom base.Draw() calls Update() and the loop continues until the game is exited.

Please let me know if I got something wrong in that flow.
Thanks

jnbutler
__________________
jnbutler
 
Old August 4th, 2007, 04:55 PM
Registered User
 
Join Date: Aug 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I believe what happens is after your game has initialized itself, the application enters loop like below.
Code:
while (!isApplicationReadyToQuit) {...}
Inside that loop calls to Update() and Draw() are made. Now depending on what type of game timing is established will determine how often the Update() and Draw() methods get called. This is hidden by the framework.

The base.* versions of these methods are only responsible for executing the base functionality of the base class. I do not believe they make calls back and forth to each other. For example, base.Update() calls Draw() and vice versa.

Does that make sense?





Similar Threads
Thread Thread Starter Forum Replies Last Post
I don't understand... jmsherry ASP.NET 2.0 Basics 17 July 23rd, 2007 12:28 PM
I still do not understand aude_poullain ASP.NET 1.0 and 1.1 Basics 2 February 7th, 2007 09:11 PM
Flow of execution of .NET assembly? karveajit .NET Framework 2.0 0 December 18th, 2006 09:15 AM
Who can understand this book? HandSomeLi All Other Wrox Books 2 October 20th, 2004 04:12 PM
i can't understand this error! ion Classic ASP Databases 2 September 23rd, 2003 03:57 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.