Hey so, I'm kinda new here, and I've been dinkin' around for a few weeks to try and get the hang of this. I noticed that what I've made so far (a pong clone from this:
http://www.gamefromscratch.com/page/Game-From-Scratch-CPP-Edition.aspx tutorial and another simple program from scratch) had a wierd freezing/jittering every have second or so. I decided to write a new program from scratch to see if it was present there. Sure enough, about every half second or so the sprite would freeze and then update to where it should be. Any ideas? Here's the code for the test program:
// y.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "SFML\Graphics.hpp"
int main()
{
sf::RenderWindow window(sf::VideoMode(720, 720), "hey");
sf::Event event;
sf::Texture texture;
sf::Sprite sprite;
texture.loadFromFile("images/box.png");
sprite.setTexture(texture);
sprite.setOrigin(sprite.getGlobalBounds().width / 2, sprite.getGlobalBounds().height / 2);
sprite.setPosition(360, 700);
while (window.isOpen()) {
window.pollEvent(event);
switch (event.type) {
case sf::Event::Closed:
window.close();
break;
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
{
sprite.move(-0.005, 0.0);
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
{
sprite.move(0.005, 0.0);
}
window.clear(sf::Color::Black);
window.draw(sprite);
window.display();
}
return 0;
}
I did some google searching and wasn't able to find a solution. Its probably super simple, sorry in advance for the trouble.