]> git.sur5r.net Git - fstl/blobdiff - src/canvas.cpp
Start with status as ' ' to precache font
[fstl] / src / canvas.cpp
index 98c0a296247617b3ba93a504f527dee2caa96b69..4706f8fe63053b3febd0adf7a4502d09dc59a4c2 100644 (file)
@@ -10,7 +10,7 @@
 
 Canvas::Canvas(const QGLFormat& format, QWidget *parent)
     : QGLWidget(format, parent), mesh(NULL),
-      scale(1), tilt(90), yaw(0)
+      scale(1), tilt(90), yaw(0), status(" ")
 {
     // Nothing to do here
 }
@@ -62,6 +62,7 @@ void Canvas::paintEvent(QPaintEvent *event)
     if (mesh)  draw_mesh();
 
     QPainter painter(this);
+    painter.setRenderHint(QPainter::Antialiasing);
     if (!status.isNull())
         painter.drawText(10, height() - 10, status);
 }
@@ -106,11 +107,11 @@ QMatrix4x4 Canvas::view_matrix() const
     QMatrix4x4 m;
     if (width() > height())
     {
-        m.scale(height() / float(width()), 1, 0.5);
+        m.scale(-height() / float(width()), 1, 0.5);
     }
     else
     {
-        m.scale(1, width() / float(height()), 0.5);
+        m.scale(-1, width() / float(height()), 0.5);
     }
     return m;
 }
@@ -138,7 +139,7 @@ void Canvas::mouseMoveEvent(QMouseEvent* event)
     {
         auto p = event->pos();
         auto d = p - mouse_pos;
-        yaw = fmod(yaw + d.x(), 360);
+        yaw = fmod(yaw - d.x(), 360);
         tilt = fmax(0, fmin(180, tilt - d.y()));
         mouse_pos = p;
         update();