|
I've tried that (for the main class) in other classes with this exact code, but it doesn't exit.
- I love D-flat!
|
|
|
|
|
Really, your game shouldn't be exiting from a child class. Any child classes should be notifying the parent classes that an exit is required. Your top level code should be doing the cleanup and exiting.
|
|
|
|
|
Really? I thought everything for input goes in the Input class.ShouldI keep input unified with the main class?
- I love D-flat!
|
|
|
|
|
Exiting an application is not input. It's more of a "command" or "request". It's up to the input processor to create the appropriate command to send back to the main loop of your game.
|
|
|
|
|
Oh, well... Thanks. But, it seems that I can't check 'input' in any class but the main? Can I please have a brief concept example?
- I love D-flat!
|
|
|
|
|
Pass the game class over to the child class in the constructor and use the game.Exit() method from there.
It's no more complicated than that.
You can use the XNA.Framework.Input.Keyboard.GetState(PlayerIndex playerIndex).IsKeyDown(Keys key) method to check for key presses.
In future, like someone said above, use the XNA creators forums. They are very good, and have the guys who wrote the framework constantly posting.
Mark.
|
|
|
|
|
Why are most articles in C# rather than vb.net?
Can you list advantages of C# over vb.net?
Certified VB6, SQL 7 and ASP developer
|
|
|
|
|
Parthasarathy Mandayam wrote: Can you list advantages of C# over vb.net?
No, because it's been covered about a bazillion times all over the web.
So what if the code is written in C#. It's not that much different than VB.NET. Most of the code you see is using the .NET Framework classes and has very little to do with the language itself. It also wouldn't kill you to learn it. Why limit yourself to just one language.
If you want a Rosetta stone, showing you the same code snippets in both languages, there's thousands of examples all over the .NET Framework documentation on MSDN.
|
|
|
|
|
Dave,
I agree with you. Further more, if you have a copy of Lutz Roedoer's Reflector for .NET[^], then you have all .NET languages. Once you open up an assembly with that tool, you can convert it to another language with the click of drop down box.
Hogan
|
|
|
|
|
Yes, I do have it. It doesn't support ALL the languages that target the .NET CLR, but it does cover the major ones.
|
|
|
|
|
Dave Kreskowiak wrote: It also wouldn't kill you to learn it. Why limit yourself to just one language.
I agree that it wouldn't hurt to know both.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Parthasarathy Mandayam wrote: Why are most articles in C# rather than vb.net?
Because most people here have a fanatical hatred of VB.
Kevin
|
|
|
|
|
That's just a stupid answer.
In the past, it was true that the average VB developer was at a lower level than the average C++ developer, and there was a short term flow effect to C#. I'd say that's no longer true.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: That's just a stupid answer.
No, it's not, it's a true answer. A true answer can't be stupid.
Kevin
|
|
|
|
|
Parthasarathy Mandayam wrote: Can you list advantages of C# over vb.net?
No I can't. That's not to say I think one is better than the other - it's too subjective, and is a matter of personal perspective. I prefer C#, but that's because of my C background (and I just happen to think the syntax is cleaner) - VB programmers tend to prefer VB.NET. Ultimately, they both work with the .NET framework, so you can't realistically choose one over the other as being better.
|
|
|
|
|
i was having the same problem about a year ago. so, i learned c#. it didn't take me more than 2 hours to switch to c# from vb.net
Eslam Afifi
|
|
|
|
|
Yes
i'm accept, but i think c# development greater than vb.net.
and many guy use the C#> vb.net
Cheers
RRave
MCTS,MCPD
|
|
|
|
|
I'm working on a method and I want to allow the user to pass in a System.StringComparer, but I also want to determine whether or not that System.StringComparer is case sensitive.
System.StringComparer has an _ignoreCase member but it's private (Microsoft! Gimme a property!)
So I was thinking of doing:
ignorecase =
(
EqualityComparer.Equals
(
System.StringComparer.CurrentCultureIgnoreCase
)
||
EqualityComparer.Equals
(
System.StringComparer.InvariantCultureIgnoreCase
)
||
EqualityComparer.Equals
(
System.StringComparer.OrdinalIgnoreCase
)
) ;
but that would need to be maintained as comparers are added and removed.
Then it occured to me that:
ignorecase = ( EqualityComparer.Compare ( "X" , "x" ) == 0 ) ;
should work, and preliminary tests confirm this.
Does anyone have a more robust method of determining whether or not a System.StringComparer is case-sensitive?
|
|
|
|
|
No, none that I'm aware of.
|
|
|
|
|
ignorecase = ( EqualityComparer.Compare ( "X" , "x" ) == 0 ) ;
Seems clean and effecient
only two letters away from being an asset
|
|
|
|
|
I don't have a better method, but a problem with your approach is that StringComparer.CurrentCultureIgnoreCase.Equals("X", "x") does not necessarily return true in all cultures.
For example, StringComparer.CurrentCultureIgnoreCase.Equals("I", "i") is false on Turkish systems (Turkish distinguishes between dotted and dotless i[^]).
I don't know if there is any language that does something similar for "x".
Be careful with the "i" issue, case-insensitive comparisons of file extensions like ".gif" might fail on Turkish systems if you use CurrentCulture.
|
|
|
|
|
I certainly didn't know that. I chose X more or less at random.
Do you know whether or not InvariantCulture does that as well?
|
|
|
|
|
I am trying to sent an email to everyone in my sql database, the code selects all the email addresses to send to and then an email should be sent to all these addresses.
the problem: when i try to run this code i get the following error.
"the specified string is not a valid e-mail address."
clearly one of my addresses isn't in the correct format, the problem is that i have 2500+ clients.
How do i find out which address is invalid?
Thanks
|
|
|
|
|
Fatbuddha2 wrote: How do i find out which address is invalid?
You're kidding right?
led mike
|
|
|
|
|