-rw-r--r--.github/workflows/export.yml13
-rw-r--r--.gitignore3
-rw-r--r--Chat.gd38
-rw-r--r--WS.gd2
-rw-r--r--export_presets.cfg49
-rw-r--r--exports/.gdignore1
-rw-r--r--project.godot8
7 files changed, 92 insertions, 22 deletions
diff --git a/.github/workflows/export.yml b/.github/workflows/export.yml
index 04e2aaf..12626fa 100644
--- a/.github/workflows/export.yml
+++ b/.github/workflows/export.yml
@@ -4,28 +4,23 @@ on:
- main
jobs:
- # job id, can be anything
export_game:
permissions: write-all # can be read-all, write-all, or read-write
# Always use ubuntu-latest for this action
runs-on: ubuntu-latest
- # Job name, can be anything
name: export
steps:
- # Always include the checkout step so that
- # your project is available for Godot to export
- name: checkout
uses: actions/[email protected]
- # Ensure that you get the entire project history
- with:
+ with: # Ensure that you get the entire project history
fetch-depth: 0
+
- name: export game
- # Use latest version (see releases for all versions)
uses: firebelley/[email protected]
with:
# Defining all the required inputs
- godot_executable_download_url: https://downloads.tuxfamily.org/godotengine/3.4.2/Godot_v3.4.2-stable_linux_headless.64.zip
- godot_export_templates_download_url: https://downloads.tuxfamily.org/godotengine/3.4.2/Godot_v3.4.2-stable_export_templates.tpz
+ godot_executable_download_url: https://downloads.tuxfamily.org/godotengine/3.5/beta5/Godot_v3.5-beta5_linux_headless.64.zip
+ godot_export_templates_download_url: https://downloads.tuxfamily.org/godotengine/3.5/beta5/Godot_v3.5-beta5_export_templates.tpz
relative_project_path: ./
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.gitignore b/.gitignore
index d889656..14d8ceb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
.import
-export_presets.cfg
+
+exports/
diff --git a/Chat.gd b/Chat.gd
index 72d97ee..407e045 100644
--- a/Chat.gd
+++ b/Chat.gd
@@ -9,28 +9,48 @@ onready var scrollbar = scroller.get_v_scrollbar()
const server_says = "[b]server[color=#f0e67e]:[/color][/b] "
+var regexes: Array = []
+
func _connected():
add_label(
(
- "%s[b][matrix]welcome to [/matrix][rainbow freq=.3 sat=.7][shake rate=20 level=25]room 2!"
+ "%s[b][matrix]w[/matrix]elcome to [rainbow freq=.3 sat=.7][shake rate=20 level=25]room 2!"
% server_says
),
"server"
)
yield(get_tree().create_timer(.4), "timeout")
add_label(
- (
- "%s[b][tornado freq=5 radius=10] you can use [/tornado][wave amp=20 freq=20][url=https://en.wikipedia.org/wiki/BBCode]bbcode"
- % server_says
- ),
+ "%s[b]you can use a custom flavor of [wave amp=20 freq=20]markdown!" % server_says,
"howto",
Vector2(1000, 80)
)
+func _ready():
+ regexes.append([reg("_([^_]+)_"), "[i]$1[/i]"])
+ regexes.append([reg("\\*\\*([^\\*\\*]+)\\*\\*"), "[b]$1[/b]"])
+ regexes.append([reg("\\*([^\\*]+)\\*"), "[i]$1[/i]"])
+ regexes.append([reg("```([^`]+)```"), "[code]$1[/code]"])
+ regexes.append([reg("`([^`]+)`"), "[code]$1[/code]"])
+ regexes.append([reg("~~([^~]+)~~"), "[s]$1[/s]"])
+ regexes.append([reg("#([^#]+)#"), "[rainbow freq=.3 sat=.7]$1[/rainbow]"])
+ regexes.append([reg("@([^@]+)@"), "[wave amp=20 freq=20]$1[/wave]"])
+ regexes.append([reg("%([^%]+)%"), "[shake rate=20 level=25]$1[/shake]"])
+ regexes.append([reg("\\$([^\\$]+)\\$"), "[matrix]$1[/matrix]"])
+
+
+func reg(src: String) -> RegEx:
+ var regex := RegEx.new()
+ regex.compile(src)
+ return regex
+
+
func _on_Main_recieved(data):
var string = "[b]%s[color=#f0e67e]:[/color][/b] %s" % [data.who, data.text]
+ if !OS.is_window_focused():
+ OS.request_attention()
add_label(string)
@@ -63,11 +83,17 @@ func open_url(meta):
func _on_text_entered(t):
if !t:
return
- t = t.strip_edges()
+ t = translate_md(t.strip_edges())
text.text = ""
get_parent().send_packet({"who": whoami.text, "text": t, "header": "C"})
+func translate_md(input: String) -> String:
+ for replacement in regexes:
+ input = replacement[0].sub(input, replacement[1])
+ return input
+
+
func _on_send_pressed():
_on_text_entered(text.text)
diff --git a/WS.gd b/WS.gd
index 29a8592..2a3fc00 100644
--- a/WS.gd
+++ b/WS.gd
@@ -24,7 +24,7 @@ func _ready():
func connectwebsocket():
- var url = "https://chat-server-gd.herokuapp.com/"
+ var url = "wss://chat-server-gd.herokuapp.com/"
print("Connecting to " + url)
ws.connect_to_url(url)
diff --git a/export_presets.cfg b/export_presets.cfg
index 17457f7..83cf135 100644
--- a/export_presets.cfg
+++ b/export_presets.cfg
@@ -7,7 +7,7 @@ custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
-export_path="exports/Mac.zip"
+export_path="exports/room2.zip"
script_export_mode=1
script_encryption_key=""
@@ -40,7 +40,7 @@ custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
-export_path="exports/Linux.x86_64"
+export_path="exports/room2.x86_64"
script_export_mode=1
script_encryption_key=""
@@ -65,7 +65,7 @@ custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
-export_path="exports/HTML.html"
+export_path="exports/room2.html"
script_export_mode=1
script_encryption_key=""
@@ -81,7 +81,7 @@ html/custom_html_shell=""
html/head_include=""
html/canvas_resize_policy=2
html/focus_canvas_on_start=true
-html/experimental_virtual_keyboard=false
+html/experimental_virtual_keyboard=true
progressive_web_app/enabled=false
progressive_web_app/offline_page=""
progressive_web_app/display=1
@@ -90,3 +90,44 @@ progressive_web_app/icon_144x144=""
progressive_web_app/icon_180x180=""
progressive_web_app/icon_512x512=""
progressive_web_app/background_color=Color( 0, 0, 0, 1 )
+
+[preset.3]
+
+name="Windows"
+platform="Windows Desktop"
+runnable=true
+custom_features=""
+export_filter="all_resources"
+include_filter=""
+exclude_filter=""
+export_path="./room2.exe"
+script_export_mode=1
+script_encryption_key=""
+
+[preset.3.options]
+
+custom_template/debug=""
+custom_template/release=""
+binary_format/64_bits=true
+binary_format/embed_pck=true
+texture_format/bptc=false
+texture_format/s3tc=true
+texture_format/etc=false
+texture_format/etc2=false
+texture_format/no_bptc_fallbacks=true
+codesign/enable=false
+codesign/identity=""
+codesign/password=""
+codesign/timestamp=true
+codesign/timestamp_server_url=""
+codesign/digest_algorithm=1
+codesign/description=""
+codesign/custom_options=PoolStringArray( )
+application/icon=""
+application/file_version=""
+application/product_version=""
+application/company_name=""
+application/product_name=""
+application/file_description=""
+application/copyright=""
+application/trademarks=""
diff --git a/exports/.gdignore b/exports/.gdignore
deleted file mode 100644
index 8d1c8b6..0000000
--- a/exports/.gdignore
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/project.godot b/project.godot
index ed52250..3fe8241 100644
--- a/project.godot
+++ b/project.godot
@@ -27,7 +27,12 @@ _global_script_class_icons={
[application]
config/name="room2"
+config/description="chatroom"
run/main_scene="res://WS.tscn"
+config/use_custom_user_dir=true
+config/custom_user_dir_name="room2"
+boot_splash/image="res://icon.png"
+boot_splash/bg_color=Color( 0.666667, 0.666667, 0.666667, 1 )
config/icon="res://icon.png"
[debug]
@@ -36,10 +41,13 @@ gdscript/warnings/return_value_discarded=false
[display]
+window/dpi/allow_hidpi=true
window/stretch/mode="2d"
window/stretch/aspect="expand"
[rendering]
quality/driver/driver_name="GLES2"
+quality/intended_usage/framebuffer_allocation=1
+quality/intended_usage/framebuffer_allocation.mobile=1
environment/default_environment="res://default_env.tres"