def draw(self): surf = Engine.create_surface((GC.WINWIDTH, GC.WINHEIGHT), transparent=True) Engine.fill(surf, (128, 160, 128)) if self.darken_background or self.target_dark: bg = Image_Modification.flickerImageTranslucent( GC.IMAGESDICT['BlackBackground'], 100 - abs(int(self.darken_background * 12.5))) surf.blit(bg, (0, 0)) if self.target_dark > self.darken_background: self.darken_background += 1 elif self.target_dark < self.darken_background: self.darken_background -= 1 # Make combat surf combat_surf = Engine.copy_surface(self.combat_surf) if self.darken_ui_background: self.darken_ui_background = min(self.darken_ui_background, 4) # bg = Image_Modification.flickerImageTranslucent(GC.IMAGESDICT['BlackBackground'], 100 - abs(int(self.darken_ui_background*11.5))) color = 255 - abs(self.darken_ui_background * 24) Engine.fill(combat_surf, (color, color, color), None, Engine.BLEND_RGB_MULT) # combat_surf.blit(bg, (0, 0)) self.darken_ui_background += 1 surf.blit(combat_surf, (0, 0)) self.anim.draw_under(surf, (0, 0)) self.anim.draw(surf, (0, 0)) self.anim.draw_over(surf, (0, 0)) self.foreground.draw(surf) return surf
qp.drawImage(0, 0, self.image) qp.end() class MainWindow(QtGui.QMainWindow): def __init__(self, surface, parent=None): super(MainWindow, self).__init__(parent) self.setCentralWidget(ImageWidget(surface)) Engine.simple_init() # Display creation is necessary to use convert and convert alpha surf = Engine.build_display((240, 160)) IMAGESDICT, UNITDICT, ICONDICT, ITEMDICT, ANIMDICT = images.getImages(home='../') Engine.remove_display() surf = Engine.create_surface((640, 480)) Engine.fill(surf, (64, 128, 192, 224)) Engine.blit(surf, IMAGESDICT['Clearing'], (0, 0)) app = QtGui.QApplication(sys.argv) window = MainWindow(surf) def b1_clicked(): print("Button 1 clicked") b1 = QtGui.QPushButton(window) b1.setText("Button1") b1.move(50, 20) b1.clicked.connect(b1_clicked) window.setGeometry(100, 100, 640, 480) window.show()