I am trying to create a game engine, and have hit a little snag. Whenever I try to create an sf::Window, the window is invisible. I can interact with it and the name of it appears on the taskbar, but I can't see any part of the window. Here's my code:
main.cpp
#include <SE_Engine.hpp>
int main()
{
SE::Engine engine;
engine.createWindow("Pickin' Gems", 640, 480, 32);
return engine.run();
}
SE_Engine.hpp
#ifndef SE_ENGINE_HPP
#define SE_ENGINE_HPP
#include <string>
#include <SFML/Window.hpp>
namespace SE
{
class Engine
{
public:
void createWindow(std::string name = "Solstice Engine", int width = 640, int height = 480, int bitsPerPixel = 32);
int run();
private:
sf::Window _window;
bool _running;
};
}
#endif //SE_ENGINE_HPP
SE_Engine.cpp
#include "SE_Engine.hpp"
void SE::Engine::createWindow(std::string name, int width, int height, int bitsPerPixel)
{
_window.Create(sf::VideoMode(width, height, bitsPerPixel), name);
}
int SE::Engine::run()
{
_running = true;
while (_running)
{
_window.Display();
sf::Event event;
while (_window.GetEvent(event))
{
if (event.Type == sf::Event::Closed)
{
_window.Close();
_running = false;
}
}
}
return 0;
}