From 9f657b012fba9276e3e8e170a73fa8b36f26ec62 Mon Sep 17 00:00:00 2001 From: Sebastian Morr Date: Tue, 22 Sep 2020 10:54:37 +0200 Subject: [PATCH] Show indented lines in the description as monospace --- main.gd | 5 +++++ styles/theme.tres | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/main.gd b/main.gd index 9033d32..e052a42 100644 --- a/main.gd +++ b/main.gd @@ -103,6 +103,11 @@ func load_level(id): var description_file = level_prefix+level+"/description" var description = game.read_file(description_file, "no description") + + # Surround all lines indented with four spaces with [code] tags. + var monospace_regex = RegEx.new() + monospace_regex.compile("\n (.*)\n") + description = monospace_regex.sub(description, "\n [code]$1[/code]\n", true) level_description.bbcode_text = description var congrats_file = level_prefix+level+"/congrats" diff --git a/styles/theme.tres b/styles/theme.tres index bce7f5a..f3b98f8 100644 --- a/styles/theme.tres +++ b/styles/theme.tres @@ -201,6 +201,23 @@ PopupMenu/styles/labeled_separator_right = null PopupMenu/styles/panel = SubResource( 16 ) PopupMenu/styles/panel_disabled = null PopupMenu/styles/separator = null +RichTextLabel/colors/default_color = Color( 1, 1, 1, 1 ) +RichTextLabel/colors/font_color_selected = Color( 0.49, 0.49, 0.49, 1 ) +RichTextLabel/colors/font_color_shadow = Color( 0, 0, 0, 0 ) +RichTextLabel/colors/selection_color = Color( 0.1, 0.1, 1, 0.8 ) +RichTextLabel/constants/line_separation = 1 +RichTextLabel/constants/shadow_as_outline = 0 +RichTextLabel/constants/shadow_offset_x = 1 +RichTextLabel/constants/shadow_offset_y = 1 +RichTextLabel/constants/table_hseparation = 3 +RichTextLabel/constants/table_vseparation = 3 +RichTextLabel/fonts/bold_font = null +RichTextLabel/fonts/bold_italics_font = null +RichTextLabel/fonts/italics_font = null +RichTextLabel/fonts/mono_font = ExtResource( 2 ) +RichTextLabel/fonts/normal_font = null +RichTextLabel/styles/focus = null +RichTextLabel/styles/normal = null TextEdit/colors/background_color = Color( 0, 0, 0, 0 ) TextEdit/colors/bookmark_color = Color( 0.08, 0.49, 0.98, 1 ) TextEdit/colors/brace_mismatch_color = Color( 1, 0.2, 0.2, 1 )