Hi, when I enter the IsKeyPressed, XNA returns an error saying that Microsoft.XNA.Framework.Input.KeyboardState doesnt contain a definition for it and no extension method could be found, could you point out where Iv went wrong with this? Thanks
It is yelling at me over the line KeyboardState state = Keyboard.GetState(), telling me "The type of namespace name 'GetState' does not exist in the namespace 'Keyboard' (are you missing an assembly reference?)"
Glad you got it working. I was going to suggest that.
Technically, it's not the project name that is causing problems, but the namespace name. By default, the namespace at the root level is the same name as project, so there you go.
If you're curious about how to change just the namespace name, without changing the project name, let me know and I'll give you some more details about that.
Hi!
We start an monogame application using another thread as followed:
viThread = new Thread(startDemo);
viThread.Priority = ThreadPriority.Highest;
viThread.Start();
And inside startDemo:
using (Demo d = new Demo())
d.Run();
This works fine, and I press 'Esc' and it goes to Exit.Game(). Then I try start the monogame application again but this time it's only react on Touch/Mouse inputs, Keyboard.GetState() is always empty. My feeling is that i dont Dispose the objects/reference I need when I quit the application the first time sine the memory is increased as well.
That's an interesting way to do things.
You're restarting it in the same process the second time?
My gut feel is that it might actually be the opposite. Rather than not disposing something, you might be over-disposing something. The game will get disposed when it leaves the using block. I'm not sure what else it disposes in the process. Definitely some stuff. It assumes all of its dependencies are dead too, because the game is exiting. (I'm assuming you mean Game.Exit(), rather than Exit.Game(), right?)
When you try to restart the game the second time around, some of those things have been disposed. Perhaps something inside of the static Keyboard class. Though honestly, I don't know why mouse would be any different. (Mouse.GetState() works, right?)
What are you trying to accomplish with this? Would starting a new process, rather than a new thread, fix your problem? Launching a game is probably more often done in a new process, not in the same one as the launcher. Don't know if that helps much, but it's about as much as I can tell for now.