Set bg map to 32 x 32

master
Fabien Freling 2016-08-10 00:05:10 +02:00
parent 6a42bf273a
commit 4d1be1578f
2 changed files with 20 additions and 53 deletions

View File

@ -5,8 +5,8 @@ Window {
title: "Background maps" title: "Background maps"
// A background map is 32 x 32 tiles. // A background map is 32 x 32 tiles.
// Each tile is 8 x 8 pixels. // Each tile is 8 x 8 pixels.
width: 256 width: 32 * (16 + 1) + 1
height: 256 height: 32 * (16 + 1) + 1
maximumWidth: width maximumWidth: width
minimumWidth: width minimumWidth: width
maximumHeight: height maximumHeight: height

View File

@ -1,57 +1,24 @@
import QtQuick 2.4 import QtQuick 2.4
Item {
width: 400
height: 400
GridView {
id: bgmap_01 Rectangle {
visible: true width: 32 * (16 + 1) + 1; height: 32 * (16 + 1) + 1; color: "black"
smooth: false
enabled: false Grid {
keyNavigationWraps: false x: 1; y: 1
interactive: false rows: 32; columns: 32; spacing: 1
anchors.fill: parent
flickableDirection: Flickable.VerticalFlick Repeater {
delegate: Item { model: parent.rows * parent.columns
x: 5 Rectangle {
height: 50 width: 16; height: 16
Column { color: "lightgreen"
width: 8
height: 8 Text {
spacing: 0 text: index
Rectangle { font.pointSize: 12
x: 0 anchors.centerIn: parent } }
width: 8
height: 8
color: colorCode
border.width: 1
anchors.horizontalCenter: parent.horizontalCenter
}
}
} }
cellWidth: 8
model: ListModel {
ListElement {
name: "Grey"
colorCode: "grey"
}
ListElement {
name: "Red"
colorCode: "red"
}
ListElement {
name: "Blue"
colorCode: "blue"
}
ListElement {
name: "Green"
colorCode: "green"
}
}
cellHeight: 8
} }
} }