projects
/
ghostsoverboard
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added autopause to changelog
[ghostsoverboard]
/
timercontrolledgraphicspixmapobject.cpp
diff --git
a/timercontrolledgraphicspixmapobject.cpp
b/timercontrolledgraphicspixmapobject.cpp
index
56913f6
..
52fb616
100644
(file)
--- a/
timercontrolledgraphicspixmapobject.cpp
+++ b/
timercontrolledgraphicspixmapobject.cpp
@@
-29,13
+29,14
@@
TimerControlledGraphicsPixmapObject::TimerControlledGraphicsPixmapObject(QPixmap
QObject(), QGraphicsPixmapItem(pixmap, parent)
{
setSpeed(speed);
QObject(), QGraphicsPixmapItem(pixmap, parent)
{
setSpeed(speed);
- direction_ = S;
+ changeDirection();
connect(&timer_,SIGNAL(timeout()),this,SLOT(move()));
}
void TimerControlledGraphicsPixmapObject::startMoving()
{
connect(&timer_,SIGNAL(timeout()),this,SLOT(move()));
}
void TimerControlledGraphicsPixmapObject::startMoving()
{
- timer_.start();
+ if (!stoppedBecauseInvalidTime_)
+ timer_.start();
}
void TimerControlledGraphicsPixmapObject::stopMoving()
}
void TimerControlledGraphicsPixmapObject::stopMoving()
@@
-45,9
+46,17
@@
void TimerControlledGraphicsPixmapObject::stopMoving()
void TimerControlledGraphicsPixmapObject::setSpeed(int speed)
{
void TimerControlledGraphicsPixmapObject::setSpeed(int speed)
{
- timer_.setInterval(1000/speed); //converts from pixels in second to milliseconds per pixel
+ if (speed >0)
+ {
+ timer_.setInterval(1000/speed); //converts from pixels in second to milliseconds per pixel
+ stoppedBecauseInvalidTime_ = false;
+ }
+ else
+ stoppedBecauseInvalidTime_ = true;
+ timer_.stop();
}
}
+
void TimerControlledGraphicsPixmapObject::move()
{
void TimerControlledGraphicsPixmapObject::move()
{