first commit

master
Skye 2 years ago
commit 808b72c030
Signed by: me
GPG Key ID: 0104BC05F41B77B8

@ -0,0 +1,3 @@
source_md5="47313fa4c47a9963fddd764e1ec6e4a8"
dest_md5="26ea799ea0a3da9e753b3ebe822e0570"

@ -0,0 +1,3 @@
source_md5="cf4aec4842e6f28b128d15ef58be76d0"
dest_md5="f713b52cc8973914be7fa878566b7e90"

@ -0,0 +1,3 @@
source_md5="47313fa4c47a9963fddd764e1ec6e4a8"
dest_md5="26ea799ea0a3da9e753b3ebe822e0570"

@ -0,0 +1,3 @@
source_md5="7e41bf3051b18e392a4bb6c0cc45cd7c"
dest_md5="73e4f4d3969b9486e63fd804f5f0f1a9"

@ -0,0 +1,11 @@
[gd_resource type="NativeScript" load_steps=2 format=2]
[sub_resource type="GDNativeLibrary" id=1]
entry/HTML5.wasm32 = "res://nativetest/target/wasm32-unknown-emscripten/release/nativetest.wasm"
entry/X11.64 = "res://nativetest/target/release/libnativetest.so"
dependency/HTML5.wasm32 = [ ]
dependency/X11.64 = [ ]
[resource]
class_name = "HelloWorld"
library = SubResource( 1 )

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://NativeTest.gdns" type="Script" id=1]
[node name="Node2D" type="Node2D"]
script = ExtResource( 1 )

@ -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 )

@ -0,0 +1,34 @@
[preset.0]
name="HTML5"
platform="HTML5"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter="*.wasm"
exclude_filter=""
export_path="test/rustgodottest.html"
script_export_mode=1
script_encryption_key=""
[preset.0.options]
custom_template/debug=""
custom_template/release=""
variant/export_type=2
vram_texture_compression/for_desktop=true
vram_texture_compression/for_mobile=false
html/export_icon=true
html/custom_html_shell="res://template.html"
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 )

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

@ -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

@ -0,0 +1,6 @@
[target.wasm32-unknown-emscripten]
rustflags = [
"-Clink-arg=-sSIDE_MODULE=2", # build a side module that Godot can load
"-Zlink-native-libraries=no", # workaround for a wasm-ld error during linking
"-Cpanic=abort", # workaround for a runtime error related to dyncalls
]

@ -0,0 +1 @@
use flake

@ -0,0 +1,3 @@
/target
/Cargo.lock
.direnv

@ -0,0 +1,12 @@
[package]
name = "nativetest"
version = "0.1.0"
edition = "2021"
[lib]
crate-type = ["cdylib"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
gdnative = "0.11.2"

@ -0,0 +1,94 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1656363765,
"narHash": "sha256-al9eMT2a66tiQQMys40orUS7f2Wg9cBqbEd321HE/EA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ff8b619cfecb98bb94ae49ca7ceca937923a75fa",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ff8b619cfecb98bb94ae49ca7ceca937923a75fa",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1665296151,
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "14ccaaedd95a488dd7ae142757884d8e125b3363",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1672712534,
"narHash": "sha256-8S0DdMPcbITnlOu0uA81mTo3hgX84wK8S9wS34HEFY4=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "69fb7bf0a8c40e6c4c197fa1816773774c8ac59f",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

@ -0,0 +1,29 @@
{
inputs = {
nixpkgs.url =
"github:NixOS/nixpkgs/ff8b619cfecb98bb94ae49ca7ceca937923a75fa";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
in with pkgs; {
devShells.default = mkShell {
buildInputs = [
(rust-bin.nightly."2022-09-02".default.override {
extensions = [ "rust-src" ];
targets = [ "wasm32-unknown-emscripten" ];
})
libclang
emscripten
];
C_INCLUDE_PATH = "${emscripten}/share/emscripten/cache/sysroot/include";
LIBCLANG_PATH = "${libclang.lib}/lib";
EM_CACHE = "/tmp/emscripten-cache";
};
});
}

@ -0,0 +1,23 @@
use gdnative::prelude::*;
#[derive(NativeClass)]
#[inherit(Node)]
struct HelloWorld;
#[methods]
impl HelloWorld {
fn new(_owner: &Node) -> Self {
HelloWorld
}
#[method]
fn _ready(&self) {
godot_print!("Hello from Rust!")
}
}
fn init(handle: InitHandle) {
handle.add_class::<HelloWorld>();
}
godot_init!(init);

@ -0,0 +1,27 @@
; 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="rustgodottest"
run/main_scene="res://Node2D.tscn"
config/icon="res://icon.png"
[gui]
common/drop_mouse_on_gui_input_disabled=true
[physics]
common/enable_pause_aware_picking=true
[rendering]
environment/default_environment="res://default_env.tres"

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<title>Titled Jam Team (internal build)</title>
<meta charset="UTF-8">
</head>
<body>
<noscript>Why do you not have JavaScript?</noscript>
<canvas id="canvas"></canvas>
<script src="$GODOT_URL"></script>
<script>
const urlParams = new URLSearchParams(document.URL)
const wasm = "tmp_js_export"
const pck = "tmp_js_export.pck"
const engine = new Engine();
Promise.all([
engine.init(wasm),
engine.preloadFile(pck)
]).then(() => {
return engine.start({args: ['--main-pack', pck]})
})
</script>
</body>
</html>
Loading…
Cancel
Save