mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 23:10:08 +01:00
Add Mono C# preprocessor testing to OS test demo
This commit is contained in:
93
misc/os_test/MonoTest.cs
Normal file
93
misc/os_test/MonoTest.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public class MonoTest : Node
|
||||
{
|
||||
public string Architecture()
|
||||
{
|
||||
#if GODOT_ARM64 || GODOT_ARM64_V8A
|
||||
return "64-bit ARM";
|
||||
#elif GODOT_ARMV7 || GODOT_ARMEABI_V7A
|
||||
return "32-bit ARM";
|
||||
#elif GODOT_X86_64
|
||||
return "64-bit x86";
|
||||
#elif GODOT_X86
|
||||
return "32-bit x86";
|
||||
#elif GODOT_128
|
||||
return "128-bit";
|
||||
#elif GODOT_64
|
||||
return "64-bit";
|
||||
#elif GODOT_32
|
||||
return "32-bit";
|
||||
#else
|
||||
return "Unknown";
|
||||
#endif
|
||||
}
|
||||
|
||||
public string OperatingSystem()
|
||||
{
|
||||
#if GODOT_WINDOWS
|
||||
return "Windows";
|
||||
#elif GODOT_LINUXBSD || GODOT_X11
|
||||
return "Linux (or BSD)";
|
||||
#elif GODOT_SERVER
|
||||
return "Server (Linux or BSD)";
|
||||
#elif GODOT_MACOS || GODOT_OSX
|
||||
return "macOS";
|
||||
#elif GODOT_ANDROID
|
||||
return "Android";
|
||||
#elif GODOT_IOS
|
||||
return "iOS";
|
||||
#elif GODOT_HTML5
|
||||
return "HTML5";
|
||||
#elif GODOT_HAIKU
|
||||
return "Haiku";
|
||||
#elif GODOT_UWP
|
||||
return "UWP (Windows 10)";
|
||||
#else
|
||||
return "Unknown";
|
||||
#endif
|
||||
}
|
||||
|
||||
public string PlatformType()
|
||||
{
|
||||
#if GODOT_PC
|
||||
return "PC";
|
||||
#elif GODOT_MOBILE
|
||||
return "Mobile";
|
||||
#elif GODOT_WEB
|
||||
return "Web";
|
||||
#elif GODOT
|
||||
return "Godot Editor (not exported)";
|
||||
#else
|
||||
return "Unknown";
|
||||
#endif
|
||||
}
|
||||
|
||||
public string TextureCompression()
|
||||
{
|
||||
string compression = "";
|
||||
#if GODOT_S3TC
|
||||
compression += "S3TC";
|
||||
#endif
|
||||
#if GODOT_ETC
|
||||
if (compression.Length > 0)
|
||||
{
|
||||
compression += ", ";
|
||||
}
|
||||
compression += "ETC";
|
||||
#endif
|
||||
#if GODOT_ETC2
|
||||
if (compression.Length > 0)
|
||||
{
|
||||
compression += ", ";
|
||||
}
|
||||
compression += "ETC2";
|
||||
#endif
|
||||
if (compression.Length > 0)
|
||||
{
|
||||
return compression;
|
||||
}
|
||||
return "Not exported or no textures";
|
||||
}
|
||||
}
|
||||
60
misc/os_test/Operating System Testing.csproj
Normal file
60
misc/os_test/Operating System Testing.csproj
Normal file
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Tools</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{780B9CDA-51E7-446A-816F-0E2CF667C96C}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<OutputPath>.mono/temp/bin/$(Configuration)</OutputPath>
|
||||
<RootNamespace>OperatingSystemTesting</RootNamespace>
|
||||
<AssemblyName>Operating System Testing</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
|
||||
<GodotProjectGeneratorVersion>1.0.7374.17554</GodotProjectGeneratorVersion>
|
||||
<BaseIntermediateOutputPath>.mono/temp/obj</BaseIntermediateOutputPath>
|
||||
<IntermediateOutputPath>$(BaseIntermediateOutputPath)/$(Configuration)</IntermediateOutputPath>
|
||||
<ApiConfiguration Condition=" '$(Configuration)' != 'Release' ">Debug</ApiConfiguration>
|
||||
<ApiConfiguration Condition=" '$(Configuration)' == 'Release' ">Release</ApiConfiguration>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>portable</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<DefineConstants>$(GodotDefineConstants);GODOT;DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>portable</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineConstants>$(GodotDefineConstants);GODOT;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Tools|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>portable</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<DefineConstants>$(GodotDefineConstants);GODOT;DEBUG;TOOLS;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="GodotSharp">
|
||||
<HintPath>$(ProjectDir)/.mono/assemblies/$(ApiConfiguration)/GodotSharp.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="GodotSharpEditor" Condition=" '$(Configuration)' == 'Tools' ">
|
||||
<HintPath>$(ProjectDir)/.mono/assemblies/$(ApiConfiguration)/GodotSharpEditor.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MonoTest.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
19
misc/os_test/Operating System Testing.sln
Normal file
19
misc/os_test/Operating System Testing.sln
Normal file
@@ -0,0 +1,19 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Operating System Testing", "Operating System Testing.csproj", "{780B9CDA-51E7-446A-816F-0E2CF667C96C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Tools|Any CPU = Tools|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{780B9CDA-51E7-446A-816F-0E2CF667C96C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{780B9CDA-51E7-446A-816F-0E2CF667C96C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{780B9CDA-51E7-446A-816F-0E2CF667C96C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{780B9CDA-51E7-446A-816F-0E2CF667C96C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{780B9CDA-51E7-446A-816F-0E2CF667C96C}.Tools|Any CPU.ActiveCfg = Tools|Any CPU
|
||||
{780B9CDA-51E7-446A-816F-0E2CF667C96C}.Tools|Any CPU.Build.0 = Tools|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
25
misc/os_test/Properties/AssemblyInfo.cs
Normal file
25
misc/os_test/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Reflection;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle("Operating System Testing")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
@@ -1,6 +1,7 @@
|
||||
extends Panel
|
||||
|
||||
onready var rtl = $HBoxContainer/Features
|
||||
onready var mono_test = $MonoTest
|
||||
|
||||
|
||||
# Returns a human-readable string from a date and time, date, or time dictionary.
|
||||
@@ -98,6 +99,13 @@ func _ready():
|
||||
add_line("Value of `PATH`", OS.get_environment("PATH"))
|
||||
add_line("Value of `path`", OS.get_environment("path"))
|
||||
|
||||
add_header("Hardware")
|
||||
add_line("Model name", OS.get_model_name())
|
||||
add_line("Processor count", OS.get_processor_count())
|
||||
add_line("Device unique ID", OS.get_unique_id())
|
||||
add_line("Video adapter name", VisualServer.get_video_adapter_name())
|
||||
add_line("Video adapter vendor", VisualServer.get_video_adapter_vendor())
|
||||
|
||||
add_header("Input")
|
||||
add_line("Latin keyboard variant", OS.get_latin_keyboard_variant())
|
||||
add_line("Device has touch screen", OS.has_touchscreen_ui_hint())
|
||||
@@ -107,16 +115,19 @@ func _ready():
|
||||
add_header("Localization")
|
||||
add_line("Locale", OS.get_locale())
|
||||
|
||||
add_header("Hardware")
|
||||
add_line("Model name", OS.get_model_name())
|
||||
add_line("Processor count", OS.get_processor_count())
|
||||
add_line("Device unique ID", OS.get_unique_id())
|
||||
add_line("Video adapter name", VisualServer.get_video_adapter_name())
|
||||
add_line("Video adapter vendor", VisualServer.get_video_adapter_vendor())
|
||||
|
||||
add_header("Mobile")
|
||||
add_line("Granted permissions", OS.get_granted_permissions())
|
||||
|
||||
add_header("Mono (C#)")
|
||||
var mono_enabled = ResourceLoader.exists("res://MonoTest.cs")
|
||||
add_line("Mono module enabled", "Yes" if mono_enabled else "No")
|
||||
if mono_enabled:
|
||||
mono_test.set_script(load("res://MonoTest.cs"))
|
||||
add_line("Architecture", mono_test.Architecture())
|
||||
add_line("Operating System", mono_test.OperatingSystem())
|
||||
add_line("Platform Type", mono_test.PlatformType())
|
||||
add_line("Texture Compression", mono_test.TextureCompression())
|
||||
|
||||
add_header("Software")
|
||||
add_line("OS name", OS.get_name())
|
||||
add_line("Process ID", OS.get_process_id())
|
||||
|
||||
@@ -196,6 +196,8 @@ margin_bottom = 514.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Kill Current Process"
|
||||
|
||||
[node name="MonoTest" type="Node" parent="."]
|
||||
[connection signal="pressed" from="HBoxContainer/Actions/GridContainer/OpenShellWeb" to="HBoxContainer/Actions" method="_on_OpenShellWeb_pressed"]
|
||||
[connection signal="pressed" from="HBoxContainer/Actions/GridContainer/OpenShellFolder" to="HBoxContainer/Actions" method="_on_OpenShellFolder_pressed"]
|
||||
[connection signal="pressed" from="HBoxContainer/Actions/GridContainer/ChangeWindowTitle" to="HBoxContainer/Actions" method="_on_ChangeWindowTitle_pressed"]
|
||||
|
||||
Reference in New Issue
Block a user