So for whatever reason, any program I write, no matter how simple or complex, is a complete CPU hog. It consistently uses up 50% of my CPU or more. I've googled this problem, and it seems to be a common one, but none of the solutions suggested in those threads worked.
To recap, I'm using Visual Studio 2013 (I tried to configure it to work with Code::Blocks, but I couldn't for the life of me get it to work, so I opted for VS instead). I'm using a dynamic linker rather than static, simply because that's the one that allows me to build the project. I have tried both setFramerateLimit and setVerticalSyncEnabled, with it having no effect on performance. I thought that perhaps it was my graphics driver, so I tried updating it. Granted, my laptop is quite old, and my drivers haven't been officially supported for a few years, but I tried nonetheless. Alas, that had no effect either. Lastly, I tried building SFML from the source code rather than using the VS2013 package. Not even that seemed to work.
I run Windows 7 Ultimate, Service Pack 1
My processor is an AMD A4-3320M APU with Radeon HD Graphics 2.00 GHz (It sucks I know, but it should be able to handle something like this regardless)
8GB of RAM
64-bit Operating system
All of my other drivers are up to date, to my knowledge.
Finally, just for safe measure, here's my code:
#include <SFML/Window.hpp>
#include <iostream>
using namespace sf;
int main()
{
//Window 1
Window window1(VideoMode(800, 600), "Hello, World!");
window1.setFramerateLimit(30); // call it once, after creating the window
window1.setKeyRepeatEnabled(false); // makes it so that holding down a key doesn't repeat the action rapidly
//Main loop
while (window1.isOpen())
{
//Check all of the window's events that were triggered since the last iteration of the loop
Event event1;
while (window1.pollEvent(event1))
{
switch (event1.type)
{
case Event::Closed:
{
window1.close();
break;
}
case Event::KeyPressed:
{
std::cout << "Formless, ";
switch (event1.key.code)
{
case Keyboard::Up:
{
std::cout << "you are moving up ";
break;
}
case Keyboard::Left:
{
std::cout << "you are moving left ";
break;
}
case Keyboard::Down:
{
std::cout << "you are moving down ";
break;
}
case Keyboard::Right:
{
std::cout << "you are moving right ";
break;
}
}
std::cout << "in an endless void!\n";
break;
}
case Event::KeyReleased:
{
switch (event1.key.code)
{
case Keyboard::Up:
{
std::cout << "You have stopped moving up.\n";
break;
}
case Keyboard::Left:
{
std::cout << "You have stopped moving left.\n";
break;
}
case Keyboard::Down:
{
std::cout << "You have stopped moving down.\n";
break;
}
case Keyboard::Right:
{
std::cout << "You have stopped moving right.\n";
break;
}
}
break;
}
default:
{
break;
}
}
}
}
return 0;
}
At first I thought it might have been simply the nature of SFML, since the example programs provided in the package seems to give me the same result. However, when I tried a simple game I downloaded that was written in SFML, any CPU-hogging was absent, so I honestly don't know what gives.
EDIT: Managed to get it working with Code::Blocks. Didn't make any difference whatsoever.