Saranoske
(Boris Koštel)
February 5, 2021, 4:46pm
21
I have managed to do it by manually changing the position of the text object.
It will move based on the digits in the string.
txt = str(own['Number'])
numbers = sum(c.isdigit() for c in txt)
own.position.x = own['X'] - numbers * 0.07
Well, it’s something. I don’t know how to apply a mono space font. Or if some are automatically mono.
edderkop
(edderkop)
February 5, 2021, 5:11pm
22
a mono space font is a font where all the characters have the same width.
Saranoske
(Boris Koštel)
February 5, 2021, 6:13pm
23
Yes I understand what mono space font is. The thing is if I can use it with the text object in Blender. And which fonts are mono space?
I’ve been working on a custom model for easier drawing of text on the screen in real-time in BGE/UPBGE. It uses the BLF module. Perhaps you’d be interested when I release it?
Current function arguments.
# game_scene
# game_cam
# game_obj
# game_prop
# hud_scene
# hud_cam
# hud_obj
# font_path
# font_view
# font_size
# font_align
# font_text_col
# font_shadow_col
1 Like
Saranoske
(Boris Koštel)
February 6, 2021, 10:06am
25
Yes, it looks interesting.
1 Like
I’m curious, what is your personal preference, multiple game-properties or a simplified module function for example -
import rp
rp.drawFont(
game_scene="(1) Game",
game_cam="Camera",
game_obj="PlayerMiddle",
game_prop="Score2D",
hud_scene="(2) HUD",
hud_cam="Camera.001",
hud_obj="Placeholder : Score",
font_path="\\Windows\\Fonts\\ariblk.ttf",
font_view="2D",
font_size=40,
font_align="Center",
font_text_col=[0,0,1,1],
font_shadow_col=[5,0,0,0,4]
)
Saranoske
(Boris Koštel)
February 7, 2021, 8:33am
27
Definitely the simplified module function.
1 Like