equal
deleted
inserted
replaced
|
1 |
|
2 |
|
3 #include "inputcontroller.h" |
|
4 #include "compasscontroller.h" |
|
5 #include "view.h" |
|
6 |
|
7 CompassController::CompassController( ): m_width(View::m_imageWidth){} |
|
8 |
|
9 |
|
10 |
|
11 void CompassController::startSensor() |
|
12 { |
|
13 m_compass.connectToBackend(); |
|
14 m_compass.start(); |
|
15 connect(&m_compass, SIGNAL(readingChanged()), this, SLOT(update())); |
|
16 } |
|
17 |
|
18 |
|
19 void CompassController::stopSensor(){ m_compass.stop();} |
|
20 |
|
21 |
|
22 void CompassController::update() |
|
23 { |
|
24 qreal azimuth = m_compass.reading()->azimuth(); |
|
25 m_x = (int)(azimuth * m_width/360); |
|
26 } |
|
27 |
|
28 |
|
29 |