Reverse most obvious mistakes from Godot 4 automatic changes

This commit is contained in:
Daniel Inkpen 2022-11-09 21:52:54 +00:00
parent cdbf3f2adc
commit 099100d3e0
27 changed files with 122 additions and 122 deletions

View file

@ -25,7 +25,7 @@ func _ready():
# Get colors from TextEdit theme. Created using the default (Adaptive) theme # Get colors from TextEdit theme. Created using the default (Adaptive) theme
# for reference, but will probably cause strange results if using another theme # for reference, but will probably cause strange results if using another theme
# better to use a dedicated terminal theme, rather than relying checked this. # better to use a dedicated terminal theme, rather than relying on this.
_set_terminal_colors( _set_terminal_colors(
{ {
"black": "caret_background_color", "black": "caret_background_color",

View file

@ -23,7 +23,7 @@ enum TerminalPopupMenuOptions {
} }
# Has access to the EditorSettings singleton so it can dynamically generate the # Has access to the EditorSettings singleton so it can dynamically generate the
# terminal color scheme based checked editor theme settings. # terminal color scheme based on editor theme settings.
var editor_plugin: EditorPlugin var editor_plugin: EditorPlugin
var editor_interface: EditorInterface var editor_interface: EditorInterface
@ -108,7 +108,7 @@ func _update_terminal_tabs():
await get_tree().idle_frame await get_tree().idle_frame
if tabs.get_offset_buttons_visible(): if tabs.get_offset_buttons_visible():
# Move add button to fixed position checked the tabbar. # Move add button to fixed position on the tabbar.
if add_button.get_parent() == tabs: if add_button.get_parent() == tabs:
add_button.position = Vector2.ZERO add_button.position = Vector2.ZERO
tabs.remove_child(add_button) tabs.remove_child(add_button)

View file

@ -20,5 +20,5 @@ func _not_implemented() -> int:
if stack.size() >= 2 and "function" in stack[1]: if stack.size() >= 2 and "function" in stack[1]:
method = "%s()" % stack[1].function method = "%s()" % stack[1].function
push_error("Method %s not implemented checked the current platform (%s)." % [method, OS.get_name()]) push_error("Method %s not implemented on the current platform (%s)." % [method, OS.get_name()])
return ERR_METHOD_NOT_FOUND return ERR_METHOD_NOT_FOUND

View file

@ -18,7 +18,7 @@ const DEFAULT_ENV := {TERM = DEFAULT_NAME, COLORTERM = "truecolor"}
const FALLBACK_FILE = "sh" const FALLBACK_FILE = "sh"
## Default messages to indicate PAUSE/RESUME for automatic flow control. ## Default messages to indicate PAUSE/RESUME for automatic flow control.
## To avoid conflicts with rebound XON/XOFF control codes (such as checked-my-zsh), ## To avoid conflicts with rebound XON/XOFF control codes (such as on-my-zsh),
## the sequences can be customized in IPtyForkOptions. ## the sequences can be customized in IPtyForkOptions.
#const FLOW_CONTROL_PAUSE = char(0x13) # defaults to XOFF #const FLOW_CONTROL_PAUSE = char(0x13) # defaults to XOFF
#const FLOW_CONTROL_RESUME = char(0x11) # defaults to XON #const FLOW_CONTROL_RESUME = char(0x11) # defaults to XON
@ -35,7 +35,7 @@ enum Signal {
SIGFPE = 8, # Erroneous arithmetic operation SIGFPE = 8, # Erroneous arithmetic operation
SIGKILL = 9, # Kill (cannot be caught or ignored) SIGKILL = 9, # Kill (cannot be caught or ignored)
SIGSEGV = 11, # Invalid memory reference SIGSEGV = 11, # Invalid memory reference
SIGPIPE = 13, # Write checked a pipe with no one to read it SIGPIPE = 13, # Write on a pipe with no one to read it
SIGALRM = 14, # Alarm clock SIGALRM = 14, # Alarm clock
SIGTERM = 15, # Termination signal SIGTERM = 15, # Termination signal
} }
@ -126,7 +126,7 @@ func fork(
file = FALLBACK_FILE file = FALLBACK_FILE
# Environment variables. # Environment variables.
# If we are using OS env vars, sanitize them to remove_at variables that might confuse our terminal. # If we are using OS env vars, sanitize them to remove variables that might confuse our terminal.
var final_env := _sanitize_env(LibuvUtils.get_os_environ()) if use_os_env else {} var final_env := _sanitize_env(LibuvUtils.get_os_environ()) if use_os_env else {}
for key in env.keys(): for key in env.keys():
final_env[key] = env[key] final_env[key] = env[key]

View file

@ -25,13 +25,13 @@ signal exited(exit_code, signum)
@export var terminal_path: NodePath := NodePath() : @export var terminal_path: NodePath := NodePath() :
get: get:
return terminal_path # TODOConverter40 Non existent get function return terminal_path # TODOConverter40 Non existent get function
set(mod_value): set(mod_value):
mod_value # TODOConverter40 Copy here content of set_terminal_path mod_value # TODOConverter40 Copy here content of set_terminal_path
var _terminal: _Terminal = null : var _terminal: _Terminal = null :
get: get:
return _terminal # TODOConverter40 Non existent get function return _terminal # TODOConverter40 Non existent get function
set(mod_value): set(mod_value):
mod_value # TODOConverter40 Copy here content of _set_terminal mod_value # TODOConverter40 Copy here content of _set_terminal
@ -68,7 +68,7 @@ func _init():
"X11", "Server", "OSX": "X11", "Server", "OSX":
_pty_native = _PTYUnix.new() _pty_native = _PTYUnix.new()
_: _:
push_error("PTY is not support checked current platform (%s)." % os_name) push_error("PTY is not support on current platform (%s)." % os_name)
_pty_native.connect("data_received",Callable(self,"_on_pty_native_data_received")) _pty_native.connect("data_received",Callable(self,"_on_pty_native_data_received"))
_pty_native.connect("exited",Callable(self,"_on_pty_native_exited")) _pty_native.connect("exited",Callable(self,"_on_pty_native_exited"))
@ -154,7 +154,7 @@ func resizev(size: Vector2) -> void:
# Kill the pty. # Kill the pty.
# sigint: The signal to send. By default this is SIGHUP. # sigint: The signal to send. By default this is SIGHUP.
# This is not supported checked Windows. # This is not supported on Windows.
func kill(signum: int = Signal.SIGHUP) -> void: func kill(signum: int = Signal.SIGHUP) -> void:
_pty_native.kill(signum) _pty_native.kill(signum)

View file

@ -62,7 +62,7 @@ func write_string(string: String, color: Color = Color.WHITE) -> void:
terminal.write("\u001b[0m".to_utf8_buffer()) terminal.write("\u001b[0m".to_utf8_buffer())
# tput_* functions based checked the tput command. # tput_* functions based on the tput command.
# See: https://man7.org/linux/man-pages/man1/tput.1.html for more info. # See: https://man7.org/linux/man-pages/man1/tput.1.html for more info.

View file

@ -74,7 +74,7 @@ func _invalidate():
differences = null differences = null
func _init(v1,v2,diff_type = DEEP): func _init(v1, v2 ,diff_type = DEEP):
_value_1 = v1 _value_1 = v1
_value_2 = v2 _value_2 = v2
_diff_type = diff_type _diff_type = diff_type

View file

@ -120,7 +120,7 @@ class ObjectInfo:
var _singleton_instance = null var _singleton_instance = null
var _singleton_name = null var _singleton_name = null
func _init(path,subpath = null): func _init(path, subpath = null):
_path = path _path = path
if subpath != null: if subpath != null:
_subpaths = Array(subpath.split("/")) _subpaths = Array(subpath.split("/"))
@ -723,7 +723,7 @@ func clear_output_directory():
var d = Directory.new() var d = Directory.new()
var result = d.open(_output_dir) var result = d.open(_output_dir)
# BIG GOTCHA HERE. If it cannot open the dir w/ erro 31, then the # BIG GOTCHA HERE. If it cannot open the dir w/ erro 31, then the
# directory becomes res:// and things go checked normally and gut clears out # directory becomes res:// and things go on normally and gut clears out
# out res:// which is SUPER BAD. # out res:// which is SUPER BAD.
if result == OK: if result == OK:
d.list_dir_begin() # TODOGODOT4 fill missing arguments https://github.com/godotengine/godot/pull/40547 d.list_dir_begin() # TODOGODOT4 fill missing arguments https://github.com/godotengine/godot/pull/40547

View file

@ -24,8 +24,8 @@ func _ready():
_gut_config = GutConfig.new() _gut_config = GutConfig.new()
_gut_config.load_options(RUNNER_JSON_PATH) _gut_config.load_options(RUNNER_JSON_PATH)
# The command line will call run_tests checked its own. When used from the panel # The command line will call run_tests on its own. When used from the panel
# we have to kick unchecked the tests ourselves b/c there's no way I know of to # we have to kick off the tests ourselves b/c there's no way I know of to
# interact with the scene that was run via play_custom_scene. # interact with the scene that was run via play_custom_scene.
if !_cmdln_mode: if !_cmdln_mode:
call_deferred("run_tests") call_deferred("run_tests")
@ -58,7 +58,7 @@ func run_tests():
func _write_results(): func _write_results():
# text appears to be empty. I'm not 100% sure why. Until that is # bbcode_text appears to be empty. I'm not 100% sure why. Until that is
# figured out we have to just get the text which stinks. # figured out we have to just get the text which stinks.
var content = _gut.get_gui().get_text_box().text var content = _gut.get_gui().get_text_box().text

View file

@ -183,14 +183,14 @@ const SIGNAL_STOP_YIELD_BEFORE_TEARDOWN = "stop_yield_before_teardown"
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
var _should_print_versions = true # used to cut down checked output in tests. var _should_print_versions = true # used to cut down on output in tests.
func _init(): func _init():
_before_all_test_obj.name = "before_all" _before_all_test_obj.name = "before_all"
_after_all_test_obj.name = "after_all" _after_all_test_obj.name = "after_all"
# When running tests for GUT itself, _utils has been setup to always return # When running tests for GUT itself, _utils has been setup to always return
# a new logger so this does not set the gut instance checked the base logger # a new logger so this does not set the gut instance on the base logger
# when creating test instances of GUT. # when creating test instances of GUT.
_lgr.set_gut(self) _lgr.set_gut(self)
@ -204,7 +204,7 @@ func _init():
_doubler.set_spy(_spy) _doubler.set_spy(_spy)
_doubler.set_gut(self) _doubler.set_gut(self)
# TODO remove_at these, universal logger should fix this. # TODO remove these, universal logger should fix this.
_doubler.set_logger(_lgr) _doubler.set_logger(_lgr)
_spy.set_logger(_lgr) _spy.set_logger(_lgr)
_stubber.set_logger(_lgr) _stubber.set_logger(_lgr)
@ -369,8 +369,8 @@ func _on_log_level_changed(value):
# with set_yield_time() # with set_yield_time()
# #
# signal_watcher._on_watched_signal supports up to 9 additional arguments. # signal_watcher._on_watched_signal supports up to 9 additional arguments.
# This is the most number of parameters GUT supports checked signals. The comment # This is the most number of parameters GUT supports on signals. The comment
# checked _on_watched_signal explains reasoning. # on _on_watched_signal explains reasoning.
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
func _yielding_callback( func _yielding_callback(
from_obj = false, from_obj = false,
@ -640,7 +640,7 @@ func _print_script_heading(script):
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Just gets more logic out of _test_the_scripts. Decides if we should yield after # Just gets more logic out of _test_the_scripts. Decides if we should yield after
# this test based checked flags and counters. # this test based on flags and counters.
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
func _should_yield_now(): func _should_yield_now():
var should = ( var should = (
@ -762,7 +762,7 @@ func _run_parameterized_test(test_script, test_name):
_lgr.warn("Test did not assert") _lgr.warn("Test did not assert")
if _is_function_state(script_result): if _is_function_state(script_result):
# _run_tests does _wait_for_done so just wait checked it to complete # _run_tests does _wait_for_done so just wait on it to complete
await script_result.COMPLETED await script_result.COMPLETED
if _parameter_handler == null: if _parameter_handler == null:
@ -785,7 +785,7 @@ func _run_parameterized_test(test_script, test_name):
var cur_assert_count = _current_test.assert_count var cur_assert_count = _current_test.assert_count
script_result = _run_test(test_script, test_name) script_result = _run_test(test_script, test_name)
if _is_function_state(script_result): if _is_function_state(script_result):
# _run_tests does _wait_for_done so just wait checked it to complete # _run_tests does _wait_for_done so just wait on it to complete
await script_result.COMPLETED await script_result.COMPLETED
if _current_test.assert_count == cur_assert_count and !_current_test.pending: if _current_test.assert_count == cur_assert_count and !_current_test.pending:
@ -850,7 +850,7 @@ func _run_test(script_inst, test_name):
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Calls after_all checked the passed in test script and takes care of settings so all # Calls after_all on the passed in test script and takes care of settings so all
# logger output appears indented and with a proper heading # logger output appears indented and with a proper heading
# #
# Calls both pre-all-tests methods until prerun_setup is removed # Calls both pre-all-tests methods until prerun_setup is removed
@ -874,7 +874,7 @@ func _call_before_all(test_script):
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Calls after_all checked the passed in test script and takes care of settings so all # Calls after_all on the passed in test script and takes care of settings so all
# logger output appears indented and with a proper heading # logger output appears indented and with a proper heading
# #
# Calls both post-all-tests methods until postrun_teardown is removed. # Calls both post-all-tests methods until postrun_teardown is removed.
@ -1146,7 +1146,7 @@ func _get_files(path, prefix, suffix):
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Conditionally prints the text to the console/results variable based checked the # Conditionally prints the text to the console/results variable based on the
# current log level and what level is passed in. Whenever currently in a test, # current log level and what level is passed in. Whenever currently in a test,
# the text will be indented under the test. It can be further indented if # the text will be indented under the test. It can be further indented if
# desired. # desired.
@ -1461,7 +1461,7 @@ func get_yield_between_tests():
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Call _process or _fixed_process, if they exist, checked obj and all it's children # Call _process or _fixed_process, if they exist, on obj and all it's children
# and their children and so and so forth. Delta will be passed through to all # and their children and so and so forth. Delta will be passed through to all
# the _process or _fixed_process methods. # the _process or _fixed_process methods.
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -1479,7 +1479,7 @@ func simulate(obj, times, delta):
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Starts an internal timer with a timeout of the passed in time. A 'timeout' # Starts an internal timer with a timeout of the passed in time. A 'timeout'
# signal will be sent when the timer ends. Returns itself so that it can be # signal will be sent when the timer ends. Returns itself so that it can be
# used in a call to yield...cutting down checked lines of code. # used in a call to yield...cutting down on lines of code.
# #
# Example, yield to the Gut object for 10 seconds: # Example, yield to the Gut object for 10 seconds:
# await gut.set_yield_time(10).timeout # await gut.set_yield_time(10).timeout

View file

@ -122,7 +122,7 @@ class OptionResolver:
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Here starts the actual script that uses the Options class to kick unchecked Gut # Here starts the actual script that uses the Options class to kick off Gut
# and run your tests. # and run your tests.
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
var _utils = load("res://addons/gut/utils.gd").get_instance() var _utils = load("res://addons/gut/utils.gd").get_instance()
@ -293,7 +293,7 @@ option (option priority: command-line, super.gutconfig, default)."""
resolved.erase("show_help") resolved.erase("show_help")
print( print(
"Here's a config with all the properties set based unchecked of your current command and config." "Here's a config with all the properties set based off of your current command and config."
) )
print(JSON.stringify(resolved, " ")) print(JSON.stringify(resolved, " "))
@ -332,7 +332,7 @@ func _run_gut():
( (
"All command line options and where they are specified. " "All command line options and where they are specified. "
+ 'The "final" value shows which value will actually be used ' + 'The "final" value shows which value will actually be used '
+ "based checked order of precedence (default < super.gutconfig < cmd line)." + "based on order of precedence (default < super.gutconfig < cmd line)."
+ "\n" + "\n"
) )
) )

View file

@ -2,7 +2,7 @@ var Gut = load("res://addons/gut/gut.gd")
# Do not want a ref to _utils here due to use by editor plugin. # Do not want a ref to _utils here due to use by editor plugin.
# _utils needs to be split so that constants and what not do not # _utils needs to be split so that constants and what not do not
# have to rely checked the weird singleton thing I made. # have to rely on the weird singleton thing I made.
enum DOUBLE_STRATEGY { FULL, PARTIAL } enum DOUBLE_STRATEGY { FULL, PARTIAL }
var valid_fonts = ["AnonymousPro", "CourierPro", "LobsterTwo", "Default"] var valid_fonts = ["AnonymousPro", "CourierPro", "LobsterTwo", "Default"]

View file

@ -71,7 +71,7 @@ class InputQueueItem:
if _waited_frames >= frame_delay: if _waited_frames >= frame_delay:
emit_signal("event_ready") emit_signal("event_ready")
func _init(t_delay,f_delay): func _init(t_delay, f_delay):
time_delay = t_delay time_delay = t_delay
frame_delay = f_delay frame_delay = f_delay
_is_ready = time_delay == 0 and frame_delay == 0 _is_ready = time_delay == 0 and frame_delay == 0

View file

@ -90,7 +90,7 @@ func _init():
_printers.console = _utils.Printers.ConsolePrinter.new() _printers.console = _utils.Printers.ConsolePrinter.new()
# There were some problems in the timing of disabling this at the right # There were some problems in the timing of disabling this at the right
# time in gut_cmdln so it is disabled by default. This is enabled # time in gut_cmdln so it is disabled by default. This is enabled
# by plugin_control.gd based checked settings. # by plugin_control.gd based on settings.
_printers.console.set_disabled(true) _printers.console.set_disabled(true)

View file

@ -2,13 +2,13 @@ class CallParameters:
var p_name = null var p_name = null
var default = null var default = null
func _init(n,d): func _init(n, d):
p_name = n p_name = n
default = d default = d
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# This class will generate method declaration lines based checked method meta # This class will generate method declaration lines based on method meta
# data. It will create defaults that match the method data. # data. It will create defaults that match the method data.
# #
# -------------------- # --------------------
@ -253,7 +253,7 @@ func _get_spy_call_parameters_text(args):
# ############### # ###############
# Creates a delceration for a function based unchecked of function metadata. All # Creates a delceration for a function based off of function metadata. All
# types whose defaults are supported will have their values. If a datatype # types whose defaults are supported will have their values. If a datatype
# is not supported and the parameter has a default, a warning message will be # is not supported and the parameter has a default, a warning message will be
# printed and the declaration will return null. # printed and the declaration will return null.

View file

@ -40,7 +40,7 @@
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Parses the command line arguments supplied into an array that can then be # Parses the command line arguments supplied into an array that can then be
# examined and parsed based checked how the gut options work. # examined and parsed based on how the gut options work.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
class CmdLineParser: class CmdLineParser:
var _used_options = [] var _used_options = []
@ -149,7 +149,7 @@ class Option:
var default = null var default = null
var description = "" var description = ""
func _init(name,default_value,desc = ""): func _init(name, default_value, desc = ""):
option_name = name option_name = name
default = default_value default = default_value
description = desc description = desc

View file

@ -52,7 +52,7 @@ extends Control
@export var _inner_class_name: String = "" @export var _inner_class_name: String = ""
# Start running tests when the scene finishes loading # Start running tests when the scene finishes loading
@export var _run_on_load = false @export var _run_on_load = false
# Maximize the GUT control checked startup # Maximize the GUT control on startup
@export var _should_maximize = false @export var _should_maximize = false
# Print output to the consol as well # Print output to the consol as well
@export var _should_print_to_console = true @export var _should_print_to_console = true
@ -244,7 +244,7 @@ func _is_ready_to_go(action):
str( str(
"GUT is not ready for ", "GUT is not ready for ",
action, action,
" yet. Perform actions checked GUT in/after the gut_ready signal." " yet. Perform actions on GUT in/after the gut_ready signal."
) )
) )
return _gut != null return _gut != null

View file

@ -25,7 +25,7 @@
# ############################################################################## # ##############################################################################
# Some arbitrary string that should never show up by accident. If it does, then # Some arbitrary string that should never show up by accident. If it does, then
# shame checked you. # shame on you.
const ARG_NOT_SET = "_*_argument_*_is_*_not_set_*_" const ARG_NOT_SET = "_*_argument_*_is_*_not_set_*_"
# This hash holds the objects that are being watched, the signals that are being # This hash holds the objects that are being watched, the signals that are being
@ -46,11 +46,11 @@ const ARG_NOT_SET = "_*_argument_*_is_*_not_set_*_"
# } # }
# #
# In this sample: # In this sample:
# - signal1 checked the ref1 object was emitted 3 times and each time, zero # - signal1 on the ref1 object was emitted 3 times and each time, zero
# parameters were passed. # parameters were passed.
# - signal3 checked ref1 was emitted once and passed a single parameter # - signal3 on ref1 was emitted once and passed a single parameter
# - some_signal checked ref2 was never emitted. # - some_signal on ref2 was never emitted.
# - other_signal checked ref2 was emitted 3 times, each time with 3 parameters. # - other_signal on ref2 was emitted 3 times, each time with 3 parameters.
var _watched_signals = {} var _watched_signals = {}
var _utils = load("res://addons/gut/utils.gd").get_instance() var _utils = load("res://addons/gut/utils.gd").get_instance()
@ -73,7 +73,7 @@ func _add_watched_signal(obj, name):
# parameters when dynamically calling a method via call (per the Godot # parameters when dynamically calling a method via call (per the Godot
# documentation, i.e. some_object.call('some_method', 1, 2, 3...)). # documentation, i.e. some_object.call('some_method', 1, 2, 3...)).
# #
# Based checked the documentation of emit_signal, it appears you can only pass up # Based on the documentation of emit_signal, it appears you can only pass up
# to 4 parameters when firing a signal. I haven't verified this, but this should # to 4 parameters when firing a signal. I haven't verified this, but this should
# future proof this some if the value ever grows. # future proof this some if the value ever grows.
func _on_watched_signal( func _on_watched_signal(
@ -91,7 +91,7 @@ func _on_watched_signal(
): ):
var args = [arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11] var args = [arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11]
# strip unchecked any unused vars. # strip off any unused vars.
var idx = args.size() - 1 var idx = args.size() - 1
while str(args[idx]) == ARG_NOT_SET: while str(args[idx]) == ARG_NOT_SET:
args.remove_at(idx) args.remove_at(idx)

View file

@ -82,7 +82,7 @@ func _get_obj_filename(thing):
pass pass
elif NativeScriptClass != null and thing.get_script() is NativeScriptClass: elif NativeScriptClass != null and thing.get_script() is NativeScriptClass:
# Work with GDNative scripts: # Work with GDNative scripts:
# inst_to_dict fails with "Not a script with an instance" checked GDNative script instances # inst_to_dict fails with "Not a script with an instance" on GDNative script instances
filename = _get_filename(thing.get_script().resource_path) filename = _get_filename(thing.get_script().resource_path)
elif !_utils.is_native_class(thing): elif !_utils.is_native_class(thing):
var dict = inst_to_dict(thing) var dict = inst_to_dict(thing)

View file

@ -1,7 +1,7 @@
var return_val = null var return_val = null
var stub_target = null var stub_target = null
var target_subpath = null var target_subpath = null
# the parameter values to match method call checked. # the parameter values to match method call on.
var parameters = null var parameters = null
var stub_method = null var stub_method = null
var call_super = false var call_super = false

View file

@ -28,7 +28,7 @@ func _make_key_from_metadata(doubled):
return to_return return to_return
# Creates they key for the returns hash based checked the type of object passed in # Creates they key for the returns hash based on the type of object passed in
# obj could be a string of a path to a script with an optional subpath or # obj could be a string of a path to a script with an optional subpath or
# it could be an instance of a doubled object. # it could be an instance of a doubled object.
func _make_key_from_variant(obj, subpath = null): func _make_key_from_variant(obj, subpath = null):

View file

@ -62,7 +62,7 @@ class DoubleInfo:
# (object_to_double, subpath) # (object_to_double, subpath)
# (object_to_double, strategy) # (object_to_double, strategy)
# (object_to_double, subpath, strategy) # (object_to_double, subpath, strategy)
func _init(thing,p2 = null,p3 = null): func _init(thing, p2 = null, p3 = null):
strategy = p2 strategy = p2
# short-circuit and ensure that is_valid # short-circuit and ensure that is_valid
@ -218,7 +218,7 @@ func _do_datatypes_match__fail_if_not(got, expected, text):
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Create a string that lists all the methods that were called checked an spied # Create a string that lists all the methods that were called on an spied
# instance. # instance.
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
func _get_desc_of_calls_to_instance(inst): func _get_desc_of_calls_to_instance(inst):
@ -228,7 +228,7 @@ func _get_desc_of_calls_to_instance(inst):
calls = BULLET + calls.replace("\n", "\n" + BULLET) calls = BULLET + calls.replace("\n", "\n" + BULLET)
# remove_at trailing newline and bullet # remove_at trailing newline and bullet
calls = calls.substr(0, calls.length() - BULLET.length() - 1) calls = calls.substr(0, calls.length() - BULLET.length() - 1)
return "Calls made checked " + str(inst) + "\n" + calls return "Calls made on " + str(inst) + "\n" + calls
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -747,7 +747,7 @@ func _can_make_signal_assertions(object, signal_name):
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Check if an object is connected to a signal checked another object. Returns True # Check if an object is connected to a signal on another object. Returns True
# if it is and false otherwise # if it is and false otherwise
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
func _is_connected(signaler_obj, connect_to_obj, signal_name, method_name = ""): func _is_connected(signaler_obj, connect_to_obj, signal_name, method_name = ""):
@ -770,10 +770,10 @@ func watch_signals(object):
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Asserts that an object is connected to a signal checked another object # Asserts that an object is connected to a signal on another object
# #
# This will fail with specific messages if the target object is not connected # This will fail with specific messages if the target object is not connected
# to the specified signal checked the source object. # to the specified signal on the source object.
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
func assert_connected(signaler_obj, connect_to_obj, signal_name, method_name = ""): func assert_connected(signaler_obj, connect_to_obj, signal_name, method_name = ""):
pass pass
@ -785,7 +785,7 @@ func assert_connected(signaler_obj, connect_to_obj, signal_name, method_name = "
_str(signaler_obj), _str(signaler_obj),
" to be connected to signal: [", " to be connected to signal: [",
signal_name, signal_name,
"] checked ", "] on ",
_str(connect_to_obj), _str(connect_to_obj),
method_disp method_disp
) )
@ -796,10 +796,10 @@ func assert_connected(signaler_obj, connect_to_obj, signal_name, method_name = "
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Asserts that an object is not connected to a signal checked another object # Asserts that an object is not connected to a signal on another object
# #
# This will fail with specific messages if the target object is connected # This will fail with specific messages if the target object is connected
# to the specified signal checked the source object. # to the specified signal on the source object.
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
func assert_not_connected(signaler_obj, connect_to_obj, signal_name, method_name = ""): func assert_not_connected(signaler_obj, connect_to_obj, signal_name, method_name = ""):
var method_disp = "" var method_disp = ""
@ -810,7 +810,7 @@ func assert_not_connected(signaler_obj, connect_to_obj, signal_name, method_name
_str(signaler_obj), _str(signaler_obj),
" to not be connected to signal: [", " to not be connected to signal: [",
signal_name, signal_name,
"] checked ", "] on ",
_str(connect_to_obj), _str(connect_to_obj),
method_disp method_disp
) )
@ -1116,21 +1116,21 @@ func assert_string_ends_with(text, search, match_case = true):
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Assert that a method was called checked an instance of a doubled class. If # Assert that a method was called on an instance of a doubled class. If
# parameters are supplied then the params passed in when called must match. # parameters are supplied then the params passed in when called must match.
# TODO make 3rd parameter "param_or_text" and add fourth parameter of "text" and # TODO make 3rd parameter "param_or_text" and add fourth parameter of "text" and
# then work some magic so this can have a "text" parameter without being # then work some magic so this can have a "text" parameter without being
# annoying. # annoying.
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
func assert_called(inst, method_name, parameters = null): func assert_called(inst, method_name, parameters = null):
var disp = str("Expected [", method_name, "] to have been called checked ", _str(inst)) var disp = str("Expected [", method_name, "] to have been called on ", _str(inst))
if _fail_if_parameters_not_array(parameters): if _fail_if_parameters_not_array(parameters):
return return
if !_utils.is_double(inst): if !_utils.is_double(inst):
_fail( _fail(
"You must pass a doubled instance to assert_called. Check the wiki for info checked using double." "You must pass a doubled instance to assert_called. Check the wiki for info on using double."
) )
else: else:
if gut.get_spy().was_called(inst, method_name, parameters): if gut.get_spy().was_called(inst, method_name, parameters):
@ -1142,19 +1142,19 @@ func assert_called(inst, method_name, parameters = null):
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Assert that a method was not called checked an instance of a doubled class. If # Assert that a method was not called on an instance of a doubled class. If
# parameters are specified then this will only fail if it finds a call that was # parameters are specified then this will only fail if it finds a call that was
# sent matching parameters. # sent matching parameters.
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
func assert_not_called(inst, method_name, parameters = null): func assert_not_called(inst, method_name, parameters = null):
var disp = str("Expected [", method_name, "] to NOT have been called checked ", _str(inst)) var disp = str("Expected [", method_name, "] to NOT have been called on ", _str(inst))
if _fail_if_parameters_not_array(parameters): if _fail_if_parameters_not_array(parameters):
return return
if !_utils.is_double(inst): if !_utils.is_double(inst):
_fail( _fail(
"You must pass a doubled instance to assert_not_called. Check the wiki for info checked using double." "You must pass a doubled instance to assert_not_called. Check the wiki for info on using double."
) )
else: else:
if gut.get_spy().was_called(inst, method_name, parameters): if gut.get_spy().was_called(inst, method_name, parameters):
@ -1166,7 +1166,7 @@ func assert_not_called(inst, method_name, parameters = null):
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Assert that a method checked an instance of a doubled class was called a number # Assert that a method on an instance of a doubled class was called a number
# of times. If parameters are specified then only calls with matching # of times. If parameters are specified then only calls with matching
# parameter values will be counted. # parameter values will be counted.
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -1179,12 +1179,12 @@ func assert_call_count(inst, method_name, expected_count, parameters = null):
var param_text = "" var param_text = ""
if parameters: if parameters:
param_text = " with parameters " + str(parameters) param_text = " with parameters " + str(parameters)
var disp = "Expected [%s] checked %s to be called [%s] times%s. It was called [%s] times." var disp = "Expected [%s] on %s to be called [%s] times%s. It was called [%s] times."
disp = disp % [method_name, _str(inst), expected_count, param_text, count] disp = disp % [method_name, _str(inst), expected_count, param_text, count]
if !_utils.is_double(inst): if !_utils.is_double(inst):
_fail( _fail(
"You must pass a doubled instance to assert_call_count. Check the wiki for info checked using double." "You must pass a doubled instance to assert_call_count. Check the wiki for info on using double."
) )
else: else:
if count == expected_count: if count == expected_count:
@ -1698,7 +1698,7 @@ func ignore_method_when_doubling(thing, method_name):
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
func stub(thing, p2, p3 = null): func stub(thing, p2, p3 = null):
if _utils.is_instance(thing) and !_utils.is_double(thing): if _utils.is_instance(thing) and !_utils.is_double(thing):
_lgr.error(str("You cannot use stub checked ", _str(thing), " because it is not a double.")) _lgr.error(str("You cannot use stub on ", _str(thing), " because it is not a double."))
return _utils.StubParams.new() return _utils.StubParams.new()
var method_name = p2 var method_name = p2
@ -1791,7 +1791,7 @@ func autofree(thing):
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Works the same as autofree except queue_free will be called checked the object # Works the same as autofree except queue_free will be called on the object
# instead. This also imparts a brief pause after the test finishes so that # instead. This also imparts a brief pause after the test finishes so that
# the queued object has time to free. # the queued object has time to free.
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -1869,7 +1869,7 @@ func fail_test(text):
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Peforms a deep compare checked both values, a CompareResult instnace is returned. # Peforms a deep compare on both values, a CompareResult instnace is returned.
# The optional max_differences paramter sets the max_differences to be displayed. # The optional max_differences paramter sets the max_differences to be displayed.
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
func compare_deep(v1, v2, max_differences = null): func compare_deep(v1, v2, max_differences = null):
@ -1880,7 +1880,7 @@ func compare_deep(v1, v2, max_differences = null):
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Peforms a shallow compare checked both values, a CompareResult instnace is returned. # Peforms a shallow compare on both values, a CompareResult instnace is returned.
# The optional max_differences paramter sets the max_differences to be displayed. # The optional max_differences paramter sets the max_differences to be displayed.
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
func compare_shallow(v1, v2, max_differences = null): func compare_shallow(v1, v2, max_differences = null):

View file

@ -31,7 +31,7 @@ class TestScript:
var _utils = null var _utils = null
var _lgr = null var _lgr = null
func _init(utils = null,logger = null): func _init(utils = null, logger = null):
_utils = utils _utils = utils
_lgr = logger _lgr = logger

View file

@ -108,7 +108,7 @@ var req_godot = [3, 2, 0]
# Used for doing file manipulation stuff so as to not keep making File instances. # Used for doing file manipulation stuff so as to not keep making File instances.
# could be a bit of overkill but who cares. # could be a bit of overkill but who cares.
var _file_checker = File.new() var _file_checker = File.new()
# Online fetch of the latest version available checked github # Online fetch of the latest version available on github
var latest_version = null var latest_version = null
var should_display_latest_version = false var should_display_latest_version = false
@ -280,7 +280,7 @@ func is_gdscript(obj):
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Returns an array of values by calling get(property) checked each element in source # Returns an array of values by calling get(property) on each element in source
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
func extract_property_from_array(source, property): func extract_property_from_array(source, property):
var to_return = [] var to_return = []
@ -354,7 +354,7 @@ func get_file_as_text(path):
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Loops through an array of things and calls a method or checks a property checked # Loops through an array of things and calls a method or checks a property on
# each element until it finds the returned value. The item in the array is # each element until it finds the returned value. The item in the array is
# returned or null if it is not found. # returned or null if it is not found.
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------

View file

@ -148,9 +148,9 @@ func _on_Terminal_key_pressed(data: String, event: InputEventKey) -> void:
( (
"Psuedoterminal node currently" "Psuedoterminal node currently"
+ " uses pty.h but needs to use either winpty or conpty" + " uses pty.h but needs to use either winpty or conpty"
+ " to work checked Windows." + " to work on Windows."
), ),
"Terminal not Supported checked Windows" "Terminal not Supported on Windows"
) )
var scene = item.scene.instantiate() var scene = item.scene.instantiate()
var pty = scene if OS.has_feature("JavaScript") else scene.get_node("PTY") var pty = scene if OS.has_feature("JavaScript") else scene.get_node("PTY")

View file

@ -8,26 +8,26 @@ code = "/*
Shader from Godot Shaders - the free shader library. Shader from Godot Shaders - the free shader library.
godotshaders.com/shader/VHS-and-CRT-monitor-effect godotshaders.com/shader/VHS-and-CRT-monitor-effect
This shader is under CC0 license. Feel free to use, improve and This shader is under CC0 license. Feel free to use, improve and
change this shader according to your needs and consider sharing change this shader according to your needs and consider sharing
the modified result to godotshaders.com. the modified result to godotshaders.com.
*/ */
shader_type canvas_item; shader_type canvas_item;
//*** IMPORTANT! ***/ //*** IMPORTANT! ***/
// - If you are using this shader to affect the node it is applied to set 'overlay' to false (unchecked in the instepctor). // - If you are using this shader to affect the node it is applied to set 'overlay' to false (unchecked in the instepctor).
// - If you are using this shader as an overlay, and want the shader to affect the nodes below in the Scene hierarchy, // - If you are using this shader as an overlay, and want the shader to affect the nodes below in the Scene hierarchy,
// set 'overlay' to true (checked in the inspector). // set 'overlay' to true (checked in the inspector).
// On Mac there is potentially a bug causing this to not work properly. If that is the case and you want to use the shader as an overlay // On Mac there is potentially a bug causing this to not work properly. If that is the case and you want to use the shader as an overlay
// change all \"overlay ? SCREEN_TEXTURE : TEXTURE\" to only \"SCREEN_TEXTURE\" checked lines 129-140, and \"vec2 uv = overlay ? warp(SCREEN_UV) : warp(UV);\" // change all \"overlay ? SCREEN_TEXTURE : TEXTURE\" to only \"SCREEN_TEXTURE\" on lines 129-140, and \"vec2 uv = overlay ? warp(SCREEN_UV) : warp(UV);\"
// to \"vec2 uv = warp(SCREEN_UV);\" checked line 98. // to \"vec2 uv = warp(SCREEN_UV);\" on line 98.
uniform bool overlay = false; uniform bool overlay = false;
uniform float scanlines_opacity : hint_range(0.0, 1.0) = 0.4; uniform float scanlines_opacity : hint_range(0.0, 1.0) = 0.4;
uniform float scanlines_width : hint_range(0.0, 0.5) = 0.25; uniform float scanlines_width : hint_range(0.0, 0.5) = 0.25;
uniform float grille_opacity : hint_range(0.0, 1.0) = 0.3; uniform float grille_opacity : hint_range(0.0, 1.0) = 0.3;
uniform vec2 resolution = vec2(640.0, 480.0); // Set the number of rows and columns the texture will be divided in. Scanlines and grille will make a square based checked these values uniform vec2 resolution = vec2(640.0, 480.0); // Set the number of rows and columns the texture will be divided in. Scanlines and grille will make a square based on these values
uniform bool pixelate = true; // Fill each square (\"pixel\") with a sampled color, creating a pixel look and a more accurate representation of how a CRT monitor would work. uniform bool pixelate = true; // Fill each square (\"pixel\") with a sampled color, creating a pixel look and a more accurate representation of how a CRT monitor would work.
@ -42,7 +42,7 @@ uniform float noise_speed = 5.0; // There is a movement in the noise pattern tha
uniform float static_noise_intensity : hint_range(0.0, 1.0) = 0.06; uniform float static_noise_intensity : hint_range(0.0, 1.0) = 0.06;
uniform float aberration : hint_range(-1.0, 1.0) = 0.03; // Chromatic aberration, a distortion checked each color channel. uniform float aberration : hint_range(-1.0, 1.0) = 0.03; // Chromatic aberration, a distortion on each color channel.
uniform float brightness = 1.4; // When adding scanline gaps and grille the image can get very dark. Brightness tries to compensate for that. uniform float brightness = 1.4; // When adding scanline gaps and grille the image can get very dark. Brightness tries to compensate for that.
uniform bool discolor = true; // Add a discolor effect simulating a VHS uniform bool discolor = true; // Add a discolor effect simulating a VHS
@ -78,7 +78,7 @@ vec2 warp(vec2 uv){
float delta2 = dot(delta.xy, delta.xy); float delta2 = dot(delta.xy, delta.xy);
float delta4 = delta2 * delta2; float delta4 = delta2 * delta2;
float delta_offset = delta4 * warp_amount; float delta_offset = delta4 * warp_amount;
return uv + delta * delta_offset; return uv + delta * delta_offset;
} }
@ -105,14 +105,14 @@ void fragment()
vec2 text_uv = uv; vec2 text_uv = uv;
vec2 roll_uv = vec2(0.0); vec2 roll_uv = vec2(0.0);
float time = roll ? TIME : 0.0; float time = roll ? TIME : 0.0;
// Pixelate the texture based checked the given resolution.
// Pixelate the texture based on the given resolution.
if (pixelate) if (pixelate)
{ {
text_uv = ceil(uv * resolution) / resolution; text_uv = ceil(uv * resolution) / resolution;
} }
// Create the rolling effect. We need roll_line a bit later to make the noise effect. // Create the rolling effect. We need roll_line a bit later to make the noise effect.
// That is why this runs if roll is true OR noise_opacity is over 0. // That is why this runs if roll is true OR noise_opacity is over 0.
float roll_line = 0.0; float roll_line = 0.0;
@ -125,11 +125,11 @@ void fragment()
// Distort the UV where where the lines are // Distort the UV where where the lines are
roll_uv = vec2(( roll_line * distort_intensity * (1.-UV.x)), 0.0); roll_uv = vec2(( roll_line * distort_intensity * (1.-UV.x)), 0.0);
} }
vec4 text; vec4 text;
if (roll) if (roll)
{ {
// If roll is true distort the texture with roll_uv. The texture is split up into RGB to // If roll is true distort the texture with roll_uv. The texture is split up into RGB to
// make some chromatic aberration. We apply the aberration to the red and green channels accorging to the aberration parameter // make some chromatic aberration. We apply the aberration to the red and green channels accorging to the aberration parameter
// and intensify it a bit in the roll distortion. // and intensify it a bit in the roll distortion.
text.r = texture(SCREEN_TEXTURE, text_uv + roll_uv * 0.8 + vec2(aberration, 0.0) * .1).r; text.r = texture(SCREEN_TEXTURE, text_uv + roll_uv * 0.8 + vec2(aberration, 0.0) * .1).r;
@ -139,43 +139,43 @@ void fragment()
} }
else else
{ {
// If roll is false only apply the aberration without any distorion. The aberration values are very small so the .1 is only // If roll is false only apply the aberration without any distorion. The aberration values are very small so the .1 is only
// to make the slider in the Inspector less sensitive. // to make the slider in the Inspector less sensitive.
text.r = texture(SCREEN_TEXTURE, text_uv + vec2(aberration, 0.0) * .1).r; text.r = texture(SCREEN_TEXTURE, text_uv + vec2(aberration, 0.0) * .1).r;
text.g = texture(SCREEN_TEXTURE, text_uv - vec2(aberration, 0.0) * .1).g; text.g = texture(SCREEN_TEXTURE, text_uv - vec2(aberration, 0.0) * .1).g;
text.b = texture(SCREEN_TEXTURE, text_uv).b; text.b = texture(SCREEN_TEXTURE, text_uv).b;
text.a = 1.0; text.a = 1.0;
} }
float r = text.r; float r = text.r;
float g = text.g; float g = text.g;
float b = text.b; float b = text.b;
uv = warp(UV); uv = warp(UV);
// CRT monitors don't have pixels but groups of red, green and blue dots or lines, called grille. We isolate the texture's color channels // CRT monitors don't have pixels but groups of red, green and blue dots or lines, called grille. We isolate the texture's color channels
// and divide it up in 3 offsetted lines to show the red, green and blue colors next to each other, with a small black gap between. // and divide it up in 3 offsetted lines to show the red, green and blue colors next to each other, with a small black gap between.
if (grille_opacity > 0.0){ if (grille_opacity > 0.0){
float g_r = smoothstep(0.85, 0.95, abs(sin(uv.x * (resolution.x * 3.14159265)))); float g_r = smoothstep(0.85, 0.95, abs(sin(uv.x * (resolution.x * 3.14159265))));
r = mix(r, r * g_r, grille_opacity); r = mix(r, r * g_r, grille_opacity);
float g_g = smoothstep(0.85, 0.95, abs(sin(1.05 + uv.x * (resolution.x * 3.14159265)))); float g_g = smoothstep(0.85, 0.95, abs(sin(1.05 + uv.x * (resolution.x * 3.14159265))));
g = mix(g, g * g_g, grille_opacity); g = mix(g, g * g_g, grille_opacity);
float b_b = smoothstep(0.85, 0.95, abs(sin(2.1 + uv.x * (resolution.x * 3.14159265)))); float b_b = smoothstep(0.85, 0.95, abs(sin(2.1 + uv.x * (resolution.x * 3.14159265))));
b = mix(b, b * b_b, grille_opacity); b = mix(b, b * b_b, grille_opacity);
} }
// Apply the grille to the texture's color channels and apply Brightness. Since the grille and the scanlines (below) make the image very dark you // Apply the grille to the texture's color channels and apply Brightness. Since the grille and the scanlines (below) make the image very dark you
// can compensate by increasing the brightness. // can compensate by increasing the brightness.
text.r = clamp(r * brightness, 0.0, 1.0); text.r = clamp(r * brightness, 0.0, 1.0);
text.g = clamp(g * brightness, 0.0, 1.0); text.g = clamp(g * brightness, 0.0, 1.0);
text.b = clamp(b * brightness, 0.0, 1.0); text.b = clamp(b * brightness, 0.0, 1.0);
// Scanlines are the horizontal lines that make up the image checked a CRT monitor. // Scanlines are the horizontal lines that make up the image on a CRT monitor.
// Here we are actual setting the black gap between each line, which I guess is not the right definition of the word, but you get the idea // Here we are actual setting the black gap between each line, which I guess is not the right definition of the word, but you get the idea
float scanlines = 0.5; float scanlines = 0.5;
if (scanlines_opacity > 0.0) if (scanlines_opacity > 0.0)
{ {
@ -183,39 +183,39 @@ void fragment()
scanlines = smoothstep(scanlines_width, scanlines_width + 0.5, abs(sin(uv.y * (resolution.y * 3.14159265)))); scanlines = smoothstep(scanlines_width, scanlines_width + 0.5, abs(sin(uv.y * (resolution.y * 3.14159265))));
text.rgb = mix(text.rgb, text.rgb * vec3(scanlines), scanlines_opacity); text.rgb = mix(text.rgb, text.rgb * vec3(scanlines), scanlines_opacity);
} }
// Apply the banded noise. // Apply the banded noise.
if (noise_opacity > 0.0) if (noise_opacity > 0.0)
{ {
// Generate a noise pattern that is very stretched horizontally, and animate it with noise_speed // Generate a noise pattern that is very stretched horizontally, and animate it with noise_speed
float noise = smoothstep(0.4, 0.5, noise(uv * vec2(2.0, 200.0) + vec2(10.0, (TIME * (noise_speed))) ) ); float noise = smoothstep(0.4, 0.5, noise(uv * vec2(2.0, 200.0) + vec2(10.0, (TIME * (noise_speed))) ) );
// We use roll_line (set above) to define how big the noise should be vertically (multiplying cuts unchecked all black parts). // We use roll_line (set above) to define how big the noise should be vertically (multiplying cuts off all black parts).
// We also add in some basic noise with random() to break up the noise pattern above. The noise is sized according to // We also add in some basic noise with random() to break up the noise pattern above. The noise is sized according to
// the resolution value set in the inspector. If you don't like this look you can // the resolution value set in the inspector. If you don't like this look you can
// change \"ceil(uv * resolution) / resolution\" to only \"uv\" to make it less pixelated. Or multiply resolution with som value // change \"ceil(uv * resolution) / resolution\" to only \"uv\" to make it less pixelated. Or multiply resolution with som value
// greater than 1.0 to make them smaller. // greater than 1.0 to make them smaller.
roll_line *= noise * scanlines * clamp(random((ceil(uv * resolution) / resolution) + vec2(TIME * 0.8, 0.0)).x + 0.8, 0.0, 1.0); roll_line *= noise * scanlines * clamp(random((ceil(uv * resolution) / resolution) + vec2(TIME * 0.8, 0.0)).x + 0.8, 0.0, 1.0);
// Add it to the texture based checked noise_opacity // Add it to the texture based on noise_opacity
text.rgb = clamp(mix(text.rgb, text.rgb + roll_line, noise_opacity), vec3(0.0), vec3(1.0)); text.rgb = clamp(mix(text.rgb, text.rgb + roll_line, noise_opacity), vec3(0.0), vec3(1.0));
} }
// Apply static noise by generating it over the whole screen in the same way as above // Apply static noise by generating it over the whole screen in the same way as above
if (static_noise_intensity > 0.0) if (static_noise_intensity > 0.0)
{ {
text.rgb += clamp(random((ceil(uv * resolution) / resolution) + fract(TIME)).x, 0.0, 1.0) * static_noise_intensity; text.rgb += clamp(random((ceil(uv * resolution) / resolution) + fract(TIME)).x, 0.0, 1.0) * static_noise_intensity;
} }
// Apply a black border to hide imperfections caused by the warping. // Apply a black border to hide imperfections caused by the warping.
// Also apply the vignette // Also apply the vignette
text.rgb *= border(uv); text.rgb *= border(uv);
text.rgb *= vignette(uv); text.rgb *= vignette(uv);
// Hides the black border and make that area transparent. Good if you want to add the the texture checked top an image of a TV or monitor. // Hides the black border and make that area transparent. Good if you want to add the the texture on top an image of a TV or monitor.
if (clip_warp) if (clip_warp)
{ {
text.a = border(uv); text.a = border(uv);
} }
// Apply discoloration to get a VHS look (lower saturation and higher contrast) // Apply discoloration to get a VHS look (lower saturation and higher contrast)
// You can play with the values below or expose them in the Inspector. // You can play with the values below or expose them in the Inspector.
float saturation = 0.5; float saturation = 0.5;
@ -225,12 +225,12 @@ void fragment()
// Saturation // Saturation
vec3 greyscale = vec3(text.r + text.g + text.b) / 3.; vec3 greyscale = vec3(text.r + text.g + text.b) / 3.;
text.rgb = mix(text.rgb, greyscale, saturation); text.rgb = mix(text.rgb, greyscale, saturation);
// Contrast // Contrast
float midpoint = pow(0.5, 2.2); float midpoint = pow(0.5, 2.2);
text.rgb = (text.rgb - vec3(midpoint)) * contrast + midpoint; text.rgb = (text.rgb - vec3(midpoint)) * contrast + midpoint;
} }
COLOR = text; COLOR = text;
}" }"

View file

@ -42,7 +42,7 @@ func _on_Terminal_key_pressed(_data, event: InputEventKey):
if not event: if not event:
return return
# For some reason, data String is malformed checked HTML5, so only use event.unicode. # For some reason, data String is malformed on HTML5, so only use event.unicode.
var data = char(event.unicode) var data = char(event.unicode)
match event.scancode: match event.scancode: