Cleanup tileset editor ui

This commit is contained in:
Marcus Huderle 2018-10-02 19:01:34 -05:00
parent cf150f3ce9
commit 8db57f3e0c
2 changed files with 122 additions and 109 deletions

View file

@ -25,7 +25,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>308</width>
<width>386</width>
<height>539</height>
</rect>
</property>
@ -99,37 +99,54 @@
<item>
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<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 alignment="Qt::AlignTop">
<widget class="QFrame" name="frame_4">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<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>
<widget class="QFrame" name="frame_3">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Tile Properties</string>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
<property name="flat">
<bool>false</bool>
</property>
<layout class="QFormLayout" name="formLayout_3">
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Y Flip</string>
</property>
</widget>
</item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
@ -147,6 +164,26 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Y Flip</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Selection</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="checkBox_xFlip">
<property name="layoutDirection">
@ -164,30 +201,65 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QGraphicsView" name="graphicsView_selectedTile">
<property name="minimumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_5">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Metatile Properties</string>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
<property name="flat">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QGraphicsView" name="graphicsView_selectedTile">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Bottom/Top</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QGraphicsView" name="graphicsView_metatileLayers">
<property name="minimumSize">
<size>
<width>32</width>
<width>64</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
<height>32</height>
</size>
</property>
<property name="verticalScrollBarPolicy">
@ -198,6 +270,26 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Metatile Behavior</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QComboBox" name="comboBox_metatileBehaviors"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Layer Type</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QComboBox" name="comboBox_layerType"/>
</item>
</layout>
</widget>
</item>
@ -214,8 +306,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>309</width>
<height>409</height>
<width>386</width>
<height>361</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
@ -288,85 +380,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QFrame" name="frame_6">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Bottom/Top</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QGraphicsView" name="graphicsView_metatileLayers">
<property name="minimumSize">
<size>
<width>64</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>32</height>
</size>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Metatile Behavior</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QComboBox" name="comboBox_metatileBehaviors"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Layer Type</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QComboBox" name="comboBox_layerType"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">

View file

@ -126,16 +126,16 @@ void TilesetEditor::drawSelectedTiles() {
this->selectedTileScene->clear();
QList<uint16_t> tiles = this->tileSelector->getSelectedTiles();
QPoint dimensions = this->tileSelector->getSelectionDimensions();
QImage selectionImage(32 * dimensions.x(), 32 * dimensions.y(), QImage::Format_RGBA8888);
QImage selectionImage(16 * dimensions.x(), 16 * dimensions.y(), QImage::Format_RGBA8888);
QPainter painter(&selectionImage);
int tileIndex = 0;
for (int j = 0; j < dimensions.y(); j++) {
for (int i = 0; i < dimensions.x(); i++) {
QImage tileImage = getColoredTileImage(tiles.at(tileIndex), this->primaryTileset, this->secondaryTileset, this->paletteId)
.mirrored(this->tileXFlip, this->tileYFlip)
.scaled(32, 32);
.scaled(16, 16);
tileIndex++;
painter.drawImage(i * 32, j * 32, tileImage);
painter.drawImage(i * 16, j * 16, tileImage);
}
}