added scrolling but scrolls infinitely
This commit is contained in:
@@ -27,6 +27,12 @@ func Get_Camera_Collision():
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event is InputEventKey and event.pressed and crosshair.is_highlighted:
|
||||
|
||||
if event.keycode == KEY_PAGEUP:
|
||||
terminal.ScrollUp()
|
||||
|
||||
if event.keycode == KEY_PAGEDOWN:
|
||||
terminal.ScrollDown()
|
||||
|
||||
if event.keycode == KEY_BACKSPACE:
|
||||
|
||||
terminal.InputDelChar()
|
||||
|
||||
@@ -193,15 +193,31 @@ cat (or view) [file] : Read the contents of a file
|
||||
clear (or cls) : Clear the terminal screen
|
||||
help : Show this menu
|
||||
-------------------------")
|
||||
|
||||
|
||||
func ScrollUp():
|
||||
var scroll: ScrollContainer = $MarginContainer/ScrollContainer
|
||||
|
||||
await get_tree().create_timer(.0001).timeout
|
||||
scroll.set_deferred("scroll_vertical", scroll.get_v_scroll_bar().value - 10 )
|
||||
call("ScrollUp")
|
||||
|
||||
|
||||
func ScrollDown():
|
||||
var scroll: ScrollContainer = $MarginContainer/ScrollContainer
|
||||
|
||||
await get_tree().create_timer(.0001).timeout
|
||||
scroll.set_deferred("scroll_vertical", scroll.get_v_scroll_bar().value + 10 )
|
||||
call("ScrollDown")
|
||||
|
||||
|
||||
|
||||
func GetBottomScroll():
|
||||
var scroll: ScrollContainer = $MarginContainer/ScrollContainer
|
||||
var scrollMax: float = scroll.get_v_scroll_bar().max_value
|
||||
|
||||
await get_tree().create_timer(.01).timeout
|
||||
scroll.set_deferred("scroll_vertical", scrollMax)
|
||||
#scroll.vertical_scroll_mode = ScrollContainer.SCROLL_MODE_SHOW_NEVER
|
||||
call_deferred("GetBottomScroll")
|
||||
|
||||
func UpdateCaretPos():
|
||||
@@ -209,4 +225,3 @@ func UpdateCaretPos():
|
||||
var char_rect = terminalLine.get_character_bounds(max(0, last_char_index))
|
||||
caret.position.x = char_rect.end.x + 1
|
||||
caret.position.y = char_rect.position.y
|
||||
print(char_rect.end.x)
|
||||
|
||||
Reference in New Issue
Block a user