This commit is contained in:
not-elm
2025-08-10 21:28:45 +09:00
commit 23bdc65da3
91 changed files with 20122 additions and 0 deletions

35
assets/brp.html Normal file
View File

@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body style="color: white">
<h1>HTML Path: assets/brp.html</h1>
<p></p>
<input id="name" type="text" placeholder="Enter your name" />
<button id="greet" >Greet</button>
<p id="reply"></p>
<script>
const nameInput = document.getElementById("name");
const greetButton = document.getElementById("greet");
const reply = document.getElementById("reply");
greetButton.addEventListener("click", async () => {
const name = nameInput.value;
if (name) {
try{
reply.innerText = await window.cef.brp({
jsonrpc: "2.0",
method: "greet",
params: name,
});
}catch (e){
console.error("Error calling greet method:", e);
reply.innerText = "Error: " + e.message;
}
}
});
</script>
</body>
</html>

23
assets/host_emit.html Normal file
View File

@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Host Emit</title>
</head>
<body style="color: white">
<h1>HTML Path: assets/host_emit.html</h1>
<p>
This example demonstrates how to receive events from the application.
</p>
<p>
The application emits a count value every second, which is then displayed in the HTML.
</p>
<h1 id="count" style="color: aqua">0</h1>
<script>
const count = document.getElementById("count");
window.cef.listen("count", (payload) => {
count.innerText = payload;
})
</script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

28
assets/js_emit.html Normal file
View File

@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JS Emit</title>
</head>
<body style=" color: white">
<h1>HTML Path: assets/js_emit.html</h1>
<p>The example sends events from JavaScript to the application.</p>
<p>
It emits a count value every second, which is then sent to the application and logged in the console.
</p>
<h1 id="count" style="color: aqua">0</h1>
<script>
const countElement = document.getElementById("count");
let count = 0;
window.setInterval(() => {
console.log("Emitting count:", count);
window.cef.emit({
count,
});
countElement.innerText = count;
count += 1;
}, 1000)
</script>
</body>
</html>

View File

@@ -0,0 +1,20 @@
#import bevy_pbr::{
forward_io::VertexOutput,
}
#import webview::util::{
surface_color,
}
@group(2) @binding(0) var mask_texture: texture_2d<f32>;
@group(2) @binding(1) var mask_sampler: sampler;
@fragment
fn fragment(
in: VertexOutput,
) -> @location(0) vec4<f32> {
// You can obtain the surface color.
var color = surface_color(in.uv);
// Blend the color with the mask texture.
color *= (textureSample(mask_texture, mask_sampler, in.uv) * vec4(vec3(1.0), 0.3));
return color;
}