1
Graphics / Just Declaring a View Makes Screen Blank
« on: August 05, 2019, 09:29:01 pm »I am using the below code to display a map. However, when I uncomment the mainView declaration, all my graphics disappear. This occurs even if I do not call setView on my window.
I know the view needs arguments to work correctly, but I removed them just messing around to see if anything would work. Why are things changing without calling setView? any ideas?
Quote
int main()
{
//Get Window Size
int screenWidth = sf::VideoMode::getDesktopMode().width;
int screenHeight = sf::VideoMode::getDesktopMode().height -22;
//Create Window
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
window.setSize( sf::Vector2u(screenWidth, screenHeight) );
window.setPosition( sf::Vector2i(0, 0) );
//sf::View mainView;
//window.setView(mainView);
//Init Game
Map map;
map.initMap();
//Main loop
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
//Window Closed
if (event.type == sf::Event::Closed)
window.close();
}
//Drawing
window.clear();
map.drawMap(window);
window.display();
}
return 0;
}