View Single Post
  #8 (permalink)  
Old May 25th, 2007, 06:40 AM
dparsons dparsons is offline
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Setting a breakpoint would be your best bet. The thing about this book is that it is not a "Step by Step" type of book in that alot of coding is implied. (For example, the book doesn't explicitly tell you to set up all of the RenderSprites methods to reference the RenderSprite method with the signature: text, rect, sourceRect, color)

In any case, in your Program.cs file, set a breakpoint on PongGame.TestMenuSprites() this will allow you to trace the program flow of the game from the very begining. TestMenuSprites will call this overload of RenderSprite:

       public void RenderSprite(Texture2D texture, Rectangle rect, Rectangle? sourceRect)
        {
            RenderSprite(texture, rect, sourceRect, Color.White); //<--This call is important as it adds the texture to the list, without this reference, you list will be empty and DrawSprites() will exit as soon as you call it.
        }
Which, in turn, calls this overload of RenderSprite
        public void RenderSprite(Texture2D texture, Rectangle rect, Rectangle? sourceRect,
            Color color)
        {
            sprites.Add(new SpriteToRender(texture, rect, sourceRect, color));
        }
If I had to guess, I would think that you are not correctly calling the above RenderSprite that adds your texture to the list hence the call to DrawSprite() exits as soon as its entered since your List is empty.

hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========