本文整理汇总了Python中utils.Util.load_image方法的典型用法代码示例。如果您正苦于以下问题:Python Util.load_image方法的具体用法?Python Util.load_image怎么用?Python Util.load_image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils.Util
的用法示例。
在下文中一共展示了Util.load_image方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from utils import Util [as 别名]
# 或者: from utils.Util import load_image [as 别名]
def main():
pygame.init()
os.environ['SDL_VIDEO_CENTERED'] = '1' # center the window
screen = pygame.display.set_mode((Controller.WIDTH, Controller.HEIGHT))
pygame.display.set_caption('Aircraft [email protected]')
pygame.mouse.set_visible(1)
controller = Controller()
bg, bg_rect = Util.load_image('nebula_blue.f2014.png')
bg = bg.convert()
screen.blit(bg, (0, 0))
pygame.display.flip()
dubris, dubris_rect = Util.load_image('debris2_blue.png')
screen.blit(dubris, (0, 0))
pygame.display.flip()
#Prepare Game Objects
clock = pygame.time.Clock()
#Main Loop
counter = 0
while 1:
counter += 1
clock.tick(60)
for event in pygame.event.get():
controller.event_handler(event)
screen.blit(bg, (0, 0))
wtime = (counter / 4) % screen.get_rect().width
screen.blit(dubris, (wtime, 0))
draw_text(screen, controller)
controller.update()
controller.draw()
pygame.display.flip()
示例2: __init__
# 需要导入模块: from utils import Util [as 别名]
# 或者: from utils.Util import load_image [as 别名]
def __init__(self):
self.screen = pygame.display.get_surface()
self.area = self.screen.get_rect()
self.lives = 3
self.score = 0
self.started = False
self.splash, tmp = Util.load_image('splash.png')
self.splash_pos = [self.screen.get_rect().width / 2 - tmp.width / 2, \
self.screen.get_rect().height / 2 - tmp.height / 2]
self.ship = Ship([400, 300], [0, 0], 0)
self.allships = pygame.sprite.RenderPlain((self.ship,))
self.rock_group = pygame.sprite.Group()
self.missile_group = pygame.sprite.Group()
self.explosion_group = pygame.sprite.Group()
self.timer = RockSpanTimer(self, 1.5)