Exemplo n.º 1
0
x, y = 250, 50
clock = pygame.time.Clock()

backgrounds = [(255, 0, 0, 255), (0, 255, 0, 255), (0, 0, 255, 255)]
bg_index = 0

renderer.draw_color = backgrounds[bg_index]

win2 = Window('2nd window', size=(256, 256), always_on_top=True)
win2.opacity = 0.5
win2.set_icon(load_img('bomb.gif'))
renderer2 = Renderer(win2)
tex2 = Texture(renderer2, load_img('asprite.bmp'))
renderer2.clear()
renderer2.copy(tex2)
renderer2.present()
del tex2

full = 0

while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
        elif getattr(event, 'window', None) == win2:
            if event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE or\
               event.type == pygame.WINDOWEVENT and event.event == pygame.WINDOWEVENT_CLOSE:
                win2.destroy()
        elif event.type == pygame.KEYDOWN:
            if event.key == pygame.K_ESCAPE:
Exemplo n.º 2
0
x, y = 250, 50
clock = pygame.time.Clock()

backgrounds = [(255, 0, 0, 255), (0, 255, 0, 255), (0, 0, 255, 255)]
bg_index = 0

renderer.draw_color = backgrounds[bg_index]

win2 = Window('2nd window', size=(256, 256), always_on_top=True)
win2.opacity = 0.5
win2.set_icon(load_img('bomb.gif'))
renderer2 = Renderer(win2)
tex2 = Texture.from_surface(renderer2, load_img('asprite.bmp'))
renderer2.clear()
renderer2.copy(tex2)
renderer2.present()
del tex2

full = 0

srcrect = (0, 0, tex.width, tex.height)

while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
        elif getattr(event, 'window', None) == win2:
            if event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE or\
               event.type == pygame.WINDOWEVENT and event.event == pygame.WINDOWEVENT_CLOSE:
                win2.destroy()