Line |
Branch |
Exec |
Source |
1 |
|
|
#include "Sprite.hpp" |
2 |
|
|
|
3 |
|
✗ |
int Sprite::update(float fElapsedTime) { |
4 |
|
|
int ret = 0; |
5 |
|
✗ |
_time += fElapsedTime; |
6 |
|
✗ |
if (_time > _frameTime) { |
7 |
|
✗ |
_time = 0; |
8 |
|
✗ |
_frame++; |
9 |
|
✗ |
if (_frame >= _frameCount) { |
10 |
|
✗ |
if (_looping) |
11 |
|
✗ |
_frame = 0; |
12 |
|
|
else { |
13 |
|
|
ret = 1; |
14 |
|
✗ |
_frame = _frameCount - 1; |
15 |
|
|
} |
16 |
|
|
} |
17 |
|
✗ |
_sprite.setTextureRect(sf::IntRect(_frame * _frameSize.x, 0, _frameSize.x, _frameSize.y)); |
18 |
|
|
} |
19 |
|
✗ |
return ret; |
20 |
|
|
} |
21 |
|
|
|