Hello,
I'm having a very wierd problem that I cannot explain at all. I'm using SFML 1.4 with Codeblocks 8.02. So here's what happened:
I tested yesterday my program and the window displayed stuff, as it was supposed to. Today I decided to go on with my Pong project but when I run the program again, the window showed nothing. I mean it was like it was transparent, showing the background of the desktop. Actually I had the same problem 2 days ago when I decided to return to making Pong after a long time. Well I remember that the last time I left it, it actually showed stuff, but when I run it again 2 days ago, nothing. Well I didnt care much at the time and went on to update a lot my code, almost done it all again, so i dont know what have I done to fix it
. Sorry if it's a bit confusing...Here's my main(), I think it's a standard clear draw display loop...
int main()
{
// Create the main window
sf::RenderWindow App(sf::VideoMode(800, 600), "Pong!");
//Board pong;
float32 timestep = 1.0f/60.0f;
int32 iterations = 10;
BoardActors pong(30.0f,&App);
// Start the game loop
while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();
}
//ignore that stuff
//pong.board_physics->world->Step(timestep,iterations);
b2Vec2 pos = pong.board_physics->ball->GetPosition();
std::cout<<pos.x<<"\t"<<pos.y<<std::endl;
//std::cout<<pong.board_physics->player2->IsStatic();
//Drawing
// Clear screen
App.Clear();
pong.updateGraphics();
pong.board_graphics->draw();
App.Display();
}
return EXIT_SUCCESS;
}
pong.board_graphics->draw()
void BoardGraphics::draw()
{
display->Draw(lowerBound);
display->Draw(upperBound);
display->Draw(player1);
display->Draw(player2);
display->Draw(ball);
}
I also tried creating a simple circle to display but that didnt work either
What am I doing wrong?
edit: Ok it seems that I've posted on the wrong subforum... Sorry about that, mods please move the post to the Window subforum.
It seems that I've solved the problem, though not sure if this "solution" will last...The only thing I've changed was this:
sf::RenderWindow App(sf::VideoMode::GetDesktopMode(), "Pong!",sf::Style::Fullscreen);
Actually it doesnt make any sense at all, because I switched back to the original right after I saw that it worked on fullscreen and 1280x1024 and...it worked again. Could it be that 800x600 is not a valid video mode??