def save_surf(self, surf): image_name = ''.join([ self.klass, str(self.gender), '_', self.name, '_', self.pose, '_', str(self.counter), '.png' ]) Engine.save_surface(surf, image_name) self.counter += 1 return image_name
def run(gameStateObj, metaDataObj): while True: Engine.update_time() # Get events eventList = Engine.build_event_list() # Update global music thread Engine.music_thread.update(eventList) # === UPDATE USER STATES === mapSurf, repeat = gameStateObj.stateMachine.update( eventList, gameStateObj, metaDataObj) while repeat: # We don't need to process the eventList more than once I think mapSurf, repeat = gameStateObj.stateMachine.update([], gameStateObj, metaDataObj) # Update global sprite counters GC.PASSIVESPRITECOUNTER.update() GC.ACTIVESPRITECOUNTER.update() GC.CURSORSPRITECOUNTER.update() #new_size = (cf.OPTIONS['Screen Width'], cf.OPTIONS['Screen Height']) draw_rect = GC.TEMPCANVASRECT Engine.push_display(mapSurf, (draw_rect[2], draw_rect[3]), GC.TEMPCANVAS) GC.DISPLAYSURF.blit(GC.TEMPCANVAS, draw_rect) #Engine.push_display(mapSurf, new_size, GC.DISPLAYSURF) # Check for taking screenshot for event in eventList: if event.type == Engine.KEYDOWN and event.key == Engine.key_map[ '`']: current_time = str(datetime.now()).replace(' ', '_').replace( ':', '.') Engine.save_surface(mapSurf, "Lex_Talionis_%s.png" % current_time) # Keep gameloop (update, renders, etc) ticking Engine.update_display() gameStateObj.playtime += GC.FPSCLOCK.tick(GC.FPS)