Pygame 光标位图传输

Pygame cursor blitting

我目前正在开发一款 RPG 游戏 now.And 我需要为它制作一个看起来很酷的光标,但我的实际光标在新光标上进行了 blit。 我该如何解决?

import pygame,sys
from pygame.locals import *
pygame.init()
newcursor = "glove3.png"
display = pygame.display.set_mode((640,360),0, 32)
glovecursor = pygame.image.load(newcursor).convert_alpha()
while True:
    for event in pygame.event.get():
    if event.type == QUIT:
        pygame.quit()
        quit()
    display.fill((0,0,0))
    x,y = pygame.mouse.get_pos()
    x -= glovecursor.get_width()/7
    y -= glovecursor.get_height()/19
    display.blit(glovecursor,(x,y))
    pygame.display.update()

尝试使用 pygame.cursors. Also pygame.mouse.set_cursor

基本上,您使用 pygame.mouse.set_cursor(*cursor),其中 cursor 包含有关此格式的游标的各种数据:(size, hotspot, xormasks, andmasks)

您始终可以创建一个带有自己的精灵 image/surface 并在其更新功能中,只需将其位置设置为光标的当前位置即可。

self.pos = pygame.mouse.get_pos()

但是上面的 set_cursor()pygame.cursors 可以正常工作。