Qt: Add transformation matrix info to sprite view

This commit is contained in:
Vicki Pfau 2020-02-17 15:02:07 -08:00
parent c0ac5e35c0
commit e758f232fa
3 changed files with 231 additions and 137 deletions

View File

@ -19,6 +19,7 @@ Misc:
- FFmpeg: Add looping option for GIF/APNG
- Qt: Renderer can be changed while a game is running
- Qt: Add hex index to palette view
- Qt: Add transformation matrix info to sprite view
0.8.1: (2020-02-16)
Emulation fixes:

View File

@ -44,6 +44,10 @@ ObjView::ObjView(std::shared_ptr<CoreController> controller, QWidget* parent)
m_ui.priority->setFont(font);
m_ui.palette->setFont(font);
m_ui.transform->setFont(font);
m_ui.xformPA->setFont(font);
m_ui.xformPB->setFont(font);
m_ui.xformPC->setFont(font);
m_ui.xformPD->setFont(font);
m_ui.mode->setFont(font);
connect(m_ui.tiles, &TilePainter::indexPressed, this, &ObjView::translateIndex);
@ -157,9 +161,23 @@ void ObjView::updateTilesGBA(bool force) {
m_ui.mosaic->setChecked(GBAObjAttributesAIsMosaic(obj->a));
if (GBAObjAttributesAIsTransformed(obj->a)) {
m_ui.transform->setText(QString::number(GBAObjAttributesBGetMatIndex(obj->b)));
int mtxId = GBAObjAttributesBGetMatIndex(obj->b);
struct GBAOAMMatrix mat;
LOAD_16LE(mat.a, 0, &gba->video.oam.mat[mtxId].a);
LOAD_16LE(mat.b, 0, &gba->video.oam.mat[mtxId].b);
LOAD_16LE(mat.c, 0, &gba->video.oam.mat[mtxId].c);
LOAD_16LE(mat.d, 0, &gba->video.oam.mat[mtxId].d);
m_ui.transform->setText(QString::number(mtxId));
m_ui.xformPA->setText(QString("%0").arg(mat.a / 256., 5, 'f', 2));
m_ui.xformPB->setText(QString("%0").arg(mat.b / 256., 5, 'f', 2));
m_ui.xformPC->setText(QString("%0").arg(mat.c / 256., 5, 'f', 2));
m_ui.xformPD->setText(QString("%0").arg(mat.d / 256., 5, 'f', 2));
} else {
m_ui.transform->setText(tr("Off"));
m_ui.xformPA->setText(tr("---"));
m_ui.xformPB->setText(tr("---"));
m_ui.xformPC->setText(tr("---"));
m_ui.xformPD->setText(tr("---"));
}
switch (GBAObjAttributesAGetMode(obj->a)) {
@ -230,6 +248,10 @@ void ObjView::updateTilesGB(bool force) {
m_ui.doubleSize->setChecked(false);
m_ui.mosaic->setChecked(false);
m_ui.transform->setText(tr("N/A"));
m_ui.xformPA->setText(tr("---"));
m_ui.xformPB->setText(tr("---"));
m_ui.xformPC->setText(tr("---"));
m_ui.xformPD->setText(tr("---"));
m_ui.mode->setText(tr("N/A"));
}
#endif

View File

@ -13,7 +13,81 @@
<property name="windowTitle">
<string>Sprites</string>
</property>
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,1" columnstretch="0,0,1,1">
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,0" columnstretch="0,0,0,1">
<item row="0" column="2" rowspan="4" colspan="2">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0" alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="QGBA::TilePainter" name="tiles" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>8</width>
<height>8</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QSpinBox" name="objId">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>127</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Address</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="address">
<property name="text">
<string>0x07000000</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="3">
<widget class="QPushButton" name="copyButton">
<property name="text">
@ -21,13 +95,49 @@
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QSpinBox" name="magnification">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string>×</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>8</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Magnification</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Geometry</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
@ -93,7 +203,14 @@
</item>
</layout>
</item>
<item>
<item row="0" column="1" rowspan="2">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_4">
@ -159,50 +276,86 @@
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="0" column="2" rowspan="4" colspan="2">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0" alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="QGBA::TilePainter" name="tiles" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>8</width>
<height>8</height>
</size>
</property>
</widget>
<item row="0" column="2" rowspan="2">
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="3">
<widget class="QLabel" name="xformPC">
<property name="text">
<string>+0.00</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="xformPA">
<property name="text">
<string>+1.00</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Matrix</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="xformPD">
<property name="text">
<string>+1.00</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<widget class="QLabel" name="xformPB">
<property name="text">
<string>+0.00</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="0" column="1" rowspan="5">
<widget class="QGBA::AssetTile" name="tile">
<property name="title">
<string>Tile</string>
<item row="5" column="0" colspan="4">
<widget class="QListWidget" name="objList">
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="flow">
<enum>QListView::LeftToRight</enum>
</property>
<property name="resizeMode">
<enum>QListView::Adjust</enum>
</property>
<property name="gridSize">
<size>
<width>64</width>
<height>96</height>
</size>
</property>
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
<property name="uniformItemSizes">
<bool>true</bool>
</property>
</widget>
</item>
@ -215,6 +368,12 @@
</item>
<item row="3" column="0" rowspan="2">
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Attributes</string>
</property>
@ -517,98 +676,10 @@
</layout>
</widget>
</item>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QSpinBox" name="objId">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>127</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Address</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="address">
<property name="text">
<string>0x07000000</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QSpinBox" name="magnification">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string>×</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>8</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Magnification</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="0" colspan="4">
<widget class="QListWidget" name="objList">
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="flow">
<enum>QListView::LeftToRight</enum>
</property>
<property name="resizeMode">
<enum>QListView::Adjust</enum>
</property>
<property name="gridSize">
<size>
<width>64</width>
<height>96</height>
</size>
</property>
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
<property name="uniformItemSizes">
<bool>true</bool>
<item row="0" column="1" rowspan="5">
<widget class="QGBA::AssetTile" name="tile">
<property name="title">
<string>Tile</string>
</property>
</widget>
</item>