mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-10-01 03:43:46 +08:00
raylib: fix emoji vertical centering (#36358)
* space * font scale * fix centering
This commit is contained in:
@@ -16,7 +16,7 @@ class SetupWidget(Widget):
|
||||
self._pair_device_btn = Button("Pair device", self._show_pairing, button_style=ButtonStyle.PRIMARY)
|
||||
self._open_settings_btn = Button("Open", lambda: self._open_settings_callback() if self._open_settings_callback else None,
|
||||
button_style=ButtonStyle.PRIMARY)
|
||||
self._firehose_label = Label("🔥Firehose Mode 🔥", font_weight=FontWeight.MEDIUM, font_size=64)
|
||||
self._firehose_label = Label("🔥 Firehose Mode 🔥", font_weight=FontWeight.MEDIUM, font_size=64)
|
||||
|
||||
def set_open_settings_callback(self, callback):
|
||||
self._open_settings_callback = callback
|
||||
@@ -65,7 +65,7 @@ class SetupWidget(Widget):
|
||||
|
||||
# Title with fire emojis
|
||||
# TODO: fix Label centering with emojis
|
||||
self._firehose_label.render(rl.Rectangle(x - 40, y, w, 64))
|
||||
self._firehose_label.render(rl.Rectangle(x - 48, y, w, 64))
|
||||
y += 64 + spacing
|
||||
|
||||
# Description
|
||||
|
||||
@@ -170,7 +170,7 @@ class Label(Widget):
|
||||
line_pos.x += width_before.x
|
||||
|
||||
tex = emoji_tex(emoji)
|
||||
rl.draw_texture_ex(tex, line_pos, 0.0, self._font_size / tex.height, self._text_color)
|
||||
rl.draw_texture_ex(tex, line_pos, 0.0, self._font_size / tex.height * FONT_SCALE, self._text_color)
|
||||
line_pos.x += self._font_size * FONT_SCALE
|
||||
prev_index = end
|
||||
rl.draw_text_ex(self._font, text[prev_index:], line_pos, self._font_size, 0, self._text_color)
|
||||
|
||||
Reference in New Issue
Block a user