41 lines
1.5 KiB
GDScript
41 lines
1.5 KiB
GDScript
extends Control
|
|
|
|
var handwritten_text_size : float = (1.0/25.0)
|
|
var handwritten_margins : float = (1.0/15.0)
|
|
var handwritten_page_width : float = (3.0/4.0)
|
|
var handwritten_linespacing : float = -(1.1)
|
|
|
|
func setup(viewportsize, style, thetext):
|
|
set_size(viewportsize)
|
|
|
|
if style == "handwritten":
|
|
$handwritten/page.custom_minimum_size.x = int(viewportsize.x * handwritten_page_width)
|
|
$handwritten/page/margins/thetext.add_theme_font_size_override("normal_font_size", int(viewportsize.y * handwritten_text_size))
|
|
$handwritten/page/margins/thetext.add_theme_constant_override("line_separation", int((viewportsize.y * handwritten_text_size) * handwritten_linespacing))
|
|
$handwritten/page/margins.add_theme_constant_override("margin_top", int(viewportsize.y * handwritten_margins))
|
|
$handwritten/page/margins.add_theme_constant_override("margin_left", int(viewportsize.y * handwritten_margins))
|
|
$handwritten/page/margins.add_theme_constant_override("margin_right", int(viewportsize.y * handwritten_margins))
|
|
|
|
$handwritten.visible = true
|
|
else:
|
|
print(style + " is an invalid note style!")
|
|
pass
|
|
|
|
populate_text(style,thetext)
|
|
|
|
func _process(delta: float) -> void:
|
|
if visible and Input.is_action_just_pressed("ui_cancel"):
|
|
visible = false
|
|
get_tree().paused = false
|
|
get_parent().get_node("hud").visible = true
|
|
|
|
func populate_text(style,thetext):
|
|
var thepage : RichTextLabel
|
|
if style == "handwritten":
|
|
thepage = $handwritten/page/margins/thetext
|
|
else:
|
|
print(style + " is an invalid note style!")
|
|
pass
|
|
thepage.clear()
|
|
thepage.append_text(thetext)
|