diff options
author | Colin Noga <Tempus@chronometry.ca> | 2011-12-02 00:33:09 -0600 |
---|---|---|
committer | Colin Noga <Tempus@chronometry.ca> | 2011-12-02 00:33:09 -0600 |
commit | cbadd29918da648190cd609130f808e11cf01a25 (patch) | |
tree | 029d7664c6729bf7f02416f0b9be302d1bd854e3 /src/editorui | |
parent | 1b0e3e2ea94b6093c777f62e8eea8c8adf0294aa (diff) | |
download | koopatlas-cbadd29918da648190cd609130f808e11cf01a25.tar.gz koopatlas-cbadd29918da648190cd609130f808e11cf01a25.zip |
Added a whackload of menu functions - screenshots, select all, deselect, add tileset layer add doodad layer, remoive layer, move layer up, down, to bottom or to top, add tileset (by copying it to the Tileset folder), add doodad, play animation, reset animation, grid, zoom in, zoom out, actual size, show/hide all the docks at will. Placeholders for other stuff also added.
Diffstat (limited to 'src/editorui')
-rw-r--r-- | src/editorui/editormain.py | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/src/editorui/editormain.py b/src/editorui/editormain.py index b74967b..136eee1 100644 --- a/src/editorui/editormain.py +++ b/src/editorui/editormain.py @@ -23,6 +23,8 @@ class KPMapScene(QtGui.QGraphicsScene): self.ticker.valueChanged.connect(self.thing) self.ticker.setUpdateInterval(16.6666666666667) + self.grid = False + def playPause(self): if self.playing == False: @@ -49,6 +51,89 @@ class KPMapScene(QtGui.QGraphicsScene): self.views()[0].viewport().update() + def drawForeground(self, painter, rect): + if not self.grid: return + + Zoom = KP.mainWindow.ZoomLevel + drawLine = painter.drawLine + + if Zoom >= 4: + startx = rect.x() + startx -= (startx % 24) + endx = startx + rect.width() + 24 + + starty = rect.y() + starty -= (starty % 24) + endy = starty + rect.height() + 24 + + painter.setPen(QtGui.QPen(QtGui.QColor.fromRgb(255,255,255,100), 1, QtCore.Qt.DotLine)) + + x = startx + y1 = rect.top() + y2 = rect.bottom() + while x <= endx: + drawLine(x, starty, x, endy) + x += 24 + + y = starty + x1 = rect.left() + x2 = rect.right() + while y <= endy: + drawLine(startx, y, endx, y) + y += 24 + + + if Zoom >= 2: + startx = rect.x() + startx -= (startx % 96) + endx = startx + rect.width() + 96 + + starty = rect.y() + starty -= (starty % 96) + endy = starty + rect.height() + 96 + + painter.setPen(QtGui.QPen(QtGui.QColor.fromRgb(255,255,255,100), 1, QtCore.Qt.DashLine)) + + x = startx + y1 = rect.top() + y2 = rect.bottom() + while x <= endx: + drawLine(x, starty, x, endy) + x += 96 + + y = starty + x1 = rect.left() + x2 = rect.right() + while y <= endy: + drawLine(startx, y, endx, y) + y += 96 + + + startx = rect.x() + startx -= (startx % 192) + endx = startx + rect.width() + 192 + + starty = rect.y() + starty -= (starty % 192) + endy = starty + rect.height() + 192 + + painter.setPen(QtGui.QPen(QtGui.QColor.fromRgb(255,255,255,100), 2, QtCore.Qt.DashLine)) + + x = startx + y1 = rect.top() + y2 = rect.bottom() + while x <= endx: + drawLine(x, starty, x, endy) + x += 192 + + y = starty + x1 = rect.left() + x2 = rect.right() + while y <= endy: + drawLine(startx, y, endx, y) + y += 192 + + def drawBackground(self, painter, rect): painter.fillRect(rect, QtGui.QColor(209, 218, 236)) |