/**************************************************************************
- Ghosts Overboard - a game for Maemo 5
+ Ghosts Overboard - a game for 'Meego 1.2 Harmattan'
Copyright (C) 2011 Heli Hyvättinen
#include <QDebug>
#include <QDBusMessage>
#include <QDBusConnection>
-#include <QFeedbackHapticsEffect>
+
shipImages_ = pixmapList;
ghostsAboard_ = 0;
vibrationActive_ = false;
+ vibrationAllowed_ = false;
+
+ pVibrationEffect_ = new QFeedbackHapticsEffect();
+ pVibrationEffect_->setDuration(500);
+ pVibrationEffect_->setIntensity(1.0);
+
}
+Ship::~Ship()
+{
+ if (pVibrationEffect_)
+ delete pVibrationEffect_;
+}
+
+
bool Ship::handleCollisions()
{
QList<QGraphicsItem*> collidesList = collidingItems();
//vibrate
- if (vibrationActive_)
+ if (vibrationActive_ && vibrationAllowed_)
{
// This is for fremantle
//This is for Harmattan
- QFeedbackHapticsEffect vibrationEffect;
- vibrationEffect.setDuration(1000);
- vibrationEffect.setIntensity(1.0);
- vibrationEffect.start();
+ pVibrationEffect_->start();
+
}
}
{
vibrationActive_ = on;
}
+
+void Ship::allowVibration()
+{
+ vibrationAllowed_ = true;
+}
+
+void Ship::disallowVibration()
+{
+ vibrationAllowed_ = false;
+}