def DrawCenterText(text, xt, yt, Size, Color, self):
font_id = 0
# Offset Shadow
Sshadow_x = 2
Sshadow_y = -2
blf.size(font_id, Size, 72)
blf.position(font_id, xt + Sshadow_x - blf.dimensions(font_id, text)[0] / 2, yt + Sshadow_y, 0)
bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
blf.draw(font_id, text)
blf.position(font_id, xt - blf.dimensions(font_id, text)[0] / 2, yt, 0)
if Color is not None:
mColor = mathutils.Color((Color[0], Color[1], Color[2]))
bgl.glColor4f(mColor.r, mColor.g, mColor.b, 1.0)
else:
bgl.glColor4f(1.0, 1.0, 1.0, 1.0)
blf.draw(font_id, text)
# Draw text (Left position)
评论列表
文章目录