Hello to all.I am new to sfml and I'm making a small game.I have a problem.The game starts showing my logo and after 2 seconds I want to show the main menu.I thought that putting in my code window.clear(); will work,but in my code doesn't work.Here is the code:
main.cpp:
#include "main.h"
using namespace std;
void log(char * text){
cout << text << endl;
}
void showLogo(){
window.clear();
sf::Texture texture;
if (!texture.loadFromFile("img/logo.jpg")){
cout << "Error: No se puede mostrar la aplicación" << endl;
}
sf::Sprite sprite(texture);
window.draw(sprite);
window.display();
log("Mostrado");
sf:sleep(sf::seconds(0.5f));
log("Fin");
window.clear(sf::Color(255,255,255,255));
}
int main(){
while(window.isOpen()){
showLogo();
sf:sleep(sf::seconds(5.0f));
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
}
return 0;
}
and here is main.h
#include <iostream>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
sf::RenderWindow window(sf::VideoMode(854, 480), "Test");
void showLogo();
void log(char * text);