Closed runedevros closed 5 months ago
Noticed this since some of Lost Sky's UI elements looked a little off.
The image "black.png" used in this script is here:
The following code fills the screen with black, draws a white 64x64 square and then blits black.png, a 64x64 pixel image on top of it.
# Comment out these two lines to go back to old Pygame version import pygame_sdl2 pygame_sdl2.import_as_pygame() import pygame from pygame import KEYDOWN, QUIT import sys def main(): pygame.init() tilesize = 35 size_x = 24 size_y = 18 screen_size = (tilesize * size_x, tilesize * size_y) screen = pygame.display.set_mode(screen_size, 0, 32) clock = pygame.time.Clock() black_square = pygame.image.load('black.png') stop_flag = False while not stop_flag: for event in pygame.event.get(): if event.type == QUIT: sys.exit() screen.fill((0,0, 0)) pygame.draw.rect(screen, (255, 255, 255), (100, 100, 64, 64)) screen.blit(black_square, (100,100)) pygame.display.flip() clock.tick(60) if __name__ == '__main__': main()
In Pygame, we get as expected a completely black screen.
But in PygameSDL2, there is a 1 pixel think | shaped thing where the rect is drawn one pixel too big.
Noticed this since some of Lost Sky's UI elements looked a little off.
The image "black.png" used in this script is here:
The following code fills the screen with black, draws a white 64x64 square and then blits black.png, a 64x64 pixel image on top of it.
In Pygame, we get as expected a completely black screen.
But in PygameSDL2, there is a 1 pixel think | shaped thing where the rect is drawn one pixel too big.