本文整理汇总了Python中Resources.textures方法的典型用法代码示例。如果您正苦于以下问题:Python Resources.textures方法的具体用法?Python Resources.textures怎么用?Python Resources.textures使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Resources
的用法示例。
在下文中一共展示了Resources.textures方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Window
# 需要导入模块: import Resources [as 别名]
# 或者: from Resources import textures [as 别名]
class Window(Core):
def __init__(self,type_map,name):
pygame.init()
if type_map < 3:
self.empty_map(type_map)
else:
self.load_file(name)
self.type = 0
self.resources = Resources()
self.graphical_logic = Graphical_logic()
self.w_event = Events()
self.minimap_x =0
self.minimap_y =0
self.count = 0
self.days = 0
self.cell_type = 0
self.fraction = 0
self.stage = 0
self.save_load_name = ''
def Main_Window(self):
self.display = pygame.display.set_mode((1280,720))
manager = ResManager()
pygame.display.set_icon(manager.get_image('icon.png'))
pygame.display.set_caption("Map Editor")
self.display.fill((220,220,250))
pygame.display.flip()
i = 0
def Maps_grid(self):
self.big_step = 60
self.steps_x =20
self.steps_y =11
for i in range(self.steps_x):
for j in range(self.steps_y):
cell = Rect((20+self.big_step*i,self.big_step*j),(self.big_step,self.big_step))
pygame.draw.rect(self.display,(0,0,0),cell,1)
pygame.display.flip()# лол, костЫль
def Minimaps_grid(self):
if self.map_type == 0:
self.step_p = 6
self.steps = 50
elif self.map_type == 1:
self.step_p = 3
self.steps = 100
elif self.map_type == 2:
self.step_p = 2
self.steps = 150
cell = Rect((800,0),(300,300))
pygame.draw.rect(self.display,(0,0,0),cell,2)
pygame.display.flip()
def load_cells_list(self):
self.cells_list = self.load_minimap_cells()
def type_of_grids(self):
textures = self.resources.textures()
colours = self.resources.colours()
for i in range(11):
textures[i]= pygame.transform.scale(textures[i],(60,60))
for i in range(7):
first_texture = textures[i].get_rect()
first_texture.center=(500+30+60*i,690)
self.display.blit(textures[i],first_texture)
cell = Rect((500+60*i,660),(60,60))
pygame.draw.rect(self.display,(0,0,0),cell,3)
pygame.display.update()
def moving_army(self):
pass
def reload_window(self,x,y):
self.Maps_grid()
self.Minimaps_grid()
self.Load_part_of_map(x,y)
pygame.display.flip()
def Load_part_of_map(self,x,y):
textures = self.resources.textures()
cells_list = self.load_cells(x, y)
print len(cells_list)
for i in range(11):
textures[i]= pygame.transform.scale(textures[i],(60,60))
for i in range(self.steps_x):
for j in range(self.steps_y):
print (j*self.steps_x+i)
print len(cells_list)
cell_type = cells_list[j*self.steps_x+i][2]
if (cell_type >7) and (cell_type<12):
x = cells_list[i*self.big_steps+j][0]
y = cells_list[i*self.big_steps+j][1]
local_list = self.load_cells_for_transparent_textures(x, y)
result_type = self.graphical_logic.get_type_background_textures(x, y, local_list)
first_texture = textures[result_type].get_rect()
first_texture.center=(50+self.big_step*i,30+self.big_step*j)
#.........这里部分代码省略.........