diff --git a/templates/example-webgpu.html b/templates/example-webgpu.html index 3a9341f013..ff63313fb8 100644 --- a/templates/example-webgpu.html +++ b/templates/example-webgpu.html @@ -1,124 +1,9 @@ -{% extends "layouts/base.html" %} -{% block content %} -
-
- {% set total_ancestors = page.ancestors | length %} - {% set parent_idx = total_ancestors - 1 %} - {% set category = get_section(path=page.ancestors | nth(n=parent_idx)) %} -

{{ category.title }} / {{ page.title }}

- Back to examples - - View in GitHub - -
-
-

Support Warning

- WebGPU is currently only supported on Chrome starting with version 113, and only on desktop. If they don't work on - your configuration, you can check the WebGL2 examples here. -
-
-
-
-
-
-
-
-
- -
-
- {% set filename = page.extra.code_path | split(pat="/") | last %} - {{ filename }}: - - {% set code = load_data(path=page.extra.code_path) %} - {% set code_md = "```rust" ~ newline ~ code ~ "```" %} - {{ code_md | markdown(inline=true) | safe }} -
- {% for shader in page.extra.shader_code_paths %} -
- {{ shader }}: - - {% set code = load_data(path="static/assets/examples/" ~ shader) %} - {% set code_md = "```rust" ~ newline ~ code ~ "```" %} - {{ code_md | markdown(inline=true) | safe }} -
- {% endfor %} -
- -{% endblock content %} +{% extends "layouts/example.html" %} + +{% block examples_url %}/examples-webgpu{% endblock examples_url %} +{% block wasm_base_url %}https://bevy-webgpu-examples.pages.dev{% endblock wasm_base_url %} +{% block intro %} +

Support Warning

+WebGPU is currently only supported on Chrome starting with version 113, and only on desktop. +If they don't work on your configuration, you can check the WebGL2 examples here. +{% endblock intro %} diff --git a/templates/example.html b/templates/example.html index 554fb7e681..d73969e1ae 100644 --- a/templates/example.html +++ b/templates/example.html @@ -1,123 +1,8 @@ -{% extends "layouts/base.html" %} -{% block content %} -
-
- {% set total_ancestors = page.ancestors | length %} - {% set parent_idx = total_ancestors - 1 %} - {% set category = get_section(path=page.ancestors | nth(n=parent_idx)) %} -

{{ category.title }} / {{ page.title }}

- Back to examples - - View in GitHub - -
-
- This example is running in WebGL2 and should work in most browsers. You can check the WebGPU examples here. -
-
-
-
-
-
-
-
-
- -
- -
- {% set filename = page.extra.code_path | split(pat="/") | last %} - {{ filename }}: - - {% set code = load_data(path=page.extra.code_path) %} - {% set code_md = "```rust" ~ newline ~ code ~ "```" %} - {{ code_md | markdown(inline=true) | safe }} -
- {% for shader in page.extra.shader_code_paths %} -
- {{ shader }}: - - {% set code = load_data(path="static/assets/examples/" ~ shader) %} - {% set code_md = "```rust" ~ newline ~ code ~ "```" %} - {{ code_md | markdown(inline=true) | safe }} -
- {% endfor %} -
- -{% endblock content %} +{% extends "layouts/example.html" %} + +{% block examples_url %}/examples{% endblock examples_url %} +{% block wasm_base_url %}https://bevy-webgl2-examples.pages.dev{% endblock wasm_base_url %} +{% block intro %} +This example is running in WebGL2 and should work in most browsers. +You can check the WebGPU examples here. +{% endblock intro %} diff --git a/templates/examples-webgpu.html b/templates/examples-webgpu.html index e964e14633..03f08f6949 100644 --- a/templates/examples-webgpu.html +++ b/templates/examples-webgpu.html @@ -1,40 +1,10 @@ -{% extends "layouts/page-with-menu.html" %} -{% import "macros/assets.html" as assets_macros %} -{% block page_name %}Examples{% endblock page_name %} -{% block mobile_page_menu %}{{ assets_macros::assets_menu(prefix="page-menu", root=section) }}{% endblock mobile_page_menu %} -{% block page_menu %}{{ assets_macros::assets_menu(prefix="page-menu", root=section) }}{% endblock page_menu %} -{% block page_content %} -
-
- These examples demonstrate how to use Bevy's features in a minimal, easy to understand way. Click an example below - to run it in - your browser (using WASM + WebGPU) and view the source code. You can also view these examples (and others) in the - Bevy repo. -

Support Warning

- WebGPU is currently only supported on Chrome starting with version 113, and only on desktop. If they don't work on - your configuration, you can check the WebGL2 examples here. -
- - {% for subsection in section.subsections %} - {% set section = get_section(path=subsection) %} -

- {{ section.title }}# -

