Sign in to follow this  
Jarwulf

sfml window

Recommended Posts

Jarwulf    223
I'm having problems with generating a window for my gameplay state using C++ and SFML. I'm at a menu screen I select an option and then the window is just frozen. I think somethings wrong with how I'm trying to draw the window since debugging shows that the program is running. Are there any mistakes that you can see? This is a skeleton of how the drawing is set up.
playstate.h
sf::RenderWindow Window;

void Draw();

playstate.cc

void MenuState::Draw()
{
Window.Clear(sf::Color(50, 50, 150));
Window.Draw(BackgroundSprite);
Window.Draw(currentui.UInter);

// Display window contents on screen
Window.Display();
Window.Clear();
}
The menu which precedes the playstate is set up like this
menustate.h


void Draw(sf::RenderWindow &Window);

menustate.cc

void MenuState::Draw(sf::RenderWindow &Window)
{
Window.Clear(sf::Color(50, 50, 150));
Window.Draw(MenuSprite);
Window.Display();
}

The menu appears to work until I select the play option. I can't set up sf::RenderWindow Window in the playstate like it is in the menu because other functions besides Draw need access to it.

Share this post


Link to post
Share on other sites
Kylotan    9855
What do you mean by frozen? You've posted your rendering code but 'frozen' implies some problem with input, or logic updates. What are you expecting to happen that isn't happening?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this