Skip to content

Commit

Permalink
Add Demos
Browse files Browse the repository at this point in the history
  • Loading branch information
anosatsuk124 committed Aug 2, 2024
1 parent 4db9d33 commit 5bf7aa6
Show file tree
Hide file tree
Showing 16 changed files with 221 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Demo/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf
2 changes: 2 additions & 0 deletions Demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Godot 4+ specific ignores
.godot/
12 changes: 12 additions & 0 deletions Demo/Demo.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Godot.NET.Sdk/4.2.2">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net7.0</TargetFramework>
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'ios' ">net8.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading>
</PropertyGroup>

<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="bash ./prebuild.sh" />
</Target>
</Project>
19 changes: 19 additions & 0 deletions Demo/Demo.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo", "Demo.csproj", "{5AA4B03C-670D-42F8-8D28-7DD078ECE472}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
ExportDebug|Any CPU = ExportDebug|Any CPU
ExportRelease|Any CPU = ExportRelease|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5AA4B03C-670D-42F8-8D28-7DD078ECE472}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5AA4B03C-670D-42F8-8D28-7DD078ECE472}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5AA4B03C-670D-42F8-8D28-7DD078ECE472}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU
{5AA4B03C-670D-42F8-8D28-7DD078ECE472}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU
{5AA4B03C-670D-42F8-8D28-7DD078ECE472}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU
{5AA4B03C-670D-42F8-8D28-7DD078ECE472}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU
EndGlobalSection
EndGlobal
11 changes: 11 additions & 0 deletions Demo/Sources/Main.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Godot;

public partial class Main : Control
{
public override void _Ready()
{
var container = new MyContainer(new MyEditor());

AddChild(container);
}
}
12 changes: 12 additions & 0 deletions Demo/Sources/MyContainer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Godot;

public partial class MyContainer
{
public MyContainer(Control place1)
{
this.Ready += () =>
{
this.editor1.ReplaceBy(place1);
};
}
}
23 changes: 23 additions & 0 deletions Demo/SourcesGenerated/MyContainer.generated.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Godot;
public partial class MyContainer : TabContainer
{
public Control editor1;
public MyEditor editor2;
public override void _Ready()
{
var root_0 = this;
var node_0 = new Control();
this.editor1 = node_0;
root_0.AddChild(node_0);
var root_1 = node_0;
var node_1 = new MyEditor();
this.editor2 = node_1;
node_1.Name = "Editor2";
root_0.AddChild(node_1);
var root_2 = node_1;
}
public TabContainer GetRoot()
{
return this.GetChild<TabContainer>(0);
}
}
23 changes: 23 additions & 0 deletions Demo/SourcesGenerated/MyEditor.generated.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Godot;
public partial class MyEditor : VBoxContainer
{
public override void _Ready()
{
var root_0 = this;
this.Name = "Editor";
var node_0 = new TextEdit();
node_0.PlaceholderText = "Enter your text here";
node_0.CustomMinimumSize = new Vector2(320, 320);
node_0.DrawSpaces = true;
root_0.AddChild(node_0);
var root_1 = node_0;
var node_1 = new Button();
node_1.Text = "Enter";
root_0.AddChild(node_1);
var root_2 = node_1;
}
public VBoxContainer GetRoot()
{
return this.GetChild<VBoxContainer>(0);
}
}
4 changes: 4 additions & 0 deletions Demo/UI/MyContainer.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<TabContainer>
<Control id="editor1"/>
<MyEditor id="editor2" Name="Editor2"/>
</TabContainer>
8 changes: 8 additions & 0 deletions Demo/UI/MyEditor.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<VBoxContainer Name="Editor">
<TextEdit
PlaceholderText="Enter your text here"
CustomMinimumSize="(320, 320)"
DrawSpaces="true"
/>
<Button Text="Enter"/>
</VBoxContainer>
1 change: 1 addition & 0 deletions Demo/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions Demo/icon.svg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://dabnncvij05gt"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
12 changes: 12 additions & 0 deletions Demo/main.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[gd_scene load_steps=2 format=3 uid="uid://d0dk476aqn77j"]

[ext_resource type="Script" path="res://Sources/Main.cs" id="1_a6a0s"]

[node name="Main" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_a6a0s")
29 changes: 29 additions & 0 deletions Demo/prebuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/env/bin bash

TARGET_DIR="$(realpath ./UI)"
OUT_DIR="./SourcesGenerated"

PROJECT_PATH="$(realpath ../)"

if [ ! -d "${OUT_DIR}" ]; then
mkdir "${OUT_DIR}"
fi

OUT_DIR="$(realpath ${OUT_DIR})"

pushd "${OUT_DIR}"

# Remove all generated files

for f in $(find ${OUT_DIR} -name '*.generated.cs'); do
rm $f
done

# Build the project

for f in $(find ${TARGET_DIR} -name '*.xml'); do
echo "Processing $f file..."
${PROJECT_PATH}/bin/Debug/net8.0/GodotUIXml "$f"
done

popd
25 changes: 25 additions & 0 deletions Demo/project.godot
Original file line number Diff line number Diff line change
@@ -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=5

[application]

config/name="Demo"
run/main_scene="res://main.tscn"
config/features=PackedStringArray("4.2", "C#", "GL Compatibility")
config/icon="res://icon.svg"

[dotnet]

project/assembly_name="Demo"

[rendering]

renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"
1 change: 1 addition & 0 deletions GodotUIXml.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

<ItemGroup>
<Compile Remove="examples\**\*.cs" />
<Compile Remove="Demo\**\*.cs" />
</ItemGroup>

</Project>

0 comments on commit 5bf7aa6

Please sign in to comment.