Rect中的文本 - Pygame

lil*_*ood 2 python user-interface pygame sdl

你知道我是否可以在Rect中插入文本以及如何?

我创建了一个Surface Objet并在其上添加Text,我认为这不是最好的方法.

Ash*_*ies 5

我总是从PyGame转向但是从原始SDL和OpenGL的经验来看,我几乎可以确认你是在做最好的方式.

就像是:

Text.position = rectangle.position + rectangle.size / 2
Text.position.X = Text.position.X - text.width / 2
Run Code Online (Sandbox Code Playgroud)

会把它集中在你身上.