From cbadd29918da648190cd609130f808e11cf01a25 Mon Sep 17 00:00:00 2001 From: Colin Noga Date: Fri, 2 Dec 2011 00:33:09 -0600 Subject: 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. --- src/editorui/editormain.py | 85 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) (limited to 'src/editorui') 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)) -- cgit v1.2.3