Reputation: 1684
I'm trying to create a transparent surface over the pygame screen, unfortunately is not working. The main surface shows ok, but the surface that im trying to generate doesn't show at all.
import pygame as pg
from pygame.locals import *
pg.display.init()
h = 640
w = 480
_display = pg.display.set_mode((h,w))
_display.fill(pg.Color(0,0,0))
_active_surface = pg.Surface((h,w))
#_active_surface.set_colorkey((255,0,255))
_active_surface.fill(pg.Color(255,0,255))
_display.blit(_active_surface, (h,w))
while True:
for i in pg.event.get():
if i.type == QUIT:
pg.quit()
pg.display.flip()
Upvotes: 0
Views: 408
Reputation: 13000
_display.blit(_active_surface, (h,w))
I think the last argument is the top-left corner of the position at which the blitting should occur. Here you're giving (h,w), which is equal to the size of the screen, so blitting occurs off-screen. Try with (0,0) instead.
Upvotes: 5