So I got to working with SFML recently, and I've just encountered a problem, that being whenever I attempt and create a sprite, my .exe file removes itself COMPLETELY from my desktop, making anything I attempt to create unworkable after that.
Here is my code:
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <iostream>
#include "ResourcePath.hpp"
using namespace std;
int main()
{
//Variables
int MaxFPS = 80;
//Creating the window
sf::RenderWindow gameWindow(sf::VideoMode(800, 600), "A Technical Problem");
//Creating the Handler
sf::WindowHandle theHandle;
//Controlling the FrameRate
gameWindow.setFramerateLimit(MaxFPS);
//Creating the Test Player
sf::Texture PlayerTexture;
PlayerTexture.setSmooth(false);
if (!PlayerTexture.loadFromFile(resourcePath() + "Player1.png"))
{
cout << "The Player 1 image did not load properly" << endl;
return EXIT_FAILURE;
}
sf::Sprite PlayerS(PlayerTexture);
//Main Game Loop
while (gameWindow.isOpen())
{
//Detecting input
if (sf::Keyboard::isKeyPressed(sf::Keyboard::D))
{
}
//Process Events
sf::Event theEvent;
while (gameWindow.pollEvent(theEvent))
{
//Closing the Main Game Loop
if (theEvent.type == sf::Event::Closed)
{
gameWindow.close();
}
}
//Clearing the Game Window
gameWindow.clear();
//Drawing the Sprites
gameWindow.draw(PlayerS);
//Updating the window
gameWindow.display();
}
return EXIT_SUCCESS;
}
And I'm not sure what to do about it: I haven't seen anything similar to this topic on the internet at all (and believe me, I looked), so if someone has an answer to this, please respond so.