I tried several options, in the first one I don’t understand where to connect my Transform, but the text aligns perfectly:
Code: Select all
def render(self, width, height, st, at):
if self.style.time_policy:
st, self.time_policy_data = self.style.time_policy(st, self.time_policy_data, self.style)
rv = super(Btn, self).render(width, height, st, at)
if self.clicked:
rect = self.style.focus_rect
if rect is not None:
fx, fy, fw, fh = rect
else:
fx = self.style.left_margin
fy = self.style.top_margin
fw = rv.width - self.style.right_margin
fh = rv.height - self.style.bottom_margin
mask = self.style.focus_mask
if mask is True:
mask = rv
elif mask is not None:
try:
mask = renpy.display.render.render(mask, rv.width, rv.height, st, at)
except Exception:
if callable(mask):
mask = mask
else:
raise Exception("Focus_mask must be None, True, a displayable, or a callable.")
if mask is not None:
fmx = 0
fmy = 0
else:
fmx = None
fmy = None
rv.add_focus(self, None,
fx, fy, fw, fh,
fmx, fmy, mask)
return rv
Code: Select all
def render(self, width, height, st, at):
t = Transform(child=self.child, matrixcolor=TintMatrix(self.current_text_color))
child_render = renpy.render(t, width, height, st, at)
self.width, self.height = child_render.get_size()
render = renpy.Render(self.width, self.height)
render.blit(child_render, (0, 0))
return render