hi again
after give uping for couple of days finaly i went back and reset every thing and now i dont see the errors
now i got another problem i dont know is in my code or anything else!
here is my code i will be grateful to see this!
#include "stdafx.h"
#include <SFML\Graphics.hpp>
#include "AnimatedSprite.hpp"
#include <iostream>
using namespace sf;
int main()
{
Vector2i vectors(800, 600);
RenderWindow window(VideoMode(vectors.x,vectors.y),"anime");
Texture runner;
runner.loadFromFile("E:\\Resource\\runner.png");
Animation run;
run.setSpriteSheet(runner);
Animation* current = &run;
AnimatedSprite animatedSprite(seconds(0.2), true, false);
animatedSprite.setPosition(sf::Vector2f(vectors / 2));
Clock frameclock;
float speed = 80.f;
bool noKeyPressed=true;
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
Time frametime= frameclock.restart();
Vector2f movement(0.f, 0.f);
if (Keyboard::isKeyPressed(Keyboard:: D)){ // i put little space because it will show something like this in this forum :D
current = &run;
movement.x += speed;
noKeyPressed = false;
}
animatedSprite.play(*current);
animatedSprite.move(movement *frametime.asSeconds());
if (noKeyPressed){
animatedSprite.stop();
}
noKeyPressed = true;
animatedSprite.update(frametime);
window.clear();
window.draw(animatedSprite);
window.display();
}
return 0;
}
and here is my screenshot of my problems
http://8pic.ir/images/7bc8kexg2llgh8groffj.pngthanks