user548084
user548084

Reputation: 499

Low FPS on WIndows 7 Phone Emulator

I'm writing a game for a Windows 7 Phone using XNA 4.0, Visual Studio 2010 Pro and the built in Windows 7 Phone Emulator. I downloaded a couple of GameState samples but I get very low FPS, even with no real graphics work going on. It stutters between 30, 15, then 10, just generally slow.

My computer's not a screamer but I have a Core I5 2.4ghz laptop and 4gb of RAM, so I gotta think it can keep up with whatever hardware is on a phone.

Any ideas? Is this normal? Maybe my way of measuring FPS is wrong (I use fps=1/gametime.elapsedtime.totalseconds)?

Upvotes: 1

Views: 467

Answers (2)

lysergic-acid
lysergic-acid

Reputation: 20050

In order to calculate your FPS, you can use this code:

//time since last FPS update in seconds
    float deltaFPSTime = 0;

    protected override void Update()
    {
        // The time since Update was called last
        float elapsed = (float)ElapsedTime.TotalSeconds;

        float fps = 1 / elapsed;
        deltaFPSTime += elapsed;
        if (deltaFPSTime>1)
        {

            Window.Title = "I am running at  <" + fps.ToString()+"> FPS";
            deltaFPSTime-=1;
        }
        // Let the GameComponents update
        UpdateComponents();
    }

Check for more samples of FPS counters there.

With this code in place, test if you're still getting weird results.

Upvotes: 0

Joel Martinez
Joel Martinez

Reputation: 47749

take a look at how the master measures FPS: http://blogs.msdn.com/b/shawnhar/archive/2007/11/23/game-timing-in-xna-game-studio-2-0.aspx

Upvotes: 0

Related Questions