Hi all! I hate to ask a question with my first post, but I'm in a bit of a bind.
I'm using SFML.Net to develop a game with C#, and I ran into a problem when attempting to convert some code over from the "Game from Scratch C++ and SFML Edition" tutorial (found here:
http://www.gamefromscratch.com/page/Game-From-Scratch-CPP-Edition.aspx).
Basically, I'm trying to display a splash screen that can be dismissed by pressing any key or mouse button. The problem I have is that, from my understanding, I have to use DispatchEvents() to handle any events, and those events get sent to my event handlers which execute code I didn't necessarily want to execute in this given situation.
In the tutorial, GetEvent() is called to simply check for keyboard or mouse input and exit the loop like follows:
sf::Event event;
while(true)
{
while(renderWindow.GetEvent(event))
{
if(event.Type == sf::Event::EventType::KeyPressed
|| event.Type == sf::Event::EventType::MouseButtonPressed
|| event.Type == sf::Event::EventType::Closed )
{
return;
}
}
}
What I want to know is if it's possible to check for input within a loop without having to call my primary event handlers. Otherwise, the only solution I can think of is to create a switch case within my handlers that checks for the game state. If the game state is "ShowingSplash", the handlers would update my game state from "ShowingSplash" to "ShowingMenu" when a key or mouse button is pressed, and then I would break out of the splash screen loop by checking if the game state has changed. That seems much more complicated than necessary for simply getting out of a loop on a key or mouse button press.
Any help would be greatly appreciated!
Edit: Hope this is in the right spot. It seems weird to put an events question in the graphics area, but I figured that's where it belonged since RenderWindow is a member of Graphics.