-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor using better Godot and JavaScript API and add an example
- Loading branch information
Showing
8 changed files
with
166 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
# HTML5 File Exchange for Godot 3.2 | ||
|
||
## Usage | ||
|
||
* Copy addons to your project. | ||
* Enable the plugin. (A `HTML5File` singleton should be added into autoload list). | ||
* Add a HTML5 export item to enable HTML5 debugging option. | ||
* Check sample.tscn for usage. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
extends TextureRect | ||
|
||
# Called when the node enters the scene tree for the first time. | ||
func _ready(): | ||
pass # Replace with function body. | ||
|
||
func _on_UploadButton_pressed(): | ||
HTML5File.load_image() | ||
|
||
var image = yield(HTML5File, "load_completed") | ||
|
||
var tex = ImageTexture.new() | ||
tex.create_from_image(image, 0) | ||
|
||
texture = tex; | ||
|
||
func _on_DownloadButton_pressed(): | ||
var image = texture.get_data() | ||
HTML5File.save_image(image, "image.png") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
[gd_scene load_steps=2 format=2] | ||
|
||
[ext_resource path="res://addons/HTML5FileExchange/Sample.gd" type="Script" id=1] | ||
|
||
[node name="Control" type="Control"] | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
|
||
[node name="VBoxContainer" type="VBoxContainer" parent="."] | ||
margin_right = 40.0 | ||
margin_bottom = 40.0 | ||
|
||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"] | ||
margin_right = 136.0 | ||
margin_bottom = 20.0 | ||
|
||
[node name="UploadButton" type="Button" parent="VBoxContainer/HBoxContainer"] | ||
margin_right = 57.0 | ||
margin_bottom = 20.0 | ||
text = "Upload" | ||
|
||
[node name="DownloadButton" type="Button" parent="VBoxContainer/HBoxContainer"] | ||
margin_left = 61.0 | ||
margin_right = 136.0 | ||
margin_bottom = 20.0 | ||
text = "Download" | ||
|
||
[node name="TextureRect" type="TextureRect" parent="VBoxContainer"] | ||
margin_top = 24.0 | ||
margin_right = 136.0 | ||
margin_bottom = 24.0 | ||
script = ExtResource( 1 ) | ||
|
||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/UploadButton" to="VBoxContainer/TextureRect" method="_on_UploadButton_pressed"] | ||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/DownloadButton" to="VBoxContainer/TextureRect" method="_on_DownloadButton_pressed"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[gd_resource type="Environment" load_steps=2 format=2] | ||
|
||
[sub_resource type="ProceduralSky" id=1] | ||
|
||
[resource] | ||
background_mode = 2 | ||
background_sky = SubResource( 1 ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="StreamTexture" | ||
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" | ||
metadata={ | ||
"vram_texture": false | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://icon.png" | ||
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/lossy_quality=0.7 | ||
compress/hdr_mode=0 | ||
compress/bptc_ldr=0 | ||
compress/normal_map=0 | ||
flags/repeat=0 | ||
flags/filter=true | ||
flags/mipmaps=false | ||
flags/anisotropic=false | ||
flags/srgb=2 | ||
process/fix_alpha_border=true | ||
process/premult_alpha=false | ||
process/HDR_as_SRGB=false | ||
process/invert_color=false | ||
process/normal_map_invert_y=false | ||
stream=false | ||
size_limit=0 | ||
detect_3d=true | ||
svg/scale=1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
; Engine configuration file. | ||
; It's best edited using the editor UI and not directly, | ||
; since the parameters that go here are not all obvious. | ||
; | ||
; Format: | ||
; [section] ; section goes between [] | ||
; param=value ; assign values to parameters | ||
|
||
config_version=4 | ||
|
||
[application] | ||
|
||
config/name="HTML5-File-Exchange-for-Godot" | ||
run/main_scene="res://addons/HTML5FileExchange/sample.tscn" | ||
config/icon="res://icon.png" | ||
|
||
[autoload] | ||
|
||
HTML5File="*res://addons/HTML5FileExchange/HTML5FileExchange.gd" | ||
|
||
[editor_plugins] | ||
|
||
enabled=PoolStringArray( "res://addons/HTML5FileExchange/plugin.cfg" ) | ||
|
||
[physics] | ||
|
||
common/enable_pause_aware_picking=true | ||
|
||
[rendering] | ||
|
||
environment/default_environment="res://default_env.tres" |