From 05bc20375d6e020711ee102476ce2a42efc46177 Mon Sep 17 00:00:00 2001 From: Luke Hubmayer-Werner Date: Fri, 11 Feb 2022 01:34:18 +1030 Subject: [PATCH] Fix web export --- export_presets.cfg | 34 ++++++++++++++++++++++ project.godot | 3 +- src/Game.gd | 8 +++-- WORDLE => txt/WORDLE | 0 opening_words.txt => txt/opening_words.txt | 0 5 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 export_presets.cfg rename WORDLE => txt/WORDLE (100%) rename opening_words.txt => txt/opening_words.txt (100%) diff --git a/export_presets.cfg b/export_presets.cfg new file mode 100644 index 0000000..b418cb3 --- /dev/null +++ b/export_presets.cfg @@ -0,0 +1,34 @@ +[preset.0] + +name="HTML5" +platform="HTML5" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="txt/*" +exclude_filter="" +export_path="build/web/index.html" +script_export_mode=1 +script_encryption_key="" + +[preset.0.options] + +custom_template/debug="" +custom_template/release="" +variant/export_type=0 +vram_texture_compression/for_desktop=true +vram_texture_compression/for_mobile=false +html/export_icon=true +html/custom_html_shell="" +html/head_include="" +html/canvas_resize_policy=2 +html/focus_canvas_on_start=true +html/experimental_virtual_keyboard=false +progressive_web_app/enabled=false +progressive_web_app/offline_page="" +progressive_web_app/display=1 +progressive_web_app/orientation=0 +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 ) diff --git a/project.godot b/project.godot index ef33c1f..1471816 100644 --- a/project.godot +++ b/project.godot @@ -27,6 +27,8 @@ Game="*res://src/Game.gd" window/size/width=420 window/dpi/allow_hidpi=true window/handheld/orientation="portrait" +window/stretch/mode="2d" +window/stretch/aspect="keep" [physics] @@ -35,4 +37,3 @@ common/enable_pause_aware_picking=true [rendering] quality/driver/driver_name="GLES2" -environment/default_environment="res://default_env.tres" diff --git a/src/Game.gd b/src/Game.gd index 2c692af..ee5733e 100644 --- a/src/Game.gd +++ b/src/Game.gd @@ -91,18 +91,20 @@ func _generate_WordsMaskLookup(): # This seems fine perf-wise func _setup_globals() -> void: print('Loading dictionary') var file = File.new() - match file.open('res://WORDLE', File.READ): + match file.open('res://txt/WORDLE', File.READ): OK: WordStrings = file.get_as_text().split('\n', false) var err: + print('Error loading dictionary: ', err) get_tree().quit(err) print('Loading openers') - match file.open('res://opening_words.txt', File.READ): + match file.open('res://txt/opening_words.txt', File.READ): OK: for line in file.get_as_text().split('\n', false): BotOpeners.push_back(PoolStringArray(line.split(','))) var err: + print('Error loading openers: ', err) get_tree().quit(err) for s in WordStrings: @@ -147,7 +149,7 @@ func _ready() -> void: randomize() print('RNG seeded') - # yield(KeyboardPanel, 'ready') + yield(KeyboardPanel, 'ready') print('Skinning keyboard') update_keyboard() diff --git a/WORDLE b/txt/WORDLE similarity index 100% rename from WORDLE rename to txt/WORDLE diff --git a/opening_words.txt b/txt/opening_words.txt similarity index 100% rename from opening_words.txt rename to txt/opening_words.txt