def render(self, gametime): surface = pygame.Surface(self.screen.get_size()) surface.convert() surface.fill(self.background_color) for snowflake in self.snowflakes: snowflake.draw(surface) if self.show_text: surface.blit(self.fps_text, (8, 6)) surface.blit(self.snowflake_text, (8, 26)) self.screen.blit(surface, (0, 0)) pygame.display.flip()
def render(self, gametime): surface = pygame.Surface(self.screen.get_size()) surface.convert() surface.fill(self.background_color) self.drawHouse(surface) for snowflake in self.snowflakes: snowflake.draw(surface) if self.show_text: if self.fps_text == None: self.fps_text = self.font.render( "FPS: %d" % self.clock.get_fps(), 1, self.foreground_color) self.snowflake_text = self.font.render( "Snowflakes: %d" % len(self.snowflakes), 1, self.foreground_color) surface.blit(self.fps_text, (8, 6)) surface.blit(self.snowflake_text, (8, 26)) self.screen.blit(surface, (0, 0)) pygame.display.flip()
points.append( (6,13.5) ) points.append( (7,14) ) points.append( (7,15.5) ) points.append( (8,15.5) ) points.append( (8,9) ) points.append( (6,9) ) points.append( (7,8) ) points.append( (6,7) ) points.append( (8,7) ) points.append( (8,2) ) points.append( (5,3) ) points.append( (5,0) ) points.append( (6,-1) ) points.append( (2,-1) ) draw(points) snowflakePetal = growFlake(points, maxDepth=3, numChildren=4, angleBetweenSiblings=40, scalar=0.5) draw(snowflakePetal) # generate fullSnowflake = [] for i in range(0, 6): fullSnowflake += rotatePetal(snowflakePetal, pivot=(0,0), angle=(360/6) * i) draw(fullSnowflake) create3dPrintFile(fullSnowflake, 'testy')
from snowflake import plotPoints as draw, rotatePetal, growFlake, create3dPrintFile points = [(24, 4), (16, 4), (16, 6), (20, 6), (19, 7), (20, 8), (16, 8), (16, 10), (24, 10), (24, 8), (23, 7), (24, 6), (24, 4)] snowflakePetal = growFlake(points, maxDepth=3, numChildren=3, angleBetweenSiblings=15, scalar=0.5) snowflake = [] numBranches = 6 for i in range(numBranches): snowflake = snowflake + rotatePetal( snowflakePetal, angle=(360 / numBranches) * i, pivot=(24, 4)) draw(snowflake)
from snowflake import plotPoints as draw, rotatePetal, grow, create3dPrintFile, growFlake points = [(3, 0), (6, 3), (0, 3), (3, 0)] # a = grow(points) # draw(a) a = growFlake(points) draw(a)