Qt: Nearly-complete GBA sprite viewer
Jeffrey Pfau jeffrey@endrift.com
Fri, 21 Oct 2016 04:21:55 -0700
2 files changed,
374 insertions(+),
68 deletions(-)
M
src/platform/qt/ObjView.cpp
→
src/platform/qt/ObjView.cpp
@@ -32,6 +32,10 @@ m_ui.y->setFont(font);
m_ui.w->setFont(font); m_ui.h->setFont(font); m_ui.address->setFont(font); + m_ui.priority->setFont(font); + m_ui.palette->setFont(font); + m_ui.transform->setFont(font); + m_ui.mode->setFont(font); connect(m_ui.tiles, SIGNAL(indexPressed(int)), this, SLOT(translateIndex(int))); connect(m_ui.objId, SIGNAL(valueChanged(int)), this, SLOT(selectObj(int)));@@ -66,6 +70,7 @@ int i = 0;
// TODO: Tile stride // TODO: Check to see if parameters are changed (so as to enable force if needed) if (GBAObjAttributesAIs256Color(obj->a)) { + m_ui.palette->setText("256-color"); mTileCacheSetPalette(m_tileCache.get(), 1); m_ui.tile->setPalette(0); m_ui.tile->setPaletteSet(1, 1024, 1536);@@ -83,6 +88,7 @@ }
} tile += 1024; } else { + m_ui.palette->setText(QString::number(palette)); mTileCacheSetPalette(m_tileCache.get(), 0); m_ui.tile->setPalette(palette); m_ui.tile->setPaletteSet(0, 2048, 3072);@@ -106,7 +112,34 @@ m_ui.y->setText(QString::number(GBAObjAttributesAGetY(obj->a)));
m_ui.w->setText(QString::number(width)); m_ui.h->setText(QString::number(height)); - // TODO: Flags + m_ui.address->setText(tr("0x%0").arg(BASE_OAM + m_objId * sizeof(*obj), 8, 16, QChar('0'))); + m_ui.priority->setText(QString::number(GBAObjAttributesCGetPriority(obj->c))); + m_ui.flippedH->setChecked(GBAObjAttributesBIsHFlip(obj->b)); + m_ui.flippedV->setChecked(GBAObjAttributesBIsVFlip(obj->b)); + m_ui.enabled->setChecked(!GBAObjAttributesAIsDisable(obj->a) || GBAObjAttributesAIsTransformed(obj->a)); + m_ui.doubleSize->setChecked(GBAObjAttributesAIsDoubleSize(obj->a) && GBAObjAttributesAIsTransformed(obj->a)); + m_ui.mosaic->setChecked(GBAObjAttributesAIsMosaic(obj->a)); + + if (GBAObjAttributesAIsTransformed(obj->a)) { + m_ui.transform->setText(QString::number(GBAObjAttributesBGetMatIndex(obj->b))); + } else { + m_ui.transform->setText(tr("Off")); + } + + switch (GBAObjAttributesAGetMode(obj->a)) { + case OBJ_MODE_NORMAL: + m_ui.mode->setText(tr("Normal")); + break; + case OBJ_MODE_SEMITRANSPARENT: + m_ui.mode->setText(tr("Trans")); + break; + case OBJ_MODE_OBJWIN: + m_ui.mode->setText(tr("OBJWIN")); + break; + default: + m_ui.mode->setText(tr("Invalid")); + break; + } } #endif
M
src/platform/qt/ObjView.ui
→
src/platform/qt/ObjView.ui
@@ -6,33 +6,21 @@ <property name="geometry">
<rect> <x>0</x> <y>0</y> - <width>400</width> - <height>300</height> + <width>454</width> + <height>375</height> </rect> </property> <property name="windowTitle"> <string>Sprites</string> </property> - <layout class="QGridLayout" name="gridLayout" columnstretch="0,1"> - <item row="0" column="1" rowspan="5"> + <layout class="QGridLayout" name="gridLayout" columnstretch="0,0,1"> + <item row="0" column="2" rowspan="4"> <widget class="QFrame" name="frame"> <property name="frameShape"> <enum>QFrame::StyledPanel</enum> </property> - <property name="frameShadow"> - <enum>QFrame::Raised</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"> + <property name="margin"> <number>0</number> </property> <item row="0" column="0" alignment="Qt::AlignHCenter|Qt::AlignVCenter">@@ -54,13 +42,6 @@ </item>
</layout> </widget> </item> - <item row="3" column="0"> - <widget class="QGBA::AssetTile" name="tile"> - <property name="title"> - <string>Tile</string> - </property> - </widget> - </item> <item row="1" column="0"> <layout class="QHBoxLayout" name="horizontalLayout_4"> <item>@@ -78,7 +59,7 @@ <property name="minimum">
<number>1</number> </property> <property name="maximum"> - <number>4</number> + <number>6</number> </property> </widget> </item>@@ -91,51 +72,299 @@ </widget>
</item> </layout> </item> - <item row="4" column="0"> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item row="0" column="0"> - <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 row="2" column="0"> - <widget class="QGroupBox" name="groupBox"> + <item row="3" column="0"> + <widget class="QGroupBox" name="groupBox_2"> <property name="title"> - <string>Object</string> + <string>Attributes</string> </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="2" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_6"> + <item> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string>Transform</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_4"> + <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> + <widget class="QLabel" name="transform"> + <property name="text"> + <string>Off</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="1" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_16"> + <item> + <widget class="QLabel" name="label_16"> + <property name="text"> + <string>Palette</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_13"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>10</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="palette"> + <property name="text"> + <string>0</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + </layout> + </item> + <item row="2" column="2"> + <layout class="QHBoxLayout" name="horizontalLayout_18"> + <item> + <widget class="QLabel" name="label_18"> + <property name="text"> + <string>Double Size</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_15"> + <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> + <widget class="QCheckBox" name="doubleSize"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string/> + </property> + <property name="shortcut"> + <string>Return, Ctrl+R</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="0" column="1" rowspan="4"> + <widget class="Line" name="line"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item row="0" column="2"> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <item> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Flipped</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <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> + <widget class="QCheckBox" name="flippedH"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>H</string> + </property> + <property name="shortcut"> + <string>Return, Ctrl+R</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="flippedV"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>V</string> + </property> + <property name="shortcut"> + <string>Return, Ctrl+R</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="3" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_7"> + <item> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>Mode</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_5"> + <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> + <widget class="QLabel" name="mode"> + <property name="text"> + <string>Normal</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="3" column="2"> + <layout class="QHBoxLayout" name="horizontalLayout_15"> + <item> + <widget class="QLabel" name="label_15"> + <property name="text"> + <string>Mosaic</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_12"> + <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> + <widget class="QCheckBox" name="mosaic"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string/> + </property> + <property name="shortcut"> + <string>Return, Ctrl+R</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="1" column="2"> + <layout class="QHBoxLayout" name="horizontalLayout_14"> + <item> + <widget class="QLabel" name="label_14"> + <property name="text"> + <string>Enabled</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_11"> + <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> - <widget class="QLabel" name="label_3"> + <widget class="QCheckBox" name="enabled"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </item> + <item row="0" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_17"> + <item> + <widget class="QLabel" name="label_17"> <property name="text"> - <string>Address</string> + <string>Priority</string> </property> </widget> </item> <item> - <widget class="QLabel" name="address"> + <spacer name="horizontalSpacer_14"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>10</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="priority"> <property name="text"> - <string>0x07000000</string> + <string>0</string> </property> <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>@@ -144,6 +373,22 @@ </widget>
</item> </layout> </item> + </layout> + </widget> + </item> + <item row="0" column="1" rowspan="4"> + <widget class="QGBA::AssetTile" name="tile"> + <property name="title"> + <string>Tile</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>Geometry</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> <item> <layout class="QHBoxLayout" name="horizontalLayout"> <item>@@ -157,9 +402,6 @@ <item>
<spacer name="horizontalSpacer"> <property name="orientation"> <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::MinimumExpanding</enum> </property> <property name="sizeHint" stdset="0"> <size>@@ -227,9 +469,6 @@ <spacer name="horizontalSpacer_2">
<property name="orientation"> <enum>Qt::Horizontal</enum> </property> - <property name="sizeType"> - <enum>QSizePolicy::MinimumExpanding</enum> - </property> <property name="sizeHint" stdset="0"> <size> <width>0</width>@@ -284,6 +523,40 @@ </layout>
</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> + </widget> + </item> + </layout> </item> </layout> </widget>