-
-
Notifications
You must be signed in to change notification settings - Fork 222
Open
Labels
videopygame.videopygame.video
Description
import pygame
from pygame._sdl2.video import Window, Renderer, Texture
pygame.init()
img = pygame.Surface((128,128))
img.fill("red")
win1 = Window("win1")
win2 = Window("win2")
ren1 = Renderer(win1)
ren2 = Renderer(win2)
tex2 = Texture.from_surface(ren2, img)
ren1.blit(tex2, (0,0))
ren1.present()
ren2.present()
while 1:
pygame.event.get()In this example, user trys to blit tex2 (created by ren2) to ren1. Then the tex2 is draw to the ren2, without any warning or error raised.

What's more? If an object that has a draw method is passed to Renderer.blit, then the draw method will be called without any checking, even though the draw function never draws on the Renderer.
So I suggest:
-
Renderer.blit()should only acceptTexture,Image(andSurface?) and their subclasses. -
Renderer.blit()should check if the Texture is created by itself.
Metadata
Metadata
Assignees
Labels
videopygame.videopygame.video