mirror of
https://github.com/Relintai/pandemonium_demo_projects.git
synced 2025-01-02 14:39:37 +01:00
Added a demo for the simpler web static pages.
This commit is contained in:
parent
a15edf1a3b
commit
c9bb63e742
11
web/static_pages/IndexScripted.gd
Normal file
11
web/static_pages/IndexScripted.gd
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
extends StaticWebPage
|
||||||
|
|
||||||
|
|
||||||
|
func _handle_request(request: WebServerRequest) -> void:
|
||||||
|
# Render the menu
|
||||||
|
# This is rendered in the WebRoot node's _render_main_menu method
|
||||||
|
render_menu(request)
|
||||||
|
|
||||||
|
request.body += "Scripted Test Page"
|
||||||
|
|
||||||
|
request.compile_and_send_body()
|
47
web/static_pages/Main.tscn
Normal file
47
web/static_pages/Main.tscn
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://IndexScripted.gd" type="Script" id=1]
|
||||||
|
[ext_resource path="res://WebServerSimple.gd" type="Script" id=2]
|
||||||
|
[ext_resource path="res://WebRoot.gd" type="Script" id=3]
|
||||||
|
|
||||||
|
[node name="Main" type="Node"]
|
||||||
|
|
||||||
|
[node name="WebServerSimple" type="WebServerSimple" parent="."]
|
||||||
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
|
[node name="WebRoot" type="WebRoot" parent="WebServerSimple"]
|
||||||
|
www_root_path = "res://www/"
|
||||||
|
script = ExtResource( 3 )
|
||||||
|
menu_text = "Menu:
|
||||||
|
<br>
|
||||||
|
<a href=\"/\">Index page</a><br>
|
||||||
|
<a href=\"/scripted\">Scripted Page</a><br>
|
||||||
|
<a href=\"/serve_folders\">Serve folders</a><br>
|
||||||
|
<a href=\"/test_md\">Serve and process files as pages</a><br>
|
||||||
|
<a href=\"/md_files_folder\">Serve And process files in a folder as pages</a><br>
|
||||||
|
<br>"
|
||||||
|
|
||||||
|
[node name="Index" type="StaticWebPage" parent="WebServerSimple/WebRoot"]
|
||||||
|
uri_segment = "/"
|
||||||
|
data = "Index page <br>
|
||||||
|
<img src=\"/wwwroot_icon.png\">"
|
||||||
|
|
||||||
|
[node name="IndexScripted" type="StaticWebPage" parent="WebServerSimple/WebRoot"]
|
||||||
|
uri_segment = "scripted"
|
||||||
|
data = "Index page"
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
|
[node name="BrowsableFolderServeWebPage" type="BrowsableFolderServeWebPage" parent="WebServerSimple/WebRoot"]
|
||||||
|
uri_segment = "serve_folders"
|
||||||
|
serve_folder = "res://."
|
||||||
|
__meta__ = {
|
||||||
|
"_editor_description_": "TODO fix res://."
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="StaticWebPageFile" type="StaticWebPageFile" parent="WebServerSimple/WebRoot"]
|
||||||
|
uri_segment = "test_md"
|
||||||
|
file_path = "res://test.md"
|
||||||
|
|
||||||
|
[node name="StaticWebPageFolderFiles" type="StaticWebPageFolderFiles" parent="WebServerSimple/WebRoot"]
|
||||||
|
uri_segment = "md_files_folder"
|
||||||
|
dir_path = "res://md_files/"
|
6
web/static_pages/WebRoot.gd
Normal file
6
web/static_pages/WebRoot.gd
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
extends WebRoot
|
||||||
|
|
||||||
|
export(String, MULTILINE) var menu_text : String
|
||||||
|
|
||||||
|
func _render_main_menu(request: WebServerRequest) -> void:
|
||||||
|
request.body += menu_text
|
11
web/static_pages/WebServerSimple.gd
Normal file
11
web/static_pages/WebServerSimple.gd
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
extends WebServerSimple
|
||||||
|
|
||||||
|
|
||||||
|
# Declare member variables here. Examples:
|
||||||
|
# var a: int = 2
|
||||||
|
# var b: String = "text"
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
start()
|
7
web/static_pages/default_env.tres
Normal file
7
web/static_pages/default_env.tres
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[gd_resource type="Environment3D" load_steps=2 format=2]
|
||||||
|
|
||||||
|
[sub_resource type="ProceduralSky" id=1]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
background_mode = 2
|
||||||
|
background_sky = SubResource( 1 )
|
BIN
web/static_pages/icon.png
Normal file
BIN
web/static_pages/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
35
web/static_pages/icon.png.import
Normal file
35
web/static_pages/icon.png.import
Normal file
@ -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
|
8
web/static_pages/md_files/01.md
Normal file
8
web/static_pages/md_files/01.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
# Header 1
|
||||||
|
|
||||||
|
## Sub header
|
||||||
|
|
||||||
|
This is md file 1
|
||||||
|
|
||||||
|
|
8
web/static_pages/md_files/02.md
Normal file
8
web/static_pages/md_files/02.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
# Header 2
|
||||||
|
|
||||||
|
## Sub header
|
||||||
|
|
||||||
|
This is md file 2
|
||||||
|
|
||||||
|
|
8
web/static_pages/md_files/03.md
Normal file
8
web/static_pages/md_files/03.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
# Header 3
|
||||||
|
|
||||||
|
## Sub header
|
||||||
|
|
||||||
|
This is md file 3
|
||||||
|
|
||||||
|
|
25
web/static_pages/project.pandemonium
Normal file
25
web/static_pages/project.pandemonium
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
; 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="Static Pages"
|
||||||
|
run/main_scene="res://Main.tscn"
|
||||||
|
config/icon="res://icon.png"
|
||||||
|
|
||||||
|
[physics]
|
||||||
|
|
||||||
|
common/enable_pause_aware_picking=true
|
||||||
|
|
||||||
|
[rendering]
|
||||||
|
|
||||||
|
vram_compression/import_etc=true
|
||||||
|
vram_compression/import_etc2=false
|
||||||
|
environment/default_environment="res://default_env.tres"
|
7
web/static_pages/test.md
Normal file
7
web/static_pages/test.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
# Header
|
||||||
|
|
||||||
|
## Sub header
|
||||||
|
|
||||||
|
This is an md file!
|
||||||
|
|
BIN
web/static_pages/www/wwwroot_icon.png
Normal file
BIN
web/static_pages/www/wwwroot_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
35
web/static_pages/www/wwwroot_icon.png.import
Normal file
35
web/static_pages/www/wwwroot_icon.png.import
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/wwwroot_icon.png-15bf3ac3aef4548a351f7399d80b8423.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://www/wwwroot_icon.png"
|
||||||
|
dest_files=[ "res://.import/wwwroot_icon.png-15bf3ac3aef4548a351f7399d80b8423.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
|
Loading…
Reference in New Issue
Block a user