summaryrefslogtreecommitdiff
path: root/src/outputwindow.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2014-09-05 19:57:14 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2014-09-05 19:57:14 +0200
commit4ae6300717a10c7fa850b800f18a730aee1d3e07 (patch)
tree455ae17634f5bbd8b18ce3a256db2647853bd600 /src/outputwindow.cc
parentf4b015398462fff1a64d70b632390b4f06fe3bbe (diff)
Internal code editor. Sound system.
Diffstat (limited to 'src/outputwindow.cc')
-rw-r--r--src/outputwindow.cc27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/outputwindow.cc b/src/outputwindow.cc
index 43e691f..498af23 100644
--- a/src/outputwindow.cc
+++ b/src/outputwindow.cc
@@ -48,6 +48,16 @@ OutputWindow::OutputWindow()
reset();
}
+double OutputWindow::coordX()
+{
+ return x;
+}
+
+double OutputWindow::coordY()
+{
+ return y;
+}
+
void OutputWindow::stopScript()
{
stop = true;
@@ -117,7 +127,7 @@ void OutputWindow::paintEvent(QPaintEvent *)
p.setTransform(gt);
QPen pen;
- pen.setWidth(6);
+ pen.setWidth(4);
/*
p.setPen(pen);
p.drawLines(points);
@@ -148,7 +158,7 @@ void OutputWindow::paintEvent(QPaintEvent *)
QColor c = colour;
c.setAlpha(c.alpha() / 4);
pen.setStyle(Qt::SolidLine);
- pen.setWidth(6);
+ pen.setWidth(4);
pen.setColor(c);
p.setPen(pen);
for(int i = 0; i < current_points.size(); i+=2) {
@@ -183,9 +193,10 @@ static inline int sign(int x)
return -1;
}
-void OutputWindow::forward(int dist)
+void OutputWindow::forward(double dist)
{
sem.acquire();
+
float target_x = sin(r * (M_PI / 180.0)) * dist;
float target_y = cos(r * (M_PI / 180.0)) * dist;
@@ -222,15 +233,15 @@ void OutputWindow::forward(int dist)
}
// Turn x degrees
-void OutputWindow::turn(int x)
+void OutputWindow::turn(double x)
{
- int spd = (speed * abs(x) / 80);
- float offset = this->r;
+ double spd = (speed * abs(x) / 80.0);
+ double offset = this->r;
sem.acquire();
for(int i = 0; i < spd; i++) {
if(stop) return;
- float p = (float)i / (float)spd;
- this->r = offset + (float)x * p;
+ double p = (double)i / spd;
+ this->r = offset + x * p;
sem.acquire();
}
this->r = offset + x;