-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.py
697 lines (509 loc) · 24.4 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# PointlessMaker
# Version 0.2
# Copyright © 2017 MasterVermilli0n/AboodXD
# This file is part of PointlessMaker.
# PointlessMaker is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# PointlessMaker is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
import zlib
from PyQt5 import QtCore, QtGui, QtWidgets
Qt = QtCore.Qt
from area import *
import globals
from items import *
from objects import *
from structs import *
from widgets import *
EditorVersion = '0.2'
class MainWindow(QtWidgets.QMainWindow):
def CreateAction(self, shortname, function, icon, text, statustext, shortcut, toggle=False):
"""
Helper function to create an action
From Miyamoto
"""
if icon is not None:
act = QtWidgets.QAction(icon, text, self)
else:
act = QtWidgets.QAction(text, self)
if shortcut is not None:
act.setShortcut(shortcut)
if statustext is not None:
act.setStatusTip(statustext)
if toggle:
act.setCheckable(True)
if function is not None:
act.triggered.connect(function)
self.actions[shortname] = act
def __init__(self):
super().__init__(None)
self.setWindowTitle('PointlessMaker v0.2')
self.setUnifiedTitleAndToolBarOnMac(True)
self.UpdateFlag = False
self.selObj = None
self.CurrentSelection = []
self.scene = Scene(0, -(27 * globals.TileWidth), 241 * globals.TileWidth, 28 * globals.TileWidth, self)
self.scene.setItemIndexMethod(QtWidgets.QGraphicsScene.NoIndex)
self.scene.selectionChanged.connect(self.handleSceneSelectionChanged)
self.graphicsView = LevelViewWidget(self.scene, self)
self.graphicsView.centerOn(0, -(26.5 * globals.TileWidth))
self.setCentralWidget(self.graphicsView)
self.selAllShort = QtWidgets.QShortcut(QtGui.QKeySequence.SelectAll, self)
self.selAllShort.activated.connect(self.SelectAll)
self.gridShort = QtWidgets.QShortcut(QtGui.QKeySequence('G'), self)
self.gridShort.activated.connect(self.ToggleGrid)
def __init2__(self):
self.createMenubar()
self.SetupDocksAndPanels()
self.HandleOpenFromFile()
actions = {}
def createMenubar(self):
self.CreateAction('openfromfile', self.HandleOpenFromFile, None,
'Open Level by File...', 'Open a level based on its filename',
QtGui.QKeySequence('Ctrl+Shift+O'))
self.CreateAction('save', self.HandleSaveAs, None, 'Save Level',
'Save the level back to the archive file', QtGui.QKeySequence.Save)
self.CreateAction('screenshot', self.HandleScreenshot, None, 'Level Screenshot...',
'Take a full size screenshot of your level for you to share', QtGui.QKeySequence('Ctrl+Alt+S'))
menubar = QtWidgets.QMenuBar()
self.setMenuBar(menubar)
fmenu = menubar.addMenu('&File')
fmenu.addAction(self.actions['openfromfile'])
fmenu.addSeparator()
fmenu.addAction(self.actions['save'])
fmenu.addSeparator()
fmenu.addAction(self.actions['screenshot'])
def SetupDocksAndPanels(self):
dock = QtWidgets.QDockWidget('Modify Selected Object Properties', self)
dock.setVisible(False)
dock.setFeatures(QtWidgets.QDockWidget.DockWidgetMovable | QtWidgets.QDockWidget.DockWidgetFloatable)
dock.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
dock.setObjectName('objecteditor')
self.addDockWidget(Qt.RightDockWidgetArea, dock)
dock.setFloating(True)
# create the palette
dock = QtWidgets.QDockWidget('Palette', self)
dock.setFeatures(
QtWidgets.QDockWidget.DockWidgetMovable | QtWidgets.QDockWidget.DockWidgetFloatable | QtWidgets.QDockWidget.DockWidgetClosable)
dock.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
dock.setObjectName('palette') # needed for the state to save/restore correctly
self.creationDock = dock
self.addDockWidget(Qt.RightDockWidgetArea, dock)
dock.setVisible(True)
self.objPicker = ObjectPickerWidget()
self.objPicker.ObjChanged.connect(self.ObjectChoiceChanged)
self.objPicker.ObjReplace.connect(self.ObjectReplace)
dock.setWidget(self.objPicker)
def HandleOpenFromFile(self):
filename = QtWidgets.QFileDialog.getOpenFileName(self, "Open Level", '', 'Course data file (*.cdt)')[0]
if filename:
self.LoadLevel(str(filename))
return True
return
def HandleSaveAs(self):
if globals.LevelLoaded:
filename = QtWidgets.QFileDialog.getSaveFileName(self, "Save Level As", '', 'Wii U Course data file (*.cdt)')[0]
if filename:
courseBuffer = globals.Area.save()
with open(filename, "wb+") as out:
out.write(courseBuffer)
return True
return
def HandleScreenshot(self):
if globals.LevelLoaded:
fn = QtWidgets.QFileDialog.getSaveFileName(self, "Save Screenshot", '/untitled.png',
'PNG file (*.png)')[0]
if fn == '': return
fn = str(fn)
areaWidth = globals.Area.areaWidth * globals.TileWidth / 16
ScreenshotImage = QtGui.QImage(areaWidth, 27 * globals.TileWidth, QtGui.QImage.Format_ARGB32)
ScreenshotImage.fill(Qt.transparent)
RenderPainter = QtGui.QPainter(ScreenshotImage)
self.scene.render(RenderPainter, QtCore.QRectF(0, 0, areaWidth, 27 * globals.TileWidth),
QtCore.QRectF(0.5 * globals.TileWidth,
-26.5 * globals.TileWidth,
areaWidth,
27 * globals.TileWidth))
RenderPainter.end()
ScreenshotImage.save(fn, 'PNG', 50)
def SelectAll(self):
paintRect = QtGui.QPainterPath()
paintRect.addRect(0, -(26.5 * globals.TileWidth), 241 * globals.TileWidth, 27.5 * globals.TileWidth)
self.scene.setSelectionArea(paintRect)
def ToggleGrid(self):
globals.GridShown = not globals.GridShown
self.scene.update()
def LoadLevel(self, filename):
with open(filename, "rb") as inf:
inb = inf.read()
checksum = zlib.crc32(inb[16:]) % (1 << 32)
if inb[8:12] == checksum.to_bytes(4, "big"):
bom = '>'
elif inb[8:12] == checksum.to_bytes(4, "little"):
bom = '<'
else:
print("Invalid checksum! Level data seems to be corrupted...")
return
cdt = CourseData(bom)
cdt.data(inb, 0)
self.scene.clearSelection()
self.CurrentSelection = []
self.scene.clear()
self.graphicsView.centerOn(0, -(26.5 * globals.TileWidth))
areaWidth = cdt.areaWidth * globals.TileWidth / 16
border = BorderItem(0.5 * globals.TileWidth, -26.5 * globals.TileWidth, areaWidth, 27 * globals.TileWidth)
self.scene.addItem(border)
globals.Area = Area(inb, cdt, bom)
globals.LevelLoaded = True
levelname = globals.Area.name.split(b'\x00\x00')[0].decode('utf-16-be')
self.setWindowTitle(levelname)
def handleSceneSelectionChanged(self):
try:
selitems = self.scene.selectedItems()
except RuntimeError:
return
showObjectPanel = False
updateModeInfo = False
if len(selitems) == 1:
item = selitems[0]
self.selObj = item
elif not selitems:
self.selObj = None
self.CurrentSelection = selitems
def keyPressEvent(self, event):
if event.key() in [Qt.Key_Delete, Qt.Key_Backspace]:
sel = self.scene.selectedItems()
for obj in sel:
index = globals.Area.objects.index(obj)
del globals.Area.objects[index]
obj.delete()
obj.setSelected(False)
self.scene.removeItem(obj)
event.accept()
elif event.key() in [Qt.Key_S, Qt.Key_W, Qt.Key_D, Qt.Key_A]:
sel = self.scene.selectedItems()
for obj in sel:
if isinstance(obj, Area):
continue
if obj.objType == EditDokan and obj.parentFlags & 0x60 not in [0x40, 0x60]:
w = obj.height
h = obj.width
obj.height, obj.width = h, w
# Increase the height
if event.key() == Qt.Key_S:
obj.height += globals.TileWidth
if obj.objType in MaxDimensions:
if obj.height > MaxDimensions[obj.objType][1] * globals.TileWidth:
obj.height = MaxDimensions[obj.objType][1] * globals.TileWidth
else:
if obj.height > 255 * globals.TileWidth:
obj.height = 255 * globals.TileWidth
# Decrease the height
elif event.key() == Qt.Key_W:
obj.height -= globals.TileWidth
if obj.objType in MinDimensions:
if obj.height < MinDimensions[obj.objType][1] * globals.TileWidth:
obj.height = MinDimensions[obj.objType][1] * globals.TileWidth
else:
if obj.height < globals.TileWidth:
obj.height = globals.TileWidth
# Increase the width
elif event.key() == Qt.Key_D:
obj.width += globals.TileWidth
if obj.objType in MaxDimensions:
if obj.width > MaxDimensions[obj.objType][0] * globals.TileWidth:
obj.width = MaxDimensions[obj.objType][0] * globals.TileWidth
else:
if obj.width > 255 * globals.TileWidth:
obj.width = 255 * globals.TileWidth
# Decrease the width
elif event.key() == Qt.Key_A:
obj.width -= globals.TileWidth
if obj.objType in MinDimensions:
if obj.width < MinDimensions[obj.objType][0] * globals.TileWidth:
obj.width = MinDimensions[obj.objType][0] * globals.TileWidth
else:
if obj.width < globals.TileWidth:
obj.width = globals.TileWidth
# Update the pixmaps which need updating
if obj.objType == EditDokan:
obj.pix, obj.width, obj.height = self.paintPipe(2, obj.height // globals.TileWidth, obj.parentFlags & 0x60)
elif obj.objType == EditGroundBox:
obj.pix = self.paintGroundBox(obj.width // globals.TileWidth, obj.height // globals.TileWidth, ((obj.parentFlags >> 16) & 0xF) // 4)[0]
elif obj.objType == EditGroundGoal:
obj.pix = self.paintGroundGoal(obj.width // globals.TileWidth + 3, obj.height // globals.TileWidth)[0]
elif obj.objType == EditGroundStart:
obj.pix = self.paintGroundStart(obj.width // globals.TileWidth + 3, obj.height // globals.TileWidth)[0]
oldrect = obj.boundRect
newrect = QtCore.QRectF(obj.x(), obj.y(), obj.width, obj.height)
updaterect = oldrect.united(newrect)
obj.update(updaterect)
obj.UpdateRects()
self.scene.update(updaterect)
event.accept()
else:
super().keyPressEvent(event)
@QtCore.pyqtSlot(int)
def ObjectChoiceChanged(self, type_):
globals.CurrentObject = type_
@QtCore.pyqtSlot(int)
def ObjectReplace(self, type_):
items = self.scene.selectedItems()
type_obj = PixmapItem
parentFlags = 0x6000840
if type_ == 0:
type_ = EditRengaBlock
elif type_ == 1:
type_ = EditHatenaBlock
elif type_ == 2:
type_ = EditHardBlock
elif type_ == 3:
type_ = EditKumoBlock
elif type_ == 4:
type_ = EditIceBlock
elif 4 < type_ < 76:
data = type_ - 5
type_ = EditGround
elif type_ == 76:
type_ = EditCoin
elif type_ == 77:
parentFlags |= 0x4
type_ = EditCoin
elif type_ == 78:
type_ = EditDokan
elif type_ == 79:
parentFlags = 0x6000800
type_ = EditDokan
elif type_ == 80:
parentFlags = 0x6000860
type_ = EditDokan
elif type_ == 81:
parentFlags = 0x6000820
type_ = EditDokan
elif type_ == 82:
type_ = EditGroundBox
elif type_ == 83:
parentFlags |= 0x40000
type_ = EditGroundBox
elif type_ == 84:
parentFlags |= 0x80000
type_ = EditGroundBox
elif type_ == 85:
type_ = EditGroundGoal
elif type_ == 86:
type_ = EditGroundStart
else:
return
for x in items:
if isinstance(x, type_obj) and x.type != type_:
for z in objectsZValues:
if type_ in objectsZValues[z]:
break
if type_ == EditRengaBlock:
pix = globals.Tiles[1]
x.width = globals.TileWidth
x.height = globals.TileWidth
elif type_ == EditHatenaBlock:
pix = globals.Tiles[2]
x.width = globals.TileWidth
x.height = globals.TileWidth
elif type_ == EditHardBlock:
pix = globals.Tiles[6]
x.width = globals.TileWidth
x.height = globals.TileWidth
elif type_ == EditKumoBlock:
pix = globals.Tiles[102]
x.width = globals.TileWidth
x.height = globals.TileWidth
elif type_ == EditIceBlock:
pix = globals.Tiles[120]
x.width = globals.TileWidth
x.height = globals.TileWidth
elif type_ == EditGround:
pix = globals.Tiles[184 + data]
x.width = globals.TileWidth
x.height = globals.TileWidth
x.data = data
elif type_ == EditCoin and not parentFlags & 0x4:
pix = globals.Tiles[7]
x.width = globals.TileWidth
x.height = globals.TileWidth
elif type_ == EditCoin and parentFlags & 0x4 == 4:
pix = globals.Tiles[256]
x.width = globals.TileWidth
x.height = globals.TileWidth
elif type_ == EditDokan:
pix, x.width, x.height = self.paintPipe(2, max(2, x.height // globals.TileWidth), parentFlags & 0x60)
elif type_ == EditGroundBox:
pix, x.width, x.height = self.paintGroundBox(max(3, x.width // globals.TileWidth), max(3, x.height // globals.TileWidth), ((parentFlags >> 16) & 0xF) // 4)
z -= 0x100000000
elif type_ == EditGroundGoal:
pix, x.width, x.height = self.paintGroundGoal(max(13, x.width // globals.TileWidth + 3), max(2, x.height // globals.TileWidth))
elif type_ == EditGroundStart:
pix, x.width, x.height = self.paintGroundStart(max(8, x.width // globals.TileWidth + 3), max(2, x.height // globals.TileWidth))
x.parentFlags = parentFlags
x.SetType(type_, pix, z)
def paintPipe(self, w, h, direction):
pix = QtGui.QPixmap()
painter = QtGui.QPainter(pix)
rw, rh = 0, 0
top = True
if direction in [0x40, 0x60]:
rw, rh = (w * globals.TileWidth, h * globals.TileWidth)
pix = QtGui.QPixmap(rw, rh)
pix.fill(Qt.transparent)
painter = QtGui.QPainter(pix)
ys = {0x60: range(h - 1, -1, -1), 0x40: range(h)}
for y in ys[direction]:
for x in range(w):
realX = x
while realX > 1:
realX -= 2
if top:
if direction == 0x40: # Up
painter.drawPixmap(globals.TileWidth * x, globals.TileWidth * y, globals.Tiles[14 + 1 * realX])
else: # Down
painter.drawPixmap(globals.TileWidth * x, globals.TileWidth * y, globals.Tiles[46 + 1 * realX])
else:
painter.drawPixmap(globals.TileWidth * x, globals.TileWidth * y, globals.Tiles[30 + 1 * realX])
top = False
elif direction in [0, 0x20]:
rw, rh = (h * globals.TileWidth, w * globals.TileWidth)
pix = QtGui.QPixmap(rw, rh)
pix.fill(Qt.transparent)
painter = QtGui.QPainter(pix)
xs = {0: range(h - 1, -1, -1), 0x20: range(h)}
for x in xs[direction]:
for y in range(w):
realY = y
while realY > 1:
realY -= 2
if top:
if not direction: # Right
painter.drawPixmap(globals.TileWidth * x, globals.TileWidth * y, globals.Tiles[13 + 16 * realY])
else: # Left
painter.drawPixmap(globals.TileWidth * x, globals.TileWidth * y, globals.Tiles[11 + 16 * realY])
else:
painter.drawPixmap(globals.TileWidth * x, globals.TileWidth * y, globals.Tiles[12 + 16 * realY])
top = False
painter.end()
return pix, rw, rh
def paintGroundBox(self, w, h, type_):
rw, rh = (w * globals.TileWidth, h * globals.TileWidth)
pix = QtGui.QPixmap(rw, rh)
pix.fill(Qt.transparent)
painter = QtGui.QPainter(pix)
# Top
if 0 < w < 3:
painter.drawPixmap(0, 0, globals.TileWidth, globals.TileWidth, globals.Tiles[55 + 3 * type_])
if w > 1:
painter.drawPixmap(globals.TileWidth, 0, globals.TileWidth, globals.TileWidth, globals.Tiles[57 + 3 * type_])
elif w:
painter.drawPixmap(0, 0, globals.TileWidth, globals.TileWidth, globals.Tiles[55 + 3 * type_])
painter.drawTiledPixmap(globals.TileWidth, 0, (w - 2) * globals.TileWidth, globals.TileWidth, globals.Tiles[56 + 3 * type_])
painter.drawPixmap(globals.TileWidth + (w - 2) * globals.TileWidth, 0, globals.TileWidth, globals.TileWidth, globals.Tiles[57 + 3 * type_])
# Middle
l1 = [71, 87]
l2 = [72, 88]
l3 = [73, 89]
if 0 < w < 3:
for y in range(1, h - 1):
realY = y - 1
while realY > 1:
realY -= 2
painter.drawPixmap(0, globals.TileWidth * y, globals.TileWidth, globals.TileWidth, globals.Tiles[l1[realY] + 3 * type_])
if w > 1:
painter.drawPixmap(globals.TileWidth, globals.TileWidth * y, globals.TileWidth,
globals.TileWidth, globals.Tiles[l3[realY] + 3 * type_])
elif w:
for y in range(1, h - 1):
realY = y - 1
while realY > 1:
realY -= 2
painter.drawPixmap(0, globals.TileWidth * y, globals.TileWidth, globals.TileWidth, globals.Tiles[l1[realY] + 3 * type_])
for x in range(1, w - 1):
realX = x - 1
while realX > 1:
realX -= 2
if realX == realY:
painter.drawTiledPixmap(globals.TileWidth * x, globals.TileWidth * y, globals.TileWidth,
globals.TileWidth, globals.Tiles[l2[0] + 3 * type_])
else:
painter.drawTiledPixmap(globals.TileWidth * x, globals.TileWidth * y, globals.TileWidth,
globals.TileWidth, globals.Tiles[l2[1] + 3 * type_])
painter.drawPixmap(globals.TileWidth + ((w - 2) * globals.TileWidth), globals.TileWidth * y, globals.TileWidth,
globals.TileWidth, globals.Tiles[l3[realY] + 3 * type_])
# Bottom
if 0 < w < 3:
painter.drawPixmap(0, (h - 1) * globals.TileWidth, globals.TileWidth, globals.TileWidth, globals.Tiles[103 + 3 * type_])
if w > 1:
painter.drawPixmap(globals.TileWidth, (h - 1) * globals.TileWidth, globals.TileWidth, globals.TileWidth, globals.Tiles[105 + 3 * type_])
elif w:
painter.drawPixmap(0, (h - 1) * globals.TileWidth, globals.TileWidth, globals.TileWidth, globals.Tiles[103 + 3 * type_])
painter.drawTiledPixmap(globals.TileWidth, (h - 1) * globals.TileWidth, (w - 2) * globals.TileWidth,
globals.TileWidth, globals.Tiles[104 + 3 * type_])
painter.drawPixmap(globals.TileWidth + (w - 2) * globals.TileWidth, (h - 1) * globals.TileWidth, globals.TileWidth,
globals.TileWidth, globals.Tiles[105 + 3 * type_])
painter.end()
return pix, rw, rh
def paintGroundStart(self, w, h):
w -= 3
rw, rh = (w * globals.TileWidth, h * globals.TileWidth)
pix = QtGui.QPixmap(rw, rh)
pix.fill(Qt.transparent)
painter = QtGui.QPainter(pix)
edge = True
for x in range(w - 1, -1, -1):
for y in range(h):
if x == w - 1:
if not y:
painter.drawPixmap(globals.TileWidth * x, globals.TileWidth * y, globals.Tiles[122])
else:
painter.drawPixmap(globals.TileWidth * x, globals.TileWidth * y, globals.Tiles[138])
else:
if not y:
painter.drawPixmap(globals.TileWidth * x, globals.TileWidth * y, globals.Tiles[121])
else:
painter.drawPixmap(globals.TileWidth * x, globals.TileWidth * y, globals.Tiles[137])
edge = False
painter.end()
return pix, rw, rh
def paintGroundGoal(self, w, h):
w -= 3
rw, rh = (w * globals.TileWidth, h * globals.TileWidth)
pix = QtGui.QPixmap(rw, rh)
pix.fill(Qt.transparent)
painter = QtGui.QPainter(pix)
for x in range(w):
for y in range(h):
if not x:
if not y:
painter.drawPixmap(globals.TileWidth * x, globals.TileWidth * y, globals.Tiles[123])
else:
painter.drawPixmap(globals.TileWidth * x, globals.TileWidth * y, globals.Tiles[139])
else:
if not y:
painter.drawPixmap(globals.TileWidth * x, globals.TileWidth * y, globals.Tiles[124])
else:
painter.drawPixmap(globals.TileWidth * x, globals.TileWidth * y, globals.Tiles[140])
painter.end()
return pix, rw, rh
def main():
globals.app = QtWidgets.QApplication(sys.argv)
globals.app.setApplicationDisplayName('PointlessMaker v%s' % EditorVersion)
globals.mainWindow = MainWindow()
globals.mainWindow.__init2__()
globals.mainWindow.show()
exitcodesys = globals.app.exec_()
globals.app.deleteLater()
sys.exit(exitcodesys)
if __name__ == '__main__': main()