]> Shamusworld >> Repos - virtualjaguar/blobdiff - src/gui/controllerwidget.cpp
Added preliminary M68K disassembly browser.
[virtualjaguar] / src / gui / controllerwidget.cpp
index c5167b131c1d30b1bb134222fb1518e6f4ab2fd0..25fb8b1b8206bef1baa4f6b2059379b567644803 100644 (file)
@@ -5,7 +5,7 @@
 // (C) 2011 Underground Software
 // See the README and GPLv3 files for licensing and warranty information
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // WHO  WHEN        WHAT
 // ---  ----------  ------------------------------------------------------------
@@ -25,7 +25,7 @@ char ControllerWidget::keyName1[96][16] = {
        "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";", "<", "=", ">", "?",
        "@", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N",
        "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
-       "[", "]", "\\", "^", "_", "`",
+       "[", "\\", "]", "^", "_", "`",
        "$61", "$62", "$63", "$64", "$65", "$66", "$67", "$68", "$69", "$6A", "$6B", "$6C", "$6D", 
        "$6E", "$6F", "$70", "$71", "$72", "$73", "$74", "$75", "$76", "$77", "$78", "$79", "$7A", 
        "{", "|", "}", "~"
@@ -43,11 +43,11 @@ char ControllerWidget::keyName2[64][16] = {
 // This is hard-coded crap. It's crap-tastic!
 // These are the positions to draw the button names at, ordered by the BUTTON_* sequence
 // found in joystick.h.
-int ControllerWidget::buttonPos[21][2] = { { 86, 59 }, { 86, 94 }, { 68, 76 }, { 108, 76 },
-       { 125, 223 }, { 125, 200 }, { 125, 177 }, { 125, 153 },
-       { 160, 223 }, { 160, 200 }, { 160, 177 }, { 160, 153 },
-       { 196, 223 }, { 196, 200 }, { 196, 177 }, { 196, 153 },
-       { 242, 60 }, { 224, 80 }, { 207, 104 }, { 164, 101 }, { 141, 108+13 }
+int ControllerWidget::buttonPos[21][2] = { { 74, 32 }, { 71, 67 }, { 53, 49 }, { 93, 49 },
+       { 110, 200 }, { 110, 175 }, { 110, 151 }, { 110, 126 },
+       { 148, 200 }, { 148, 175 }, { 148, 151 }, { 148, 126 },
+       { 186, 200 }, { 186, 175 }, { 186, 151 }, { 186, 126 },
+       { 234, 31 }, { 216, 51 }, { 199, 71 }, { 164-11, 101-30 }, { 141-11, 108+13-30 }
 };
 
 ControllerWidget::ControllerWidget(QWidget * parent/*= 0*/): QWidget(parent),
@@ -94,13 +94,13 @@ void ControllerWidget::paintEvent(QPaintEvent * /*event*/)
        blackPen.setWidth(4);
        QPen colorPen(QColor(48, 255, 255, 255));
        colorPen.setWidth(2);
-       QLine line(QPoint(141, 100), QPoint(141, 108+5));
+       QLine line(QPoint(141-11, 100-30), QPoint(141-11, 108+5-30));
 
        painter.setPen(blackPen);
        painter.drawLine(line);
        blackPen.setWidth(1);
        painter.setPen(blackPen);
-       painter.drawEllipse(QPoint(141, 100), 4, 4);
+       painter.drawEllipse(QPoint(141-11, 100-30), 4, 4);
        painter.setPen(colorPen);
        painter.drawLine(line);
 
@@ -132,13 +132,13 @@ void ControllerWidget::paintEvent(QPaintEvent * /*event*/)
        }
 }
 
-void ControllerWidget::mousePressEvent(QMouseEvent * event)
+void ControllerWidget::mousePressEvent(QMouseEvent * /*event*/)
 {
        mouseDown = true;
        update();
 }
 
-void ControllerWidget::mouseReleaseEvent(QMouseEvent * event)
+void ControllerWidget::mouseReleaseEvent(QMouseEvent * /*event*/)
 {
        mouseDown = false;
        // Spawning the keygrabber causes leaveEvent() to be called, so we need to save this
@@ -164,7 +164,6 @@ void ControllerWidget::mouseMoveEvent(QMouseEvent * event)
        // Save the current closest item
        int keyToHighlightOld = keyToHighlight;
        // Set up closest distance (this should be large enough)
-//     uint32_t closestX = 100000, closestY = 100000;
        double closest = 1e9;
 
        for(int i=BUTTON_FIRST; i<=BUTTON_LAST; i++)
@@ -188,7 +187,6 @@ void ControllerWidget::mouseMoveEvent(QMouseEvent * event)
 void ControllerWidget::leaveEvent(QEvent * /*event*/)
 {
        keyToHighlight = -1;
-//     mouseDown = false;
        update();
 }