r2d2-proton

Sleep();

Wait();

Slerp() -- lol




Re: XNA Game Studio Express How to grant time?

r2d2-proton

Never mind. . .rebooted.

I was missing a lot of XInput's (on a windows machine).

But it would be nice to know how to put a thread to sleep for a moment when needed.






Re: XNA Game Studio Express How to grant time?

Shawn Hargreaves - MSFT

How to grant time to what

A bit more detail about what you're trying to achieve would be useful here.





Re: XNA Game Studio Express How to grant time?

r2d2-proton

<code>

public bool ShowSplash( GraphicsDevice theDevice )
{
keyPressed =
false;

theDevice.Clear(
Color.CornflowerBlue );
UpdateHUD();
theDevice.Present();

while( ! keyPressed && ! lExit )
ReadControllers();

return lExit;
}

</code>

Since I was missing input's, I thought maybe the tight loop was causing the problem. At least in Win32 we can do a Peek/Get Message, which at least grants some time to the OS.

I'm not deriving from Game, and I wrote my own startup and supporting code.






Re: XNA Game Studio Express How to grant time?

Shawn Hargreaves - MSFT

If you're not using the XNA Game class, you'll need to use some other mechanism (perhaps WinForms, or direct p/invoke) to integrate with the Windows message dispatching infrastructure, just the same as you would for any native game. XNA isn't doing anything special to help you here.

If you use the Game class, XNA will take care of all that for you.





Re: XNA Game Studio Express How to grant time?

r2d2-proton

I was trying to make the Game class work for me but I ran in to some problems.

My basic flow is to:

Instantiate my main class, allowing the constructor to set up non-error-prone data members

Call Init(), which initializes the class* environment, including the Device and Content Manger (without content being loaded).

Execute Run(), which creates a Splash screen and depending on input either starts the game or exits. Incidentally, when returning from a game the Run loop will redisplay the splash screen again 每 unless of course an Exit is requested.

At each step, the classes can load and draw when they see fit since the GraphicsDevice is already established.

I think this approach differs from what the Game class expects, particularly since I couldn*t get drawing to occur in the BeginRun. I do have to state this with some hesitation though, it was late, but I don*t remember it working at that point (rendering I mean). And I checked it again 每 no success.

The SpaceWars code itself has to incorporate numerous gyrations to get the functionality they needed.

So yes, I would say that the Game class needs a rework.






Re: XNA Game Studio Express How to grant time?

Jim Perry

r2d2-proton wrote:
Incidentally, when returning from a game the Run loop will redisplay the splash screen again 每 unless of course an Exit is requested.

Well, yeah, you would expect a loop to do that wouldn't you

r2d2-proton wrote:
So yes, I would say that the Game class needs a rework.

Or your code does. There's nothing wrong with the Game class. It sounds like you need a better gamestate manager.






Re: XNA Game Studio Express How to grant time?

omniGames

r2d2, forget EVERYTHING you have previously learned about game coding!

XNA is a new paradigm. I had to unlearn some of the stuff I was certain would apply but no longer does. If you try to force XNA into a C++ way of running, you're only going to create headaches for yourself. Either start anew with XNA and do it the way it wants to do or stick with C++. But don't try to create some sort of "hybrid".

Just my 2 cents... :)





Re: XNA Game Studio Express How to grant time?

r2d2-proton

Since when is managing five screens a major task

And no, the Run loop doesn*t have to redisplay the Splash Screen 每 that*s not what makes it a loop.

You are also right that there is nothing wrong with the Game class. It*s perfect for people who have simple needs / designs.

And OMNI, I would appreciate reading more than your two cents 每 how about a dollars worth. What specifically have you run into that is making you change from normal practice

I*d like to inherit from the Game class, but I only want it to initialize the window, whether on the Xbox or PC, and let me call on it when I need it. Not the other way around.