Hi!
I was looking at the one of the tutorials, and decided to compile the one on displaying a sprite. But when i compile it, my computer starts beeping, and the tempeture of the processor just shoots up according to Core Temp (which i always have on). From a stable 30c it rockets up to 40c in less then a couple of seconds!
The program (which is the exact same as in the tutorial) does what it's supposed to do, and there are no errors what so ever from code::blocks.
#include <SFML/Graphics.hpp>
int main()
{
// Create the main rendering window
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");
// Load the sprite image from a file
sf::Image Image;
if (!Image.LoadFromFile("you.bmp"))
return EXIT_FAILURE;
// Create the sprite
sf::Sprite Sprite(Image);
// Change its properties
Sprite.SetColor(sf::Color(0, 255, 255, 128));
Sprite.SetPosition(200.f, 100.f);
Sprite.SetScale(2.f, 2.f);
// Start game loop
while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();
}
// Get elapsed time
float ElapsedTime = App.GetFrameTime();
// Move the sprite
if (App.GetInput().IsKeyDown(sf::Key::Left)) Sprite.Move(-100 * ElapsedTime, 0);
if (App.GetInput().IsKeyDown(sf::Key::Right)) Sprite.Move( 100 * ElapsedTime, 0);
if (App.GetInput().IsKeyDown(sf::Key::Up)) Sprite.Move(0, -100 * ElapsedTime);
if (App.GetInput().IsKeyDown(sf::Key::Down)) Sprite.Move(0, 100 * ElapsedTime);
// Rotate the sprite
if (App.GetInput().IsKeyDown(sf::Key::Add)) Sprite.Rotate(- 100 * ElapsedTime);
if (App.GetInput().IsKeyDown(sf::Key::Subtract)) Sprite.Rotate(+ 100 * ElapsedTime);
// Clear screen
App.Clear();
// Display sprite in our window
App.Draw(Sprite);
// Display window contents on screen
App.Display();
}
return EXIT_SUCCESS;
}
The only thing i changed from the tutorial was "sprite.tga" to "you.bmp".
Any help in understanding the problem would be appriciated! Just please keep your answers simple, i'm a n00b att SFML
[/code]