- {% if section.pages %} -
- {% set pages = section.pages %} - {% if section.extra.sort_order_reversed %} - {% set pages = section.pages | reverse %} - {% endif %} - {% for post in pages %}{{ assets_macros::card(post=post) }}{% endfor %} -
- {% endif %} - {% endfor %} -
- -{% endblock page_content %} +{% extends "layouts/examples.html" %} + +{% block intro %} +These examples demonstrate how to use Bevy's features in a minimal, easy to understand way. +Click an example below to run it in your browser (using WASM + WebGPU) and view the source code. +You can also view these examples (and others) in the Bevy repo. +

Support Warning

+WebGPU is currently only supported on Chrome starting with version 113, and only on desktop. +If they don't work on your configuration, you can check the WebGL2 examples here. +{% endblock intro %} diff --git a/templates/examples.html b/templates/examples.html index c9fd891742..0f24a30c5c 100644 --- a/templates/examples.html +++ b/templates/examples.html @@ -1,41 +1,8 @@ -{% extends "layouts/page-with-menu.html" %} -{% import "macros/assets.html" as assets_macros %} -{% block page_name %}Examples{% endblock page_name %} -{% block mobile_page_menu %}{{ assets_macros::assets_menu(prefix="page-menu", root=section) }}{% endblock mobile_page_menu %} -{% block page_menu %}{{ assets_macros::assets_menu(prefix="page-menu", root=section) }}{% endblock page_menu %} -{% block page_content %} -
-
- These examples demonstrate how to use Bevy's features in a minimal, easy to understand way. Click an example below - to run it in - your browser (using WASM + WebGL) and view the source code. You can also view these examples (and others) in the - Bevy repo. -

- If you would like to try WASM + WebGPU, you can explore our live WebGPU examples - page. -

-
- - {% for subsection in section.subsections %} - {% set section = get_section(path=subsection) %} -

- {{ section.title }}# -

- {% if section.pages %} -
- {% set pages = section.pages %} - {% if section.extra.sort_order_reversed %} - {% set pages = section.pages | reverse %} - {% endif %} - {% for post in pages %}{{ assets_macros::card(post=post) }}{% endfor %} -
- {% endif %} - {% endfor %} -
- -{% endblock page_content %} +{% extends "layouts/examples.html" %} + +{% block intro %} +These examples demonstrate how to use Bevy's features in a minimal, easy to understand way. +Click an example below to run it in your browser (using WASM + WebGL) and view the source code. +You can also view these examples (and others) in the Bevy repo. +

If you would like to try WASM + WebGPU, you can explore our live WebGPU examples page.

+{% endblock intro %} diff --git a/templates/layouts/example.html b/templates/layouts/example.html new file mode 100644 index 0000000000..0b8b860020 --- /dev/null +++ b/templates/layouts/example.html @@ -0,0 +1,123 @@ +{% extends "layouts/base.html" %} +{% block content %} +
+
+ {% set total_ancestors = page.ancestors | length %} + {% set parent_idx = total_ancestors - 1 %} + {% set category = get_section(path=page.ancestors | nth(n=parent_idx)) %} +

{{ category.title }} / {{ page.title }}

+ Back to examples + + View in GitHub + +
+
+ {% block intro %}{% endblock intro %} +
+
+
+
+
+
+
+
+
+ +
+ +
+ {% set filename = page.extra.code_path | split(pat="/") | last %} + {{ filename }}: + + {% set code = load_data(path=page.extra.code_path) %} + {% set code_md = "```rust" ~ newline ~ code ~ "```" %} + {{ code_md | markdown(inline=true) | safe }} +
+ {% for shader in page.extra.shader_code_paths %} +
+ {{ shader }}: + + {% set code = load_data(path="static/assets/examples/" ~ shader) %} + {% set code_md = "```rust" ~ newline ~ code ~ "```" %} + {{ code_md | markdown(inline=true) | safe }} +
+ {% endfor %} +
+ +{% endblock content %} diff --git a/templates/layouts/examples.html b/templates/layouts/examples.html new file mode 100644 index 0000000000..f865cf6a48 --- /dev/null +++ b/templates/layouts/examples.html @@ -0,0 +1,34 @@ +{% extends "layouts/page-with-menu.html" %} +{% import "macros/assets.html" as assets_macros %} +{% block page_name %}Examples{% endblock page_name %} +{% block mobile_page_menu %}{{ assets_macros::assets_menu(prefix="page-menu", root=section) }}{% endblock mobile_page_menu %} +{% block page_menu %}{{ assets_macros::assets_menu(prefix="page-menu", root=section) }}{% endblock page_menu %} +{% block page_content %} +
+
+ {% block intro %}{% endblock intro %} +
+ + {% for subsection in section.subsections %} + {% set section = get_section(path=subsection) %} +

+ {{ section.title }}# +

+ {% if section.pages %} +
+ {% set pages = section.pages %} + {% if section.extra.sort_order_reversed %} + {% set pages = section.pages | reverse %} + {% endif %} + {% for post in pages %}{{ assets_macros::card(post=post) }}{% endfor %} +
+ {% endif %} + {% endfor %} +
+ +{% endblock page_content %}