├── .gitattributes
├── .gitignore
├── Content
├── Models.wedir
├── Models
│ ├── scene.bin
│ ├── scene.bin.wefile
│ ├── scene.gltf
│ ├── scene.gltf.wemd
│ ├── scene_Embedded.wedir
│ └── scene_Embedded
│ │ ├── Materials.wedir
│ │ └── Materials
│ │ ├── accent_yellow.wemt
│ │ ├── metal_bright.wemt
│ │ ├── metal_dark.wemt
│ │ ├── metal_mid.wemt
│ │ ├── plastic_cone_black.wemt
│ │ └── plastic_grey.wemt
├── Scenes.wedir
└── Scenes
│ ├── MyScene.wescene
│ ├── MyScene.wescene.wesc
│ └── MyScene
│ ├── Environment.wedir
│ └── Environment
│ ├── SceneReflectionProbe.werp
│ └── SceneReflectionProbe
│ ├── Irradiance.texdmp
│ ├── Irradiance.texdmp.wetx
│ ├── Radiance.texdmp
│ └── Radiance.texdmp.wetx
├── Directory.Build.props
├── Images
├── FormsSample.png
├── MAUISample.png
├── SDLSample.png
├── WinUISample.png
└── WpfSample.png
├── LICENSE
├── README.md
├── UIWindowSystemsDemo.Editor
├── MyCustomClassEditor.cs
├── Properties
│ └── AssemblyInfo.cs
└── UIWindowSystemsDemo.Editor.csproj
├── UIWindowSystemsDemo.MAUI.sln
├── UIWindowSystemsDemo.MAUI
├── App.xaml
├── App.xaml.cs
├── AppShell.xaml
├── AppShell.xaml.cs
├── Evergine
│ ├── AppBuilderExtensions.cs
│ ├── EvergineView.cs
│ └── EvergineViewHandler.cs
├── MainPage.xaml
├── MainPage.xaml.cs
├── MauiProgram.cs
├── Platforms
│ ├── Android
│ │ ├── AndroidManifest.xml
│ │ ├── EvergineViewHandler.Android.cs
│ │ ├── MainActivity.cs
│ │ ├── MainApplication.cs
│ │ ├── Resources
│ │ │ └── values
│ │ │ │ └── colors.xml
│ │ └── linker.xml
│ ├── Windows
│ │ ├── App.xaml
│ │ ├── App.xaml.cs
│ │ ├── EvergineViewHandler.Windows.cs
│ │ ├── Package.appxmanifest
│ │ └── app.manifest
│ └── iOS
│ │ ├── AppDelegate.cs
│ │ ├── EvergineAppViewController.cs
│ │ ├── EvergineViewHandler.iOS.cs
│ │ ├── Info.plist
│ │ └── Program.cs
├── Properties
│ └── launchSettings.json
├── Resources
│ ├── AppIcon
│ │ ├── appicon.svg
│ │ └── appiconfg.svg
│ ├── Fonts
│ │ ├── OpenSans-Regular.ttf
│ │ └── OpenSans-Semibold.ttf
│ ├── Images
│ │ └── dotnet_bot.svg
│ ├── Raw
│ │ └── AboutAssets.txt
│ ├── Splash
│ │ └── splash.svg
│ └── Styles
│ │ ├── Colors.xaml
│ │ └── Styles.xaml
└── UIWindowSystemsDemo.MAUI.csproj
├── UIWindowSystemsDemo.SDL.sln
├── UIWindowSystemsDemo.SDL
├── Program.cs
└── UIWindowSystemsDemo.SDL.csproj
├── UIWindowSystemsDemo.WPF.sln
├── UIWindowSystemsDemo.WPF
├── App.xaml
├── App.xaml.cs
├── AssemblyInfo.cs
├── EvergineDisplayHelper.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── SecondaryWindow.xaml
├── SecondaryWindow.xaml.cs
├── SeparatedWindows.xaml
├── SeparatedWindows.xaml.cs
└── UIWindowSystemsDemo.WPF.csproj
├── UIWindowSystemsDemo.WinUI (Package)
├── Images
│ ├── LockScreenLogo.scale-200.png
│ ├── SplashScreen.scale-200.png
│ ├── Square150x150Logo.scale-200.png
│ ├── Square44x44Logo.scale-200.png
│ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ ├── StoreLogo.png
│ └── Wide310x150Logo.scale-200.png
├── Package.appxmanifest
└── UIWindowSystemsDemo.WinUI (Package).wapproj
├── UIWindowSystemsDemo.WinUI.sln
├── UIWindowSystemsDemo.WinUI
├── App.xaml
├── App.xaml.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── UIWindowSystemsDemo.WinUI.csproj
└── app.manifest
├── UIWindowSystemsDemo.Windows.sln
├── UIWindowSystemsDemo.Windows
├── CustomForm.Designer.cs
├── CustomForm.cs
├── CustomForm.resx
├── Program.cs
└── UIWindowSystemsDemo.Windows.csproj
├── UIWindowSystemsDemo.weproj
├── UIWindowSystemsDemo
├── DisplacementBehavior.cs
├── InteractionService.cs
├── MyApplication.cs
├── MyScene.cs
├── Properties
│ └── AssemblyInfo.cs
├── ResetCameraComponent.cs
└── UIWindowSystemsDemo.csproj
└── nuget.config
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.weproj eol=crlf
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.suo
8 | *.user
9 | *.userosscache
10 | *.sln.docstates
11 |
12 | # User-specific files (MonoDevelop/Xamarin Studio)
13 | *.userprefs
14 |
15 | # Build results
16 | [Dd]ebug/
17 | [Dd]ebugPublic/
18 | [Rr]elease/
19 | [Rr]eleases/
20 | x64/
21 | x86/
22 | bld/
23 | [Bb]in/
24 | [Oo]bj/
25 | [Ll]og/
26 |
27 | # Visual Studio 2015/2017 cache/options directory
28 | .vs/
29 | # Uncomment if you have tasks that create the project's static files in wwwroot
30 | #wwwroot/
31 |
32 | # Visual Studio 2017 auto generated files
33 | Generated\ Files/
34 |
35 | # MSTest test Results
36 | [Tt]est[Rr]esult*/
37 | [Bb]uild[Ll]og.*
38 |
39 | # NUNIT
40 | *.VisualState.xml
41 | TestResult.xml
42 |
43 | # Build Results of an ATL Project
44 | [Dd]ebugPS/
45 | [Rr]eleasePS/
46 | dlldata.c
47 |
48 | # Benchmark Results
49 | BenchmarkDotNet.Artifacts/
50 |
51 | # .NET Core
52 | project.lock.json
53 | project.fragment.lock.json
54 | artifacts/
55 | **/Properties/launchSettings.json
56 |
57 | # StyleCop
58 | StyleCopReport.xml
59 |
60 | # Files built by Visual Studio
61 | *_i.c
62 | *_p.c
63 | *_i.h
64 | *.ilk
65 | *.meta
66 | *.obj
67 | *.iobj
68 | *.pch
69 | *.pdb
70 | *.ipdb
71 | *.pgc
72 | *.pgd
73 | *.rsp
74 | *.sbr
75 | *.tlb
76 | *.tli
77 | *.tlh
78 | *.tmp
79 | *.tmp_proj
80 | *.log
81 | *.vspscc
82 | *.vssscc
83 | .builds
84 | *.pidb
85 | *.svclog
86 | *.scc
87 |
88 | # Chutzpah Test files
89 | _Chutzpah*
90 |
91 | # Visual C++ cache files
92 | ipch/
93 | *.aps
94 | *.ncb
95 | *.opendb
96 | *.opensdf
97 | *.sdf
98 | *.cachefile
99 | *.VC.db
100 | *.VC.VC.opendb
101 |
102 | # Visual Studio profiler
103 | *.psess
104 | *.vsp
105 | *.vspx
106 | *.sap
107 |
108 | # Visual Studio Trace Files
109 | *.e2e
110 |
111 | # TFS 2012 Local Workspace
112 | $tf/
113 |
114 | # Guidance Automation Toolkit
115 | *.gpState
116 |
117 | # ReSharper is a .NET coding add-in
118 | _ReSharper*/
119 | *.[Rr]e[Ss]harper
120 | *.DotSettings.user
121 |
122 | # JustCode is a .NET coding add-in
123 | .JustCode
124 |
125 | # TeamCity is a build add-in
126 | _TeamCity*
127 |
128 | # DotCover is a Code Coverage Tool
129 | *.dotCover
130 |
131 | # AxoCover is a Code Coverage Tool
132 | .axoCover/*
133 | !.axoCover/settings.json
134 |
135 | # Visual Studio code coverage results
136 | *.coverage
137 | *.coveragexml
138 |
139 | # NCrunch
140 | _NCrunch_*
141 | .*crunch*.local.xml
142 | nCrunchTemp_*
143 |
144 | # MightyMoose
145 | *.mm.*
146 | AutoTest.Net/
147 |
148 | # Web workbench (sass)
149 | .sass-cache/
150 |
151 | # Installshield output folder
152 | [Ee]xpress/
153 |
154 | # DocProject is a documentation generator add-in
155 | DocProject/buildhelp/
156 | DocProject/Help/*.HxT
157 | DocProject/Help/*.HxC
158 | DocProject/Help/*.hhc
159 | DocProject/Help/*.hhk
160 | DocProject/Help/*.hhp
161 | DocProject/Help/Html2
162 | DocProject/Help/html
163 |
164 | # Click-Once directory
165 | publish/
166 |
167 | # Publish Web Output
168 | *.[Pp]ublish.xml
169 | *.azurePubxml
170 | # Note: Comment the next line if you want to checkin your web deploy settings,
171 | # but database connection strings (with potential passwords) will be unencrypted
172 | *.pubxml
173 | *.publishproj
174 |
175 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
176 | # checkin your Azure Web App publish settings, but sensitive information contained
177 | # in these scripts will be unencrypted
178 | PublishScripts/
179 |
180 | # NuGet Packages
181 | *.nupkg
182 | # The packages folder can be ignored because of Package Restore
183 | **/[Pp]ackages/*
184 | # except build/, which is used as an MSBuild target.
185 | !**/[Pp]ackages/build/
186 | # Uncomment if necessary however generally it will be regenerated when needed
187 | #!**/[Pp]ackages/repositories.config
188 | # NuGet v3's project.json files produces more ignorable files
189 | *.nuget.props
190 | *.nuget.targets
191 |
192 | # Microsoft Azure Build Output
193 | csx/
194 | *.build.csdef
195 |
196 | # Microsoft Azure Emulator
197 | ecf/
198 | rcf/
199 |
200 | # Windows Store app package directories and files
201 | AppPackages/
202 | BundleArtifacts/
203 | Package.StoreAssociation.xml
204 | _pkginfo.txt
205 | *.appx
206 |
207 | # Visual Studio cache files
208 | # files ending in .cache can be ignored
209 | *.[Cc]ache
210 | # but keep track of directories ending in .cache
211 | !*.[Cc]ache/
212 |
213 | # Others
214 | ClientBin/
215 | ~$*
216 | *~
217 | *.dbmdl
218 | *.dbproj.schemaview
219 | *.jfm
220 | *.pfx
221 | *.publishsettings
222 | orleans.codegen.cs
223 |
224 | # Including strong name files can present a security risk
225 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
226 | #*.snk
227 |
228 | # Since there are multiple workflows, uncomment next line to ignore bower_components
229 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
230 | #bower_components/
231 |
232 | # RIA/Silverlight projects
233 | Generated_Code/
234 |
235 | # Backup & report files from converting an old project file
236 | # to a newer Visual Studio version. Backup files are not needed,
237 | # because we have git ;-)
238 | _UpgradeReport_Files/
239 | Backup*/
240 | UpgradeLog*.XML
241 | UpgradeLog*.htm
242 | ServiceFabricBackup/
243 | *.rptproj.bak
244 |
245 | # SQL Server files
246 | *.mdf
247 | *.ldf
248 | *.ndf
249 |
250 | # Business Intelligence projects
251 | *.rdl.data
252 | *.bim.layout
253 | *.bim_*.settings
254 | *.rptproj.rsuser
255 |
256 | # Microsoft Fakes
257 | FakesAssemblies/
258 |
259 | # GhostDoc plugin setting file
260 | *.GhostDoc.xml
261 |
262 | # Node.js Tools for Visual Studio
263 | .ntvs_analysis.dat
264 | node_modules/
265 |
266 | # Visual Studio 6 build log
267 | *.plg
268 |
269 | # Visual Studio 6 workspace options file
270 | *.opt
271 |
272 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
273 | *.vbw
274 |
275 | # Visual Studio LightSwitch build output
276 | **/*.HTMLClient/GeneratedArtifacts
277 | **/*.DesktopClient/GeneratedArtifacts
278 | **/*.DesktopClient/ModelManifest.xml
279 | **/*.Server/GeneratedArtifacts
280 | **/*.Server/ModelManifest.xml
281 | _Pvt_Extensions
282 |
283 | # Paket dependency manager
284 | .paket/paket.exe
285 | paket-files/
286 |
287 | # FAKE - F# Make
288 | .fake/
289 |
290 | # JetBrains Rider
291 | .idea/
292 | *.sln.iml
293 |
294 | # CodeRush
295 | .cr/
296 |
297 | # Python Tools for Visual Studio (PTVS)
298 | __pycache__/
299 | *.pyc
300 |
301 | # Cake - Uncomment if you are using it
302 | # tools/**
303 | # !tools/packages.config
304 |
305 | # Tabs Studio
306 | *.tss
307 |
308 | # Telerik's JustMock configuration file
309 | *.jmconfig
310 |
311 | # BizTalk build output
312 | *.btp.cs
313 | *.btm.cs
314 | *.odx.cs
315 | *.xsd.cs
316 |
317 | # OpenCover UI analysis results
318 | OpenCover/
319 |
320 | # Azure Stream Analytics local run output
321 | ASALocalRun/
322 |
323 | # MSBuild Binary and Structured Log
324 | *.binlog
325 |
326 | # NVidia Nsight GPU debugger configuration file
327 | *.nvuser
328 |
329 | # MFractors (Xamarin productivity tool) working folder
330 | .mfractor/
331 |
332 | # Evergine
333 | .Evergine/
334 | EvergineContent.cs
335 | !**/Content/**/*.obj
336 |
--------------------------------------------------------------------------------
/Content/Models.wedir:
--------------------------------------------------------------------------------
1 | !Evergine.Assets.Exporters.DirectoryMetaFile,Evergine.Assets
2 | Id: 8347b956-d6de-475e-950d-a9070e4709c8
3 | DefaultProfile:
4 | ExcludeAsset: false
5 | Name: null
6 | OutputName: null
7 | Platform: Undefined
8 | ExportAsRaw: false
9 | Profiles: {}
10 |
--------------------------------------------------------------------------------
/Content/Models/scene.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EvergineTeam/UIWindowSystemsDemo/f2d68c6daa0acf4def7593c3a7f75077fecd722b/Content/Models/scene.bin
--------------------------------------------------------------------------------
/Content/Models/scene.bin.wefile:
--------------------------------------------------------------------------------
1 | !Evergine.Assets.Exporters.FileMetaFile,Evergine.Assets
2 | Id: 9b72e8ac-4001-4b2d-b544-ed9e17373d9e
3 | DefaultProfile:
4 | ExcludeAsset: false
5 | Name: null
6 | Platform: Undefined
7 | Profiles: {}
8 | Source:
9 | Header:
10 | Id: 65597d43-11a5-41c5-98c3-f896a976d2ce
11 | IsCompressed: true
12 | LastModified: 0001-01-01T00:00:00.0000000
13 |
--------------------------------------------------------------------------------
/Content/Models/scene.gltf.wemd:
--------------------------------------------------------------------------------
1 | !Evergine.Assets.Exporters.ModelMetaFile,Evergine.Assets
2 | Id: fbf972d8-435f-4fef-a4b8-15985eb15396
3 | Clips: []
4 | DefaultProfile:
5 | ExcludeAsset: false
6 | Name: null
7 | Platform: Undefined
8 | ExportAnimations: true
9 | ExportAsRaw: false
10 | GenerateTangentSpace: true
11 | Profiles: {}
12 | Source:
13 | Header:
14 | Id: 8f5edc0b-7a7a-4c51-b384-156ffa7b8baf
15 | IsCompressed: true
16 | LastModified: 0001-01-01T00:00:00.0000000
17 | ModelInfo:
18 | Id: 886b6454-2271-4a7b-8bc3-f3f01d748da5
19 | AnimationTracks: []
20 | EmbeddedResources: null
21 | Materials:
22 | - Item1: accent-yellow
23 | Item2: e9b2b5c2-e48b-4b5b-80ff-0f19c96280a3
24 | - Item1: metal-bright
25 | Item2: 22fe1a38-6f62-4cfc-9fed-ee4660a4536a
26 | - Item1: metal-dark
27 | Item2: 91a1069e-669a-4cc2-b4dd-4a76ee651661
28 | - Item1: metal-mid
29 | Item2: 6c351fe7-5428-453a-a33b-f651ae470e29
30 | - Item1: plastic-cone-black
31 | Item2: d9a9f4d9-f4fd-46a5-a433-8869f4475242
32 | - Item1: plastic-grey
33 | Item2: 4e1e89d7-f07a-475e-ad11-2460207d4b8d
34 | Nodes:
35 | - RootNode (gltf orientation matrix)
36 | - RootNode (gltf orientation matrix).RootNode (model correction matrix)
37 | - RootNode (gltf orientation matrix).RootNode (model correction matrix).turbine-01_obj_cleaner_materialmerger_gles
38 | - RootNode (gltf orientation matrix).RootNode (model correction matrix).turbine-01_obj_cleaner_materialmerger_gles._Node_3
39 | - RootNode (gltf orientation matrix).RootNode (model correction matrix).turbine-01_obj_cleaner_materialmerger_gles._Node_4
40 | - RootNode (gltf orientation matrix).RootNode (model correction matrix).turbine-01_obj_cleaner_materialmerger_gles._Node_5
41 | - RootNode (gltf orientation matrix).RootNode (model correction matrix).turbine-01_obj_cleaner_materialmerger_gles._Node_6
42 | - RootNode (gltf orientation matrix).RootNode (model correction matrix).turbine-01_obj_cleaner_materialmerger_gles._Node_7
43 | - RootNode (gltf orientation matrix).RootNode (model correction matrix).turbine-01_obj_cleaner_materialmerger_gles._Node_8
44 | - RootNode (gltf orientation matrix).RootNode (model correction matrix).turbine-01_obj_cleaner_materialmerger_gles._Node_9
45 | - RootNode (gltf orientation matrix).RootNode (model correction matrix).turbine-01_obj_cleaner_materialmerger_gles._Node_10
46 | - RootNode (gltf orientation matrix).RootNode (model correction matrix).turbine-01_obj_cleaner_materialmerger_gles._Node_11
47 | - RootNode (gltf orientation matrix).RootNode (model correction matrix).turbine-01_obj_cleaner_materialmerger_gles._Node_12
48 | - RootNode (gltf orientation matrix).RootNode (model correction matrix).turbine-01_obj_cleaner_materialmerger_gles._Node_13
49 | - RootNode (gltf orientation matrix).RootNode (model correction matrix).turbine-01_obj_cleaner_materialmerger_gles._Node_14
50 | - RootNode (gltf orientation matrix).RootNode (model correction matrix).turbine-01_obj_cleaner_materialmerger_gles._Node_15
51 | - RootNode (gltf orientation matrix).RootNode (model correction matrix).turbine-01_obj_cleaner_materialmerger_gles._Node_16
52 | - RootNode (gltf orientation matrix).RootNode (model correction matrix).turbine-01_obj_cleaner_materialmerger_gles._Node_17
53 | - RootNode (gltf orientation matrix).RootNode (model correction matrix).turbine-01_obj_cleaner_materialmerger_gles._Node_18
54 | - RootNode (gltf orientation matrix).RootNode (model correction matrix).turbine-01_obj_cleaner_materialmerger_gles._Node_19
55 | - RootNode (gltf orientation matrix).RootNode (model correction matrix).turbine-01_obj_cleaner_materialmerger_gles._Node_20
56 | - RootNode (gltf orientation matrix).RootNode (model correction matrix).turbine-01_obj_cleaner_materialmerger_gles._Node_21
57 | SwapWindingOrder: false
58 |
--------------------------------------------------------------------------------
/Content/Models/scene_Embedded.wedir:
--------------------------------------------------------------------------------
1 | !Evergine.Assets.Exporters.DirectoryMetaFile,Evergine.Assets
2 | Id: 2e880c10-9d1a-46b3-8ff5-4dc9dc887a3a
3 | DefaultProfile:
4 | ExcludeAsset: false
5 | Name: null
6 | OutputName: null
7 | Platform: Undefined
8 | ExportAsRaw: false
9 | Profiles: {}
10 |
--------------------------------------------------------------------------------
/Content/Models/scene_Embedded/Materials.wedir:
--------------------------------------------------------------------------------
1 | !Evergine.Assets.Exporters.DirectoryMetaFile,Evergine.Assets
2 | Id: c11c86b9-d33c-4b6a-8a34-29f39982dee7
3 | DefaultProfile:
4 | ExcludeAsset: false
5 | Name: null
6 | OutputName: null
7 | Platform: Undefined
8 | ExportAsRaw: false
9 | Profiles: {}
10 |
--------------------------------------------------------------------------------
/Content/Models/scene_Embedded/Materials/accent_yellow.wemt:
--------------------------------------------------------------------------------
1 | !Evergine.Assets.Exporters.MaterialMetaFile,Evergine.Assets
2 | Id: e9b2b5c2-e48b-4b5b-80ff-0f19c96280a3
3 | DefaultProfile:
4 | ExcludeAsset: false
5 | Name: null
6 | Platform: Undefined
7 | ExportAsRaw: false
8 | MaterialInfo:
9 | Id: 1b6b6beb-85e5-42c7-8ada-61f59e3bd6f4
10 | ActiveDirectives:
11 | - LIT
12 | - IBL
13 | AllowInstancing: false
14 | EffectID: daa1f60a-82ad-40fc-8fbb-7b85caa6de0a
15 | Layer: 0db59561-b3f5-444f-b5de-e62e3a5b42bf
16 | OrderBias: 0
17 | Parameters:
18 | - Name: BaseColor
19 | Type: Evergine.Mathematics.Vector3,Evergine.Mathematics
20 | ValueByteArray: AACAPwj11T4AAAAA
21 | - Name: EmissiveColor
22 | Type: Evergine.Mathematics.Vector3,Evergine.Mathematics
23 | ValueByteArray: AAAAAAAAAAAAAAAA
24 | - Name: Alpha
25 | Type: System.Single
26 | ValueByteArray: AACAPw==
27 | - Name: Metallic
28 | Type: System.Single
29 | ValueByteArray: AAAAAA==
30 | - Name: Roughness
31 | Type: System.Single
32 | ValueByteArray: KVwPPg==
33 | - Name: ReferenceAlpha
34 | Type: System.Single
35 | ValueByteArray: AAAAAA==
36 | Samplers: []
37 | Textures: []
38 | Profiles: {}
39 |
--------------------------------------------------------------------------------
/Content/Models/scene_Embedded/Materials/metal_bright.wemt:
--------------------------------------------------------------------------------
1 | !Evergine.Assets.Exporters.MaterialMetaFile,Evergine.Assets
2 | Id: 22fe1a38-6f62-4cfc-9fed-ee4660a4536a
3 | DefaultProfile:
4 | ExcludeAsset: false
5 | Name: null
6 | Platform: Undefined
7 | ExportAsRaw: false
8 | MaterialInfo:
9 | Id: a5b394bd-9e0e-4a91-baf8-094e23ea318d
10 | ActiveDirectives:
11 | - LIT
12 | - IBL
13 | AllowInstancing: false
14 | EffectID: daa1f60a-82ad-40fc-8fbb-7b85caa6de0a
15 | Layer: 0db59561-b3f5-444f-b5de-e62e3a5b42bf
16 | OrderBias: 0
17 | Parameters:
18 | - Name: BaseColor
19 | Type: Evergine.Mathematics.Vector3,Evergine.Mathematics
20 | ValueByteArray: zcxMP+VgPj+Rmyk/
21 | - Name: EmissiveColor
22 | Type: Evergine.Mathematics.Vector3,Evergine.Mathematics
23 | ValueByteArray: AAAAAAAAAAAAAAAA
24 | - Name: Alpha
25 | Type: System.Single
26 | ValueByteArray: AACAPw==
27 | - Name: Metallic
28 | Type: System.Single
29 | ValueByteArray: AACAPw==
30 | - Name: Roughness
31 | Type: System.Single
32 | ValueByteArray: DmH4PQ==
33 | - Name: ReferenceAlpha
34 | Type: System.Single
35 | ValueByteArray: AAAAAA==
36 | Samplers: []
37 | Textures: []
38 | Profiles: {}
39 |
--------------------------------------------------------------------------------
/Content/Models/scene_Embedded/Materials/metal_dark.wemt:
--------------------------------------------------------------------------------
1 | !Evergine.Assets.Exporters.MaterialMetaFile,Evergine.Assets
2 | Id: 91a1069e-669a-4cc2-b4dd-4a76ee651661
3 | DefaultProfile:
4 | ExcludeAsset: false
5 | Name: null
6 | Platform: Undefined
7 | ExportAsRaw: false
8 | MaterialInfo:
9 | Id: 073f465c-44d0-4a80-9436-d2cc9f235fe3
10 | ActiveDirectives:
11 | - LIT
12 | - IBL
13 | AllowInstancing: false
14 | EffectID: daa1f60a-82ad-40fc-8fbb-7b85caa6de0a
15 | Layer: 0db59561-b3f5-444f-b5de-e62e3a5b42bf
16 | OrderBias: 0
17 | Parameters:
18 | - Name: BaseColor
19 | Type: Evergine.Mathematics.Vector3,Evergine.Mathematics
20 | ValueByteArray: 7nn+PO55/jzuef48
21 | - Name: EmissiveColor
22 | Type: Evergine.Mathematics.Vector3,Evergine.Mathematics
23 | ValueByteArray: AAAAAAAAAAAAAAAA
24 | - Name: Alpha
25 | Type: System.Single
26 | ValueByteArray: AACAPw==
27 | - Name: Metallic
28 | Type: System.Single
29 | ValueByteArray: AACAPw==
30 | - Name: Roughness
31 | Type: System.Single
32 | ValueByteArray: qbeBPg==
33 | - Name: ReferenceAlpha
34 | Type: System.Single
35 | ValueByteArray: AAAAAA==
36 | Samplers: []
37 | Textures: []
38 | Profiles: {}
39 |
--------------------------------------------------------------------------------
/Content/Models/scene_Embedded/Materials/metal_mid.wemt:
--------------------------------------------------------------------------------
1 | !Evergine.Assets.Exporters.MaterialMetaFile,Evergine.Assets
2 | Id: 6c351fe7-5428-453a-a33b-f651ae470e29
3 | DefaultProfile:
4 | ExcludeAsset: false
5 | Name: null
6 | Platform: Undefined
7 | ExportAsRaw: false
8 | MaterialInfo:
9 | Id: 60382c48-e291-42c8-a173-ade211203c59
10 | ActiveDirectives:
11 | - LIT
12 | - IBL
13 | AllowInstancing: false
14 | EffectID: daa1f60a-82ad-40fc-8fbb-7b85caa6de0a
15 | Layer: 0db59561-b3f5-444f-b5de-e62e3a5b42bf
16 | OrderBias: 0
17 | Parameters:
18 | - Name: BaseColor
19 | Type: Evergine.Mathematics.Vector3,Evergine.Mathematics
20 | ValueByteArray: V7FIPlexSD5XsUg+
21 | - Name: EmissiveColor
22 | Type: Evergine.Mathematics.Vector3,Evergine.Mathematics
23 | ValueByteArray: AAAAAAAAAAAAAAAA
24 | - Name: Alpha
25 | Type: System.Single
26 | ValueByteArray: AACAPw==
27 | - Name: Metallic
28 | Type: System.Single
29 | ValueByteArray: AACAPw==
30 | - Name: Roughness
31 | Type: System.Single
32 | ValueByteArray: OCZwPg==
33 | - Name: ReferenceAlpha
34 | Type: System.Single
35 | ValueByteArray: AAAAAA==
36 | Samplers: []
37 | Textures: []
38 | Profiles: {}
39 |
--------------------------------------------------------------------------------
/Content/Models/scene_Embedded/Materials/plastic_cone_black.wemt:
--------------------------------------------------------------------------------
1 | !Evergine.Assets.Exporters.MaterialMetaFile,Evergine.Assets
2 | Id: d9a9f4d9-f4fd-46a5-a433-8869f4475242
3 | DefaultProfile:
4 | ExcludeAsset: false
5 | Name: null
6 | Platform: Undefined
7 | ExportAsRaw: false
8 | MaterialInfo:
9 | Id: 80e198a8-bba4-4222-b810-970a635dc422
10 | ActiveDirectives:
11 | - LIT
12 | - IBL
13 | AllowInstancing: false
14 | EffectID: daa1f60a-82ad-40fc-8fbb-7b85caa6de0a
15 | Layer: 0db59561-b3f5-444f-b5de-e62e3a5b42bf
16 | OrderBias: 0
17 | Parameters:
18 | - Name: BaseColor
19 | Type: Evergine.Mathematics.Vector3,Evergine.Mathematics
20 | ValueByteArray: It8lOyLfJTsi3yU7
21 | - Name: EmissiveColor
22 | Type: Evergine.Mathematics.Vector3,Evergine.Mathematics
23 | ValueByteArray: AAAAAAAAAAAAAAAA
24 | - Name: Alpha
25 | Type: System.Single
26 | ValueByteArray: AACAPw==
27 | - Name: Metallic
28 | Type: System.Single
29 | ValueByteArray: AAAAAA==
30 | - Name: Roughness
31 | Type: System.Single
32 | ValueByteArray: dkUpPg==
33 | - Name: ReferenceAlpha
34 | Type: System.Single
35 | ValueByteArray: AAAAAA==
36 | Samplers: []
37 | Textures: []
38 | Profiles: {}
39 |
--------------------------------------------------------------------------------
/Content/Models/scene_Embedded/Materials/plastic_grey.wemt:
--------------------------------------------------------------------------------
1 | !Evergine.Assets.Exporters.MaterialMetaFile,Evergine.Assets
2 | Id: 4e1e89d7-f07a-475e-ad11-2460207d4b8d
3 | DefaultProfile:
4 | ExcludeAsset: false
5 | Name: null
6 | Platform: Undefined
7 | ExportAsRaw: false
8 | MaterialInfo:
9 | Id: 4adde616-5b6c-494a-8627-0a1c7f83f999
10 | ActiveDirectives:
11 | - LIT
12 | - IBL
13 | AllowInstancing: false
14 | EffectID: daa1f60a-82ad-40fc-8fbb-7b85caa6de0a
15 | Layer: 0db59561-b3f5-444f-b5de-e62e3a5b42bf
16 | OrderBias: 0
17 | Parameters:
18 | - Name: BaseColor
19 | Type: Evergine.Mathematics.Vector3,Evergine.Mathematics
20 | ValueByteArray: 3J9rPtyfaz7cn2s+
21 | - Name: EmissiveColor
22 | Type: Evergine.Mathematics.Vector3,Evergine.Mathematics
23 | ValueByteArray: AAAAAAAAAAAAAAAA
24 | - Name: Alpha
25 | Type: System.Single
26 | ValueByteArray: AACAPw==
27 | - Name: Metallic
28 | Type: System.Single
29 | ValueByteArray: AAAAAA==
30 | - Name: Roughness
31 | Type: System.Single
32 | ValueByteArray: DWQcPg==
33 | - Name: ReferenceAlpha
34 | Type: System.Single
35 | ValueByteArray: AAAAAA==
36 | Samplers: []
37 | Textures: []
38 | Profiles: {}
39 |
--------------------------------------------------------------------------------
/Content/Scenes.wedir:
--------------------------------------------------------------------------------
1 | !Evergine.Assets.Exporters.DirectoryMetaFile,Evergine.Assets
2 | DefaultProfile:
3 | ExcludeAsset: false
4 | Name: null
5 | OutputName: null
6 | Platform: Undefined
7 | Id: f9eeba63-78a8-45d2-a434-9df129b69392
8 | Profiles: {}
9 |
--------------------------------------------------------------------------------
/Content/Scenes/MyScene.wescene.wesc:
--------------------------------------------------------------------------------
1 | !Evergine.Assets.Exporters.SceneMetaFile,Evergine.Assets
2 | Id: 760b2dad-8a54-4cd1-9158-5da1b99358e8
3 | DefaultProfile:
4 | ExcludeAsset: false
5 | Name: null
6 | Platform: Undefined
7 | ExportAsRaw: false
8 | Profiles: {}
9 | Source:
10 | Header:
11 | Id: 05234673-871f-4a45-828b-ad26a2cf56a7
12 | IsCompressed: true
13 | LastModified: 0001-01-01T00:00:00.0000000
14 | SceneData:
15 | Id: 1f9bdd7c-ef51-44cd-bb5a-daf97ff0bcaf
16 |
--------------------------------------------------------------------------------
/Content/Scenes/MyScene/Environment.wedir:
--------------------------------------------------------------------------------
1 | !Evergine.Assets.Exporters.DirectoryMetaFile,Evergine.Assets
2 | Id: 39a008c7-2977-4dc1-85dd-4283083ff8d9
3 | DefaultProfile:
4 | ExcludeAsset: false
5 | Name: null
6 | OutputName: null
7 | Platform: Undefined
8 | ExportAsRaw: false
9 | Profiles: {}
10 |
--------------------------------------------------------------------------------
/Content/Scenes/MyScene/Environment/SceneReflectionProbe.werp:
--------------------------------------------------------------------------------
1 | !Evergine.Assets.Exporters.ReflectionProbeMetaFile,Evergine.Assets
2 | Id: cb4c9738-03a0-494f-a839-20a22581fb59
3 | DefaultProfile:
4 | ExcludeAsset: false
5 | Name: default
6 | Platform: Undefined
7 | ExportAsRaw: false
8 | Profiles: {}
9 | SHCoefficients: null
10 |
--------------------------------------------------------------------------------
/Content/Scenes/MyScene/Environment/SceneReflectionProbe/Irradiance.texdmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EvergineTeam/UIWindowSystemsDemo/f2d68c6daa0acf4def7593c3a7f75077fecd722b/Content/Scenes/MyScene/Environment/SceneReflectionProbe/Irradiance.texdmp
--------------------------------------------------------------------------------
/Content/Scenes/MyScene/Environment/SceneReflectionProbe/Irradiance.texdmp.wetx:
--------------------------------------------------------------------------------
1 | !Evergine.Assets.Exporters.TextureMetaFile,Evergine.Assets
2 | Id: ff1efe11-6f7e-42ca-8e6f-e417875fb91a
3 | DefaultProfile:
4 | ExcludeAsset: false
5 | ExportedItem: null
6 | Name: default
7 | PixelFormat: R8G8B8A8_UNorm
8 | Platform: Undefined
9 | ScaledHeight: 32
10 | ScaledPercentage: 1.0
11 | ScaledWidth: 32
12 | ScalingType: Original
13 | ExportAsRaw: false
14 | GenerateMipMaps: true
15 | NinePatchType: None
16 | PremultipliedAlpha: true
17 | Profiles: {}
18 | SamplerID: 00000000-0000-0000-0000-000000000000
19 | Source:
20 | Header:
21 | Id: 14e4659d-6b67-4248-b7eb-1b2f89391318
22 | IsCompressed: true
23 | LastModified: 0001-01-01T00:00:00.0000000
24 | TextureInfo:
25 | Id: b4ecfc26-e2fb-4260-8c48-3c9c2c1898cb
26 | Description:
27 | ArraySize: 1
28 | CpuAccess: None
29 | Depth: 1
30 | Faces: 6
31 | Flags: ShaderResource, UnorderedAccess
32 | Format: R8G8B8A8_UNorm
33 | Height: 32
34 | MipLevels: 1
35 | SampleCount: None
36 | Type: TextureCube
37 | Usage: Default
38 | Width: 32
39 | HasData: true
40 | SamplerID: 9018edf8-ea96-4721-bf83-5561942432e0
41 |
--------------------------------------------------------------------------------
/Content/Scenes/MyScene/Environment/SceneReflectionProbe/Radiance.texdmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EvergineTeam/UIWindowSystemsDemo/f2d68c6daa0acf4def7593c3a7f75077fecd722b/Content/Scenes/MyScene/Environment/SceneReflectionProbe/Radiance.texdmp
--------------------------------------------------------------------------------
/Content/Scenes/MyScene/Environment/SceneReflectionProbe/Radiance.texdmp.wetx:
--------------------------------------------------------------------------------
1 | !Evergine.Assets.Exporters.TextureMetaFile,Evergine.Assets
2 | Id: d0e7bc4b-3c46-45e2-a97d-8229da67bb4d
3 | DefaultProfile:
4 | ExcludeAsset: false
5 | ExportedItem: null
6 | Name: default
7 | PixelFormat: R8G8B8A8_UNorm
8 | Platform: Undefined
9 | ScaledHeight: 128
10 | ScaledPercentage: 1.0
11 | ScaledWidth: 128
12 | ScalingType: Original
13 | ExportAsRaw: false
14 | GenerateMipMaps: true
15 | NinePatchType: None
16 | PremultipliedAlpha: true
17 | Profiles: {}
18 | SamplerID: 00000000-0000-0000-0000-000000000000
19 | Source:
20 | Header:
21 | Id: 2109ca07-92ed-4547-9940-581be93619f6
22 | IsCompressed: true
23 | LastModified: 0001-01-01T00:00:00.0000000
24 | TextureInfo:
25 | Id: 961abd36-bce4-481e-aa42-4106a1904130
26 | Description:
27 | ArraySize: 1
28 | CpuAccess: None
29 | Depth: 1
30 | Faces: 6
31 | Flags: ShaderResource, UnorderedAccess
32 | Format: R8G8B8A8_UNorm
33 | Height: 128
34 | MipLevels: 5
35 | SampleCount: None
36 | Type: TextureCube
37 | Usage: Default
38 | Width: 128
39 | HasData: true
40 | SamplerID: 9018edf8-ea96-4721-bf83-5561942432e0
41 |
--------------------------------------------------------------------------------
/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(DefineConstants);$(AdditionalDefineConstants)
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Images/FormsSample.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EvergineTeam/UIWindowSystemsDemo/f2d68c6daa0acf4def7593c3a7f75077fecd722b/Images/FormsSample.png
--------------------------------------------------------------------------------
/Images/MAUISample.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EvergineTeam/UIWindowSystemsDemo/f2d68c6daa0acf4def7593c3a7f75077fecd722b/Images/MAUISample.png
--------------------------------------------------------------------------------
/Images/SDLSample.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EvergineTeam/UIWindowSystemsDemo/f2d68c6daa0acf4def7593c3a7f75077fecd722b/Images/SDLSample.png
--------------------------------------------------------------------------------
/Images/WinUISample.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EvergineTeam/UIWindowSystemsDemo/f2d68c6daa0acf4def7593c3a7f75077fecd722b/Images/WinUISample.png
--------------------------------------------------------------------------------
/Images/WpfSample.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EvergineTeam/UIWindowSystemsDemo/f2d68c6daa0acf4def7593c3a7f75077fecd722b/Images/WpfSample.png
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 WaveEngine Team
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # UI API integrations Demo
2 |
3 | This demo shows how you can integrate Evergine in an application using the WindowSystem. The Windows Forms, SDL and UWP samples use the full window to render the application, the WPF, WinUI and MAUI samples demonstrate a way to include a Evergine renderer and how it can interact with WPF controls.
4 |
5 | Video: https://www.youtube.com/watch?v=MOgKXaxselg
6 |
7 | 
8 |
9 | 
10 |
11 | 
12 |
13 | 
14 |
15 | 
16 |
17 | ## Extended samples
18 | Some of windows system samples provide additional features.
19 | - **WPF**: You have the option in _App.xaml_ file to choose between creating a single window with two rendering surfaces, or create two windows, and each one of them with an independent rendering surface.
20 | - **WinForms**: Changing value of _ShowSingleWindowSample_ you can test a rendering surface for the full window, or have a rendering surface that can be with other native UI elements.
21 |
22 | ## Build and Test
23 |
24 | Required Visual Studio 2022 with .NET6 support and .NET7 support.
25 |
26 | You can also test the binaries in the [Releases](https://github.com/Evergine/UIWindowSystemsDemo/releases) section.
27 |
28 | ----
29 | Powered by **[Evergine](http://www.evergine.com)**
30 |
31 | LET'S CONNECT!
32 |
33 | - [Youtube](https://www.youtube.com/c/Evergine)
34 | - [Twitter](https://x.com/EvergineTeam)
35 | - [Blog](https://evergine.com/news/)
36 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.Editor/MyCustomClassEditor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Evergine.Common.Graphics;
3 | using Evergine.Editor.Extension;
4 | using Evergine.Editor.Extension.Attributes;
5 |
6 | namespace UIWindowSystemsDemo
7 | {
8 | // Sample class for a custom Property editor.
9 | // This property editor will be used for a property or field of type MyCustomClass when is used in a component of an entity.
10 | //
11 | // [CustomPropertyEditor(typeof(MyCustomClass))]
12 | // public class MyCustomClassEditor : PropertyEditor
13 | // {
14 | // MyCustomClass property;
15 | //
16 | // protected override void Loaded()
17 | // {
18 | // this.property = this.GetMemberValue();
19 | // }
20 | //
21 | // public override void GenerateUI()
22 | // {
23 | // // Add MyCustomClass properties.
24 | // this.propertyPanelContainer.AddLabel("MyLabel", "My label");
25 | // this.propertyPanelContainer.AddNumeric(nameof(MyCustomClass.Number), nameof(MyCustomClass.Number), getValue: () => property.Number, setValue: x => property.Number = x);
26 | // this.propertyPanelContainer.AddText(nameof(MyCustomClass.String), nameof(MyCustomClass.String), () => property.String, x => property.String = x);
27 | // }
28 | // }
29 | }
30 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.Editor/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using Evergine.Common.Attributes;
2 |
3 | [assembly: EvergineAssembly(EvergineAssemblyUsage.Editor)]
4 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.Editor/UIWindowSystemsDemo.Editor.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net8.0
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.7.34024.191
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UIWindowSystemsDemo.MAUI", "UIWindowSystemsDemo.MAUI\UIWindowSystemsDemo.MAUI.csproj", "{BCFD4FD5-36DA-421D-A0CF-6331EDB95BEB}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UIWindowSystemsDemo", "UIWindowSystemsDemo\UIWindowSystemsDemo.csproj", "{6DEA9C6A-667D-49F8-89FA-40A1F595B48B}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {BCFD4FD5-36DA-421D-A0CF-6331EDB95BEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {BCFD4FD5-36DA-421D-A0CF-6331EDB95BEB}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {BCFD4FD5-36DA-421D-A0CF-6331EDB95BEB}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
19 | {BCFD4FD5-36DA-421D-A0CF-6331EDB95BEB}.Release|Any CPU.ActiveCfg = Release|Any CPU
20 | {BCFD4FD5-36DA-421D-A0CF-6331EDB95BEB}.Release|Any CPU.Build.0 = Release|Any CPU
21 | {BCFD4FD5-36DA-421D-A0CF-6331EDB95BEB}.Release|Any CPU.Deploy.0 = Release|Any CPU
22 | {6DEA9C6A-667D-49F8-89FA-40A1F595B48B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {6DEA9C6A-667D-49F8-89FA-40A1F595B48B}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {6DEA9C6A-667D-49F8-89FA-40A1F595B48B}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {6DEA9C6A-667D-49F8-89FA-40A1F595B48B}.Release|Any CPU.Build.0 = Release|Any CPU
26 | EndGlobalSection
27 | GlobalSection(SolutionProperties) = preSolution
28 | HideSolutionNode = FALSE
29 | EndGlobalSection
30 | GlobalSection(ExtensibilityGlobals) = postSolution
31 | SolutionGuid = {F925F91C-69BD-48DC-A39A-63F045514047}
32 | EndGlobalSection
33 | EndGlobal
34 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/App.xaml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/App.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace UIWindowSystemsDemo.MAUI
2 | {
3 | public partial class App : Application
4 | {
5 | public App()
6 | {
7 | InitializeComponent();
8 |
9 | MainPage = new AppShell();
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/AppShell.xaml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/AppShell.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace UIWindowSystemsDemo.MAUI
2 | {
3 | public partial class AppShell : Shell
4 | {
5 | public AppShell()
6 | {
7 | InitializeComponent();
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Evergine/AppBuilderExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace UIWindowSystemsDemo.MAUI.Evergine
2 | {
3 | internal static class AppBuilderExtensions
4 | {
5 | public static MauiAppBuilder UseMauiEvergine(this MauiAppBuilder builder)
6 | {
7 | builder.ConfigureMauiHandlers(h =>
8 | {
9 | h.AddHandler();
10 | });
11 |
12 | return builder;
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Evergine/EvergineView.cs:
--------------------------------------------------------------------------------
1 | using EvergineApplication = global::Evergine.Framework.Application;
2 |
3 | namespace UIWindowSystemsDemo.MAUI.Evergine
4 | {
5 | public class EvergineView : View
6 | {
7 | public static readonly BindableProperty ApplicationProperty =
8 | BindableProperty.Create(nameof(Application), typeof(EvergineApplication), typeof(EvergineView), null);
9 |
10 | public static readonly BindableProperty DisplayNameProperty =
11 | BindableProperty.Create(nameof(DisplayName), typeof(string), typeof(EvergineView), string.Empty);
12 |
13 | public EvergineApplication Application
14 | {
15 | get { return (EvergineApplication)this.GetValue(ApplicationProperty); }
16 | set { this.SetValue(ApplicationProperty, value); }
17 | }
18 |
19 | public string DisplayName
20 | {
21 | get { return (string)this.GetValue(DisplayNameProperty); }
22 | set { this.SetValue(DisplayNameProperty, value); }
23 | }
24 |
25 | public event EventHandler PointerPressed;
26 |
27 | public event EventHandler PointerMoved;
28 |
29 | public event EventHandler PointerReleased;
30 |
31 | internal void StartInteraction() => this.PointerPressed?.Invoke(this, EventArgs.Empty);
32 |
33 | internal void MovedInteraction() => this.PointerMoved?.Invoke(this, EventArgs.Empty);
34 |
35 | internal void EndInteraction() => this.PointerReleased?.Invoke(this, EventArgs.Empty);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Evergine/EvergineViewHandler.cs:
--------------------------------------------------------------------------------
1 | namespace UIWindowSystemsDemo.MAUI.Evergine
2 | {
3 | public partial class EvergineViewHandler
4 | {
5 | public static IPropertyMapper PropertyMapper = new PropertyMapper(ViewMapper)
6 | {
7 | [nameof(EvergineView.Application)] = MapApplication,
8 | };
9 |
10 | public static CommandMapper CommandMapper = new(ViewCommandMapper);
11 |
12 | public EvergineViewHandler()
13 | : base(PropertyMapper, CommandMapper)
14 | {
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
36 |
40 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
81 |
82 |
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using Evergine.Common.Input.Mouse;
2 | using UIWindowSystemsDemo;
3 |
4 | namespace UIWindowSystemsDemo.MAUI
5 | {
6 | public partial class MainPage : ContentPage
7 | {
8 | private readonly MyApplication evergineApplication;
9 | private InteractionService interactionService;
10 |
11 | public MainPage()
12 | {
13 | InitializeComponent();
14 | this.evergineApplication = new MyApplication();
15 | this.evergineView1.DisplayName = "DefaultDisplay";
16 | this.evergineView1.Application = this.evergineApplication;
17 |
18 | RegisterInteractionService();
19 | }
20 |
21 | private void RegisterInteractionService()
22 | {
23 | interactionService = new InteractionService();
24 | evergineApplication.Container.RegisterInstance(interactionService);
25 | }
26 |
27 | private void ResetCameraClick(object sender, EventArgs e)
28 | {
29 | interactionService.ResetCamera();
30 | }
31 |
32 | private void DisplacementChanged(object sender, ValueChangedEventArgs e)
33 | {
34 | interactionService.Displacement = (float)e.NewValue;
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/MauiProgram.cs:
--------------------------------------------------------------------------------
1 | using UIWindowSystemsDemo.MAUI.Evergine;
2 | using Microsoft.Extensions.Logging;
3 |
4 | namespace UIWindowSystemsDemo.MAUI
5 | {
6 | public static class MauiProgram
7 | {
8 | public static MauiApp CreateMauiApp()
9 | {
10 | var builder = MauiApp.CreateBuilder();
11 | builder
12 | .UseMauiApp()
13 | .UseMauiEvergine()
14 | .ConfigureFonts(fonts =>
15 | {
16 | fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
17 | fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
18 | });
19 |
20 | #if DEBUG
21 | builder.Logging.AddDebug();
22 | #endif
23 |
24 | return builder.Build();
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Platforms/Android/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Platforms/Android/EvergineViewHandler.Android.cs:
--------------------------------------------------------------------------------
1 | using UIWindowSystemsDemo.MAUI.Evergine;
2 | using Evergine.Android;
3 | using Evergine.Common.Graphics;
4 | using Evergine.Framework.Services;
5 | using Evergine.Vulkan;
6 | using Microsoft.Maui.Handlers;
7 | using Evergine.OpenAL;
8 | using Evergine.Framework.Threading;
9 |
10 | namespace UIWindowSystemsDemo.MAUI.Evergine
11 | {
12 | public partial class EvergineViewHandler : ViewHandler
13 | {
14 | private AndroidSurface androidSurface;
15 | private static AndroidWindowsSystem windowsSystem;
16 |
17 | public EvergineViewHandler(IPropertyMapper mapper, CommandMapper commandMapper = null)
18 | : base(mapper, commandMapper)
19 | {
20 | }
21 |
22 | public static void MapApplication(EvergineViewHandler handler, EvergineView evergineView)
23 | {
24 | handler.UpdateApplication(evergineView, evergineView.DisplayName);
25 | }
26 |
27 | internal void UpdateApplication(EvergineView view, string displayName)
28 | {
29 | if (view.Application is null)
30 | {
31 | return;
32 | }
33 |
34 | // Register Windows system
35 | var windowSystemCreated = false;
36 | var registeredWindowSystem = view.Application.Container.Resolve();
37 | if (registeredWindowSystem == null)
38 | {
39 | view.Application.Container.RegisterInstance(windowsSystem);
40 | windowSystemCreated = true;
41 | }
42 |
43 | // Creates XAudio device
44 | var xaudio = view.Application.Container.Resolve();
45 | if (xaudio == null)
46 | {
47 | xaudio = new ALAudioDevice();
48 | view.Application.Container.RegisterInstance(xaudio);
49 | }
50 |
51 | if (windowSystemCreated)
52 | {
53 | System.Diagnostics.Stopwatch clockTimer = System.Diagnostics.Stopwatch.StartNew();
54 | windowsSystem.Run(
55 | () =>
56 | {
57 | this.ConfigureGraphicsContext(view.Application as MyApplication, this.androidSurface, displayName);
58 | view.Application.Initialize();
59 | },
60 | () =>
61 | {
62 | var gameTime = clockTimer.Elapsed;
63 | clockTimer.Restart();
64 |
65 | view.Application.UpdateFrame(gameTime);
66 | view.Application.DrawFrame(gameTime);
67 | });
68 | }
69 | else
70 | {
71 | EvergineForegroundTask.Run(() =>
72 | {
73 | this.ConfigureGraphicsContext(view.Application as MyApplication, this.androidSurface, displayName);
74 | });
75 | }
76 | }
77 |
78 | protected override AndroidSurfaceView CreatePlatformView()
79 | {
80 | if (windowsSystem == null)
81 | {
82 | windowsSystem = new AndroidWindowsSystem(this.Context);
83 | }
84 |
85 | this.androidSurface = windowsSystem.CreateSurface(0, 0) as AndroidSurface;
86 | return this.androidSurface.NativeSurface;
87 | }
88 |
89 | private void ConfigureGraphicsContext(MyApplication application, Surface surface, string displayName)
90 | {
91 | var graphicsContext = application.Container.Resolve();
92 | if (graphicsContext == null)
93 | {
94 | graphicsContext = new VKGraphicsContext();
95 | graphicsContext.CreateDevice();
96 |
97 | application.Container.RegisterInstance(graphicsContext);
98 | }
99 |
100 | SwapChainDescription swapChainDescription = new SwapChainDescription()
101 | {
102 | SurfaceInfo = surface.SurfaceInfo,
103 | Width = surface.Width,
104 | Height = surface.Height,
105 | ColorTargetFormat = PixelFormat.R8G8B8A8_UNorm,
106 | ColorTargetFlags = TextureFlags.RenderTarget | TextureFlags.ShaderResource,
107 | DepthStencilTargetFormat = PixelFormat.D24_UNorm_S8_UInt,
108 | DepthStencilTargetFlags = TextureFlags.DepthStencil,
109 | SampleCount = TextureSampleCount.None,
110 | IsWindowed = true,
111 | RefreshRate = 60,
112 | };
113 | var swapChain = graphicsContext.CreateSwapChain(swapChainDescription);
114 | swapChain.VerticalSync = true;
115 |
116 | var graphicsPresenter = application.Container.Resolve();
117 | var firstDisplay = new global::Evergine.Framework.Graphics.Display(surface, swapChain);
118 | graphicsPresenter.RemoveDisplay(displayName);
119 | graphicsPresenter.AddDisplay(displayName, firstDisplay);
120 |
121 | surface.OnScreenSizeChanged += (_, args) =>
122 | {
123 | swapChain.ResizeSwapChain(args.Height, args.Width);
124 | };
125 | }
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Platforms/Android/MainActivity.cs:
--------------------------------------------------------------------------------
1 | using Android.App;
2 | using Android.Content.PM;
3 | using Android.OS;
4 |
5 | namespace UIWindowSystemsDemo.MAUI
6 | {
7 | [Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
8 | public class MainActivity : MauiAppCompatActivity
9 | {
10 | }
11 | }
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Platforms/Android/MainApplication.cs:
--------------------------------------------------------------------------------
1 | using Android.App;
2 | using Android.Runtime;
3 |
4 | namespace UIWindowSystemsDemo.MAUI
5 | {
6 | [Application]
7 | public class MainApplication : MauiApplication
8 | {
9 | public MainApplication(IntPtr handle, JniHandleOwnership ownership)
10 | : base(handle, ownership)
11 | {
12 | }
13 |
14 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
15 | }
16 | }
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Platforms/Android/Resources/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #512BD4
4 | #2B0B98
5 | #2B0B98
6 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Platforms/Android/linker.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Platforms/Windows/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Platforms/Windows/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.UI.Xaml;
2 |
3 | // To learn more about WinUI, the WinUI project structure,
4 | // and more about our project templates, see: http://aka.ms/winui-project-info.
5 |
6 | namespace UIWindowSystemsDemo.MAUI.WinUI
7 | {
8 | ///
9 | /// Provides application-specific behavior to supplement the default Application class.
10 | ///
11 | public partial class App : MauiWinUIApplication
12 | {
13 | ///
14 | /// Initializes the singleton application object. This is the first line of authored code
15 | /// executed, and as such is the logical equivalent of main() or WinMain().
16 | ///
17 | public App()
18 | {
19 | this.InitializeComponent();
20 | }
21 |
22 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
23 | }
24 | }
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Platforms/Windows/EvergineViewHandler.Windows.cs:
--------------------------------------------------------------------------------
1 | using Evergine.Common.Graphics;
2 | using Evergine.DirectX11;
3 | using Evergine.Framework.Graphics;
4 | using Evergine.Framework.Services;
5 | using Evergine.WinUI;
6 | using Microsoft.Maui.Handlers;
7 | using Microsoft.UI.Xaml;
8 | using Microsoft.UI.Xaml.Controls;
9 | using System.Diagnostics;
10 | using WinUIGrid = Microsoft.UI.Xaml.Controls.Grid;
11 |
12 | namespace UIWindowSystemsDemo.MAUI.Evergine
13 | {
14 | public partial class EvergineViewHandler : ViewHandler
15 | {
16 | private bool isViewLoaded;
17 |
18 | private SwapChainPanel swapChainPanel;
19 |
20 | private bool isEvergineInitialized;
21 |
22 | public EvergineViewHandler(IPropertyMapper mapper, CommandMapper commandMapper = null)
23 | : base(mapper, commandMapper)
24 | {
25 | }
26 |
27 | public static void MapApplication(EvergineViewHandler handler, EvergineView evergineView)
28 | {
29 | if (!handler.isViewLoaded)
30 | {
31 | return;
32 | }
33 |
34 | handler.UpdateApplication(handler.swapChainPanel, evergineView, evergineView.DisplayName);
35 | }
36 |
37 | protected override WinUIGrid CreatePlatformView()
38 | {
39 | var platformView = new WinUIGrid();
40 |
41 | this.swapChainPanel = new SwapChainPanel
42 | {
43 | IsHitTestVisible = true,
44 | IsTabStop = true,
45 | };
46 |
47 | platformView.Children.Add(this.swapChainPanel);
48 |
49 | return platformView;
50 | }
51 |
52 | protected override void ConnectHandler(WinUIGrid platformView)
53 | {
54 | base.ConnectHandler(platformView);
55 |
56 | this.isViewLoaded = false;
57 |
58 | platformView.Loaded += this.OnPlatformViewLoaded;
59 |
60 | this.swapChainPanel.PointerPressed += this.OnPlatformViewPointerPressed;
61 | this.swapChainPanel.PointerMoved += this.OnPlatformViewPointerMoved;
62 | this.swapChainPanel.PointerReleased += this.OnPlatformViewPointerReleased;
63 | }
64 |
65 | protected override void DisconnectHandler(WinUIGrid platformView)
66 | {
67 | base.DisconnectHandler(platformView);
68 |
69 | platformView.Loaded -= this.OnPlatformViewLoaded;
70 |
71 | this.swapChainPanel.PointerPressed -= this.OnPlatformViewPointerPressed;
72 | this.swapChainPanel.PointerMoved -= this.OnPlatformViewPointerMoved;
73 | this.swapChainPanel.PointerReleased -= this.OnPlatformViewPointerReleased;
74 |
75 | this.swapChainPanel = null;
76 | }
77 |
78 | private void OnPlatformViewLoaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
79 | {
80 | this.isViewLoaded = true;
81 | this.UpdateValue(nameof(EvergineView.Application));
82 | }
83 |
84 | private void OnPlatformViewPointerReleased(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)
85 | {
86 | ((SwapChainPanel)sender).ReleasePointerCaptures();
87 | this.VirtualView.StartInteraction();
88 | }
89 |
90 | private void OnPlatformViewPointerMoved(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)
91 | {
92 | this.VirtualView.MovedInteraction();
93 | }
94 |
95 | private void OnPlatformViewPointerPressed(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)
96 | {
97 | ((SwapChainPanel)sender).Focus(FocusState.Pointer);
98 | ((SwapChainPanel)sender).CapturePointer(e.Pointer);
99 | this.VirtualView.EndInteraction();
100 | }
101 |
102 | private void UpdateApplication(SwapChainPanel swapChainPanel, EvergineView view, string displayName)
103 | {
104 | if (view.Application is null || this.isEvergineInitialized)
105 | {
106 | return;
107 | }
108 |
109 | var graphicsContext = view.Application.Container.Resolve();
110 | if (graphicsContext == null)
111 | {
112 | graphicsContext = new DX11GraphicsContext();
113 | view.Application.Container.RegisterInstance(graphicsContext);
114 | graphicsContext.CreateDevice();
115 | }
116 |
117 | // Create Services
118 | var windowSystemCreated = false;
119 | var windowsSystem = view.Application.Container.Resolve();
120 | if (windowsSystem == null)
121 | {
122 | windowsSystem = new WinUIWindowsSystem();
123 | view.Application.Container.RegisterInstance(windowsSystem);
124 | windowSystemCreated = true;
125 | }
126 |
127 | var surface = (WinUISurface)windowsSystem.CreateSurface(swapChainPanel);
128 | this.ConfigureGraphicsContext(view.Application, surface, displayName);
129 |
130 | if (windowSystemCreated)
131 | {
132 | var clockTimer = Stopwatch.StartNew();
133 | windowsSystem.Run(
134 | view.Application.Initialize,
135 | () =>
136 | {
137 | var gameTime = clockTimer.Elapsed;
138 | clockTimer.Restart();
139 |
140 | view.Application.UpdateFrame(gameTime);
141 | view.Application.DrawFrame(gameTime);
142 | });
143 | }
144 |
145 | this.isEvergineInitialized = true;
146 | }
147 |
148 | private void ConfigureGraphicsContext(global::Evergine.Framework.Application application, WinUISurface surface, string displayName)
149 | {
150 | var graphicsContext = application.Container.Resolve();
151 | var swapChainDescription = new SwapChainDescription()
152 | {
153 | SurfaceInfo = surface.SurfaceInfo,
154 | Width = surface.Width,
155 | Height = surface.Height,
156 | ColorTargetFormat = PixelFormat.R8G8B8A8_UNorm,
157 | ColorTargetFlags = TextureFlags.RenderTarget | TextureFlags.ShaderResource,
158 | DepthStencilTargetFormat = PixelFormat.D24_UNorm_S8_UInt,
159 | DepthStencilTargetFlags = TextureFlags.DepthStencil,
160 | SampleCount = TextureSampleCount.None,
161 | IsWindowed = true,
162 | RefreshRate = 60,
163 | };
164 |
165 | var swapChain = graphicsContext.CreateSwapChain(swapChainDescription);
166 | swapChain.VerticalSync = true;
167 | surface.NativeSurface.SwapChain = swapChain;
168 |
169 | var graphicsPresenter = application.Container.Resolve();
170 | var firstDisplay = new Display(surface, swapChain);
171 | graphicsPresenter.AddDisplay(displayName, firstDisplay);
172 | }
173 | }
174 | }
175 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Platforms/Windows/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | $placeholder$
15 | User Name
16 | $placeholder$.png
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Platforms/Windows/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
11 | true/PM
12 | PerMonitorV2, PerMonitor
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Platforms/iOS/AppDelegate.cs:
--------------------------------------------------------------------------------
1 | using Foundation;
2 |
3 | namespace UIWindowSystemsDemo.MAUI
4 | {
5 | [Register("AppDelegate")]
6 | public class AppDelegate : MauiUIApplicationDelegate
7 | {
8 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
9 | }
10 | }
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Platforms/iOS/EvergineAppViewController.cs:
--------------------------------------------------------------------------------
1 | using Evergine.iOS;
2 | using UIKit;
3 |
4 | namespace UIWindowSystemsDemo.MAUI.Platforms.iOS
5 | {
6 | public partial class EvergineAppViewController : EvergineViewController
7 | {
8 | public event EventHandler OnViewDidLayoutSubviews;
9 |
10 | public EvergineAppViewController(ObjCRuntime.NativeHandle handle) : base(handle)
11 | {
12 | }
13 |
14 | public EvergineAppViewController() : base()
15 | {
16 | }
17 |
18 | public override void LoadView()
19 | {
20 | base.LoadView();
21 | this.View = new UIView();
22 | }
23 |
24 | public override void ViewDidLayoutSubviews()
25 | {
26 | base.ViewDidLayoutSubviews();
27 | this.OnViewDidLayoutSubviews?.Invoke(this, EventArgs.Empty);
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Platforms/iOS/EvergineViewHandler.iOS.cs:
--------------------------------------------------------------------------------
1 | using UIWindowSystemsDemo.MAUI.Platforms.iOS;
2 | using Evergine.Common.Graphics;
3 | using Evergine.Framework.Graphics;
4 | using Evergine.Framework.Services;
5 | using Evergine.iOS;
6 | using Microsoft.Maui.Handlers;
7 | using System.Diagnostics;
8 | using UIKit;
9 | using Evergine.Metal;
10 |
11 | namespace UIWindowSystemsDemo.MAUI.Evergine
12 | {
13 | public partial class EvergineViewHandler : ViewHandler
14 | {
15 | private EvergineAppViewController evergineViewController;
16 | private bool isViewLoaded;
17 | private bool isEvergineInitialized = false;
18 |
19 | public static void MapApplication(EvergineViewHandler handler, EvergineView evergineView)
20 | {
21 | if (!handler.isViewLoaded)
22 | {
23 | return;
24 | }
25 |
26 | handler.UpdateApplication(evergineView);
27 | }
28 |
29 | protected override UIView CreatePlatformView()
30 | {
31 | this.evergineViewController = new EvergineAppViewController();
32 | this.ViewController = this.evergineViewController;
33 |
34 | return this.ViewController.View;
35 | }
36 |
37 | protected override void ConnectHandler(UIView platformView)
38 | {
39 | base.ConnectHandler(platformView);
40 | this.isViewLoaded = false;
41 | this.evergineViewController.OnViewDidLayoutSubviews += this.EvergineViewController_OnViewDidLayoutSubviews;
42 | }
43 |
44 | protected override void DisconnectHandler(UIView platformView)
45 | {
46 | base.DisconnectHandler(platformView);
47 | this.evergineViewController.OnViewDidLayoutSubviews -= this.EvergineViewController_OnViewDidLayoutSubviews;
48 | }
49 |
50 | private void EvergineViewController_OnViewDidLayoutSubviews(object sender, EventArgs e)
51 | {
52 | this.isViewLoaded = true;
53 | this.UpdateValue(nameof(EvergineView.Application));
54 | }
55 |
56 | private void UpdateApplication(EvergineView view)
57 | {
58 | if (view.Application is null || this.isEvergineInitialized)
59 | {
60 | return;
61 | }
62 |
63 | var application = view.Application;
64 |
65 | // Create services
66 | var windowSystemCreated = false;
67 | var windowsSystem = view.Application.Container.Resolve();
68 | if (windowsSystem == null)
69 | {
70 | windowsSystem = new IOSWindowsSystem(this.evergineViewController);
71 | application.Container.RegisterInstance(windowsSystem);
72 | windowSystemCreated = true;
73 | }
74 |
75 | var surface = windowsSystem.CreateSurface(0, 0);
76 | ConfigureGraphicsContext(application, surface, view.DisplayName);
77 |
78 | if (windowSystemCreated)
79 | {
80 | var clockTimer = Stopwatch.StartNew();
81 | windowsSystem.Run(
82 | () =>
83 | {
84 | application.Initialize();
85 | },
86 | () =>
87 | {
88 | var gameTime = clockTimer.Elapsed;
89 | clockTimer.Restart();
90 |
91 | application.UpdateFrame(gameTime);
92 | application.DrawFrame(gameTime);
93 | });
94 |
95 | this.evergineViewController.LoadAction?.Invoke();
96 | }
97 |
98 | this.isEvergineInitialized = true;
99 | }
100 |
101 | private static void ConfigureGraphicsContext(global::Evergine.Framework.Application application, Surface surface, string displayName)
102 | {
103 | var graphicsContext = application.Container.Resolve();
104 | if (graphicsContext == null)
105 | {
106 | graphicsContext = new MTLGraphicsContext();
107 | graphicsContext.CreateDevice();
108 |
109 | application.Container.RegisterInstance(graphicsContext);
110 | }
111 |
112 | SwapChainDescription swapChainDescription = new SwapChainDescription()
113 | {
114 | SurfaceInfo = surface.SurfaceInfo,
115 | Width = surface.Width,
116 | Height = surface.Height,
117 | ColorTargetFormat = PixelFormat.B8G8R8A8_UNorm,
118 | ColorTargetFlags = TextureFlags.RenderTarget | TextureFlags.ShaderResource,
119 | DepthStencilTargetFormat = PixelFormat.D32_Float,
120 | DepthStencilTargetFlags = TextureFlags.DepthStencil,
121 | SampleCount = TextureSampleCount.None,
122 | IsWindowed = true,
123 | RefreshRate = 60,
124 | };
125 | var swapChain = graphicsContext.CreateSwapChain(swapChainDescription);
126 | swapChain.VerticalSync = true;
127 | swapChain.FrameBuffer.IntermediateBufferAssociated = true;
128 |
129 | var graphicsPresenter = application.Container.Resolve();
130 | var firstDisplay = new Display(surface, swapChain);
131 | graphicsPresenter.AddDisplay(displayName, firstDisplay);
132 | }
133 | }
134 | }
135 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Platforms/iOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | LSRequiresIPhoneOS
6 |
7 | UIDeviceFamily
8 |
9 | 1
10 | 2
11 |
12 | UIRequiredDeviceCapabilities
13 |
14 | arm64
15 |
16 | UISupportedInterfaceOrientations
17 |
18 | UIInterfaceOrientationPortrait
19 | UIInterfaceOrientationLandscapeLeft
20 | UIInterfaceOrientationLandscapeRight
21 |
22 | UISupportedInterfaceOrientations~ipad
23 |
24 | UIInterfaceOrientationPortrait
25 | UIInterfaceOrientationPortraitUpsideDown
26 | UIInterfaceOrientationLandscapeLeft
27 | UIInterfaceOrientationLandscapeRight
28 |
29 | XSAppIconAssets
30 | Assets.xcassets/appicon.appiconset
31 |
32 |
33 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Platforms/iOS/Program.cs:
--------------------------------------------------------------------------------
1 | using UIKit;
2 |
3 | namespace UIWindowSystemsDemo.MAUI
4 | {
5 | public class Program
6 | {
7 | // This is the main entry point of the application.
8 | static void Main(string[] args)
9 | {
10 | // if you want to use a different Application Delegate class from "AppDelegate"
11 | // you can specify it here.
12 | UIApplication.Main(args, null, typeof(AppDelegate));
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "Windows Machine": {
4 | "commandName": "MsixPackage",
5 | "nativeDebugging": false
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Resources/AppIcon/appicon.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Resources/AppIcon/appiconfg.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Resources/Fonts/OpenSans-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EvergineTeam/UIWindowSystemsDemo/f2d68c6daa0acf4def7593c3a7f75077fecd722b/UIWindowSystemsDemo.MAUI/Resources/Fonts/OpenSans-Regular.ttf
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Resources/Fonts/OpenSans-Semibold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EvergineTeam/UIWindowSystemsDemo/f2d68c6daa0acf4def7593c3a7f75077fecd722b/UIWindowSystemsDemo.MAUI/Resources/Fonts/OpenSans-Semibold.ttf
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Resources/Images/dotnet_bot.svg:
--------------------------------------------------------------------------------
1 |
94 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Resources/Raw/AboutAssets.txt:
--------------------------------------------------------------------------------
1 | Any raw assets you want to be deployed with your application can be placed in
2 | this directory (and child directories). Deployment of the asset to your application
3 | is automatically handled by the following `MauiAsset` Build Action within your `.csproj`.
4 |
5 |
6 |
7 | These files will be deployed with you package and will be accessible using Essentials:
8 |
9 | async Task LoadMauiAsset()
10 | {
11 | using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt");
12 | using var reader = new StreamReader(stream);
13 |
14 | var contents = reader.ReadToEnd();
15 | }
16 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Resources/Splash/splash.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Resources/Styles/Colors.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 | #512BD4
8 | #DFD8F7
9 | #2B0B98
10 | White
11 | Black
12 | #E1E1E1
13 | #C8C8C8
14 | #ACACAC
15 | #919191
16 | #6E6E6E
17 | #404040
18 | #212121
19 | #141414
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | #F7B548
35 | #FFD590
36 | #FFE5B9
37 | #28C2D1
38 | #7BDDEF
39 | #C3F2F4
40 | #3E8EED
41 | #72ACF1
42 | #A7CBF6
43 |
44 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/Resources/Styles/Styles.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
10 |
11 |
15 |
16 |
21 |
22 |
25 |
26 |
49 |
50 |
67 |
68 |
88 |
89 |
110 |
111 |
132 |
133 |
138 |
139 |
159 |
160 |
178 |
179 |
183 |
184 |
206 |
207 |
222 |
223 |
243 |
244 |
247 |
248 |
271 |
272 |
292 |
293 |
299 |
300 |
319 |
320 |
323 |
324 |
352 |
353 |
373 |
374 |
378 |
379 |
391 |
392 |
397 |
398 |
404 |
405 |
406 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.MAUI/UIWindowSystemsDemo.MAUI.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net8.0-android;net8.0-ios
4 | $(TargetFrameworks);net8.0-windows10.0.19041.0
5 |
6 |
7 | Exe
8 | UIWindowSystemsDemo.MAUI
9 | true
10 | true
11 | enable
12 |
13 | UIWindowSystemsDemo.MAUI
14 |
15 | com.companyname.MAUI.UIWindowSystemsDemo
16 | d62842df-e7e1-4c24-a05d-dea1969b1bd2
17 |
18 | 1.0
19 | 1
20 | 11.0
21 | 21.0
22 | 10.0.17763.0
23 | 10.0.17763.0
24 |
25 | $(SolutionDir)Content
26 | $(SolutionDir)UIWindowSystemsDemo.weproj
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | #MAUI#Android
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | #MAUI#iOS
70 |
75 | -all
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 | #MAUI#Windows
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.SDL.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 12.00
2 | # Visual Studio Version 16
3 | VisualStudioVersion = 16.0.28721.148
4 | MinimumVisualStudioVersion = 10.0.40219.1
5 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UIWindowSystemsDemo.SDL", "UIWindowSystemsDemo.SDL\UIWindowSystemsDemo.SDL.csproj", "{67B341B9-4BC0-4659-A308-B7135C168FC3}"
6 | EndProject
7 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UIWindowSystemsDemo", "UIWindowSystemsDemo\UIWindowSystemsDemo.csproj", "{FDD04AAD-6290-47C5-9F72-099A289325BA}"
8 | EndProject
9 | Global
10 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
11 | Debug|Any CPU = Debug|Any CPU
12 | Release|Any CPU = Release|Any CPU
13 | EndGlobalSection
14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
15 | {67B341B9-4BC0-4659-A308-B7135C168FC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
16 | {67B341B9-4BC0-4659-A308-B7135C168FC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
17 | {67B341B9-4BC0-4659-A308-B7135C168FC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
18 | {67B341B9-4BC0-4659-A308-B7135C168FC3}.Release|Any CPU.Build.0 = Release|Any CPU
19 | {FDD04AAD-6290-47C5-9F72-099A289325BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20 | {FDD04AAD-6290-47C5-9F72-099A289325BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
21 | {FDD04AAD-6290-47C5-9F72-099A289325BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
22 | {FDD04AAD-6290-47C5-9F72-099A289325BA}.Release|Any CPU.Build.0 = Release|Any CPU
23 | EndGlobalSection
24 | GlobalSection(SolutionProperties) = preSolution
25 | HideSolutionNode = FALSE
26 | EndGlobalSection
27 | GlobalSection(ExtensibilityGlobals) = postSolution
28 | SolutionGuid = {7FB4780F-59F9-4357-9D0A-C41B393E8799}
29 | EndGlobalSection
30 | EndGlobal
31 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.SDL/Program.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using Evergine.Common.Graphics;
3 | using Evergine.Framework;
4 | using Evergine.Framework.Graphics;
5 | using Evergine.Framework.Services;
6 |
7 | namespace UIWindowSystemsDemo.SDL
8 | {
9 | class Program
10 | {
11 | static void Main(string[] args)
12 | {
13 | // Create app
14 | MyApplication application = new MyApplication();
15 |
16 | // Create Services
17 | uint width = 1280;
18 | uint height = 720;
19 | WindowsSystem windowsSystem = new Evergine.SDL.SDLWindowsSystem();
20 | application.Container.RegisterInstance(windowsSystem);
21 | var window = windowsSystem.CreateWindow("Evergine SDL sample", width, height);
22 |
23 | ConfigureGraphicsContext(application, window);
24 |
25 | // Creates XAudio device
26 | var xaudio = new Evergine.XAudio2.XAudioDevice();
27 | application.Container.RegisterInstance(xaudio);
28 |
29 | Stopwatch clockTimer = Stopwatch.StartNew();
30 | windowsSystem.Run(
31 | () =>
32 | {
33 | application.Initialize();
34 | },
35 | () =>
36 | {
37 | var gameTime = clockTimer.Elapsed;
38 | clockTimer.Restart();
39 |
40 | application.UpdateFrame(gameTime);
41 | application.DrawFrame(gameTime);
42 | });
43 | }
44 |
45 | private static void ConfigureGraphicsContext(Application application, Window window)
46 | {
47 | GraphicsContext graphicsContext = new Evergine.DirectX11.DX11GraphicsContext();
48 | graphicsContext.CreateDevice();
49 | SwapChainDescription swapChainDescription = new SwapChainDescription()
50 | {
51 | SurfaceInfo = window.SurfaceInfo,
52 | Width = window.Width,
53 | Height = window.Height,
54 | ColorTargetFormat = PixelFormat.R8G8B8A8_UNorm,
55 | ColorTargetFlags = TextureFlags.RenderTarget | TextureFlags.ShaderResource,
56 | DepthStencilTargetFormat = PixelFormat.D24_UNorm_S8_UInt,
57 | DepthStencilTargetFlags = TextureFlags.DepthStencil,
58 | SampleCount = TextureSampleCount.None,
59 | IsWindowed = true,
60 | RefreshRate = 60
61 | };
62 | var swapChain = graphicsContext.CreateSwapChain(swapChainDescription);
63 | swapChain.VerticalSync = true;
64 |
65 | var graphicsPresenter = application.Container.Resolve();
66 | var firstDisplay = new Display(window, swapChain);
67 | graphicsPresenter.AddDisplay("DefaultDisplay", firstDisplay);
68 |
69 | application.Container.RegisterInstance(graphicsContext);
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.SDL/UIWindowSystemsDemo.SDL.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 | net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WPF.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 12.00
2 | # Visual Studio Version 16
3 | VisualStudioVersion = 16.0.28721.148
4 | MinimumVisualStudioVersion = 10.0.40219.1
5 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UIWindowSystemsDemo.WPF", "UIWindowSystemsDemo.WPF\UIWindowSystemsDemo.WPF.csproj", "{67B341B9-4BC0-4659-A308-B7135C168FC3}"
6 | EndProject
7 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UIWindowSystemsDemo", "UIWindowSystemsDemo\UIWindowSystemsDemo.csproj", "{FDD04AAD-6290-47C5-9F72-099A289325BA}"
8 | EndProject
9 | Global
10 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
11 | Debug|Any CPU = Debug|Any CPU
12 | Release|Any CPU = Release|Any CPU
13 | EndGlobalSection
14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
15 | {67B341B9-4BC0-4659-A308-B7135C168FC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
16 | {67B341B9-4BC0-4659-A308-B7135C168FC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
17 | {67B341B9-4BC0-4659-A308-B7135C168FC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
18 | {67B341B9-4BC0-4659-A308-B7135C168FC3}.Release|Any CPU.Build.0 = Release|Any CPU
19 | {FDD04AAD-6290-47C5-9F72-099A289325BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20 | {FDD04AAD-6290-47C5-9F72-099A289325BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
21 | {FDD04AAD-6290-47C5-9F72-099A289325BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
22 | {FDD04AAD-6290-47C5-9F72-099A289325BA}.Release|Any CPU.Build.0 = Release|Any CPU
23 | EndGlobalSection
24 | GlobalSection(SolutionProperties) = preSolution
25 | HideSolutionNode = FALSE
26 | EndGlobalSection
27 | GlobalSection(ExtensibilityGlobals) = postSolution
28 | SolutionGuid = {7FB4780F-59F9-4357-9D0A-C41B393E8799}
29 | EndGlobalSection
30 | EndGlobal
31 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WPF/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
11 | MainWindow.xaml
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WPF/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.Windows;
3 |
4 | namespace UIWindowSystemsDemo.WPF
5 | {
6 | ///
7 | /// Interaction logic for App.xaml
8 | ///
9 | public partial class App : Application
10 | {
11 | public MyApplication EvergineApplication { get; private set; }
12 |
13 | protected override void OnStartup(StartupEventArgs e)
14 | {
15 | base.OnStartup(e);
16 |
17 | // Create app
18 | EvergineApplication = new MyApplication();
19 |
20 | // Create Window System
21 | var windowsSystem = new Evergine.WPF.WPFWindowsSystem(this);
22 | EvergineApplication.Container.RegisterInstance(windowsSystem);
23 |
24 | // Create Graphic context
25 | var graphicsContext = new Evergine.DirectX11.DX11GraphicsContext();
26 | graphicsContext.CreateDevice();
27 | EvergineApplication.Container.RegisterInstance(graphicsContext);
28 |
29 | // Creates XAudio device
30 | var xaudio = new Evergine.XAudio2.XAudioDevice();
31 | EvergineApplication.Container.RegisterInstance(xaudio);
32 |
33 | Stopwatch clockTimer = Stopwatch.StartNew();
34 | windowsSystem.Run(
35 | () =>
36 | {
37 | EvergineApplication.Initialize();
38 | },
39 | () =>
40 | {
41 | var gameTime = clockTimer.Elapsed;
42 | clockTimer.Restart();
43 |
44 | EvergineApplication.UpdateFrame(gameTime);
45 | EvergineApplication.DrawFrame(gameTime);
46 |
47 | graphicsContext.DXDeviceContext.Flush();
48 | });
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WPF/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | [assembly: ThemeInfo(
4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5 | //(used if a resource is not found in the page,
6 | // or application resource dictionaries)
7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8 | //(used if a resource is not found in the page,
9 | // app, or any theme specific resource dictionaries)
10 | )]
11 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WPF/EvergineDisplayHelper.cs:
--------------------------------------------------------------------------------
1 | using Evergine.Common.Graphics;
2 | using Evergine.DirectX11;
3 | using Evergine.Framework.Graphics;
4 | using Evergine.Framework.Services;
5 | using Evergine.WPF;
6 | using System;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Input;
10 |
11 | namespace UIWindowSystemsDemo.WPF
12 | {
13 | internal class EvergineDisplayHelper
14 | {
15 | private readonly ContentControl control;
16 | private DX11GraphicsContext dX11GraphicsContext;
17 | private GraphicsPresenter graphicsPresenter;
18 | private WPFSurface surface;
19 | private Display display;
20 | private string displayTag;
21 |
22 | public EvergineDisplayHelper(ContentControl control)
23 | {
24 | this.control = control;
25 | }
26 |
27 | public void Load(string displayTag)
28 | {
29 | var application = ((App)Application.Current).EvergineApplication;
30 | graphicsPresenter = application.Container.Resolve();
31 | dX11GraphicsContext = application.Container.Resolve();
32 |
33 | surface = new WPFSurface(0, 0) { SurfaceUpdatedAction = s => SurfaceUpdated(s, display) };
34 | display = new Display(surface, (FrameBuffer)null);
35 |
36 | control.Content = surface.NativeControl;
37 |
38 | surface.NativeControl.MouseDown += NativeControlMouseDown;
39 | surface.NativeControl.MouseUp += NativeControlMouseUp;
40 |
41 | this.displayTag = displayTag;
42 | graphicsPresenter.AddDisplay(displayTag, this.display);
43 | }
44 |
45 | public void Unload()
46 | {
47 | graphicsPresenter.RemoveDisplay(this.displayTag);
48 | displayTag = null;
49 | surface.NativeControl.MouseDown -= NativeControlMouseDown;
50 | surface.NativeControl.MouseUp -= NativeControlMouseUp;
51 | }
52 |
53 | private void NativeControlMouseUp(object sender, MouseButtonEventArgs e)
54 | {
55 | ((FrameworkElement)sender).ReleaseMouseCapture();
56 | }
57 |
58 | private void NativeControlMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
59 | {
60 | ((FrameworkElement)sender).Focus();
61 | ((FrameworkElement)sender).CaptureMouse();
62 | }
63 |
64 | private void SurfaceUpdated(IntPtr surfaceHandle, Display display)
65 | {
66 | var sharedObject = new SharpGen.Runtime.ComObject(surfaceHandle);
67 | var sharedResource = sharedObject.QueryInterface();
68 | var nativeRexture = dX11GraphicsContext.DXDevice.OpenSharedResource(sharedResource.SharedHandle);
69 |
70 | var texture = DX11Texture.FromDirectXTexture(dX11GraphicsContext, nativeRexture);
71 | var rTDepthTargetDescription = new TextureDescription()
72 | {
73 | Type = TextureType.Texture2D,
74 | Format = PixelFormat.D24_UNorm_S8_UInt,
75 | Width = texture.Description.Width,
76 | Height = texture.Description.Height,
77 | Depth = 1,
78 | ArraySize = 1,
79 | Faces = 1,
80 | Flags = TextureFlags.DepthStencil,
81 | CpuAccess = ResourceCpuAccess.None,
82 | MipLevels = 1,
83 | Usage = ResourceUsage.Default,
84 | SampleCount = TextureSampleCount.None,
85 | };
86 |
87 | var rTDepthTarget = this.dX11GraphicsContext.Factory.CreateTexture(ref rTDepthTargetDescription, "SwapChain_Depth");
88 | var frameBuffer = this.dX11GraphicsContext.Factory.CreateFrameBuffer(new FrameBufferAttachment(rTDepthTarget, 0, 1), new[] { new FrameBufferAttachment(texture, 0, 1) });
89 | frameBuffer.IntermediateBufferAssociated = true;
90 | display.FrameBuffer?.Dispose();
91 | display.UpdateFrameBuffer(frameBuffer);
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WPF/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
24 |
25 |
31 |
32 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WPF/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Input;
3 | using Window = System.Windows.Window;
4 |
5 | namespace UIWindowSystemsDemo.WPF
6 | {
7 | ///
8 | /// Interaction logic for MainWindow.xaml
9 | ///
10 | public partial class MainWindow : Window
11 | {
12 | private EvergineDisplayHelper displayHelper1;
13 | private EvergineDisplayHelper displayHelper2;
14 | private InteractionService interactionService;
15 |
16 | public MainWindow()
17 | {
18 | InitializeComponent();
19 |
20 | displayHelper1 = new EvergineDisplayHelper(WaveContainer);
21 | displayHelper1.Load("DefaultDisplay");
22 |
23 | displayHelper2 = new EvergineDisplayHelper(WaveContainer2);
24 | displayHelper2.Load("Display2");
25 |
26 | RegisterInteractionService();
27 | }
28 |
29 | private void RegisterInteractionService()
30 | {
31 | var application = ((App)Application.Current).EvergineApplication;
32 | interactionService = new InteractionService();
33 | application.Container.RegisterInstance(interactionService);
34 | }
35 |
36 | private void NativeControlMouseUp(object sender, MouseButtonEventArgs e)
37 | {
38 | ((FrameworkElement)sender).ReleaseMouseCapture();
39 | }
40 |
41 | private void NativeControlMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
42 | {
43 | ((FrameworkElement)sender).Focus();
44 | ((FrameworkElement)sender).CaptureMouse();
45 | }
46 |
47 | private void ResetCameraClick(object sender, RoutedEventArgs e)
48 | {
49 | interactionService.ResetCamera();
50 | }
51 |
52 | private void DisplacementChanged(object sender, RoutedPropertyChangedEventArgs e)
53 | {
54 | interactionService.Displacement = (float)e.NewValue;
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WPF/SecondaryWindow.xaml:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WPF/SecondaryWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using Evergine.Framework.Graphics;
2 | using Evergine.Framework.Services;
3 | using System;
4 | using System.Linq;
5 | using System.Windows;
6 | using Window = System.Windows.Window;
7 |
8 | namespace UIWindowSystemsDemo.WPF
9 | {
10 | ///
11 | /// Interaction logic for SecondaryWindow.xaml
12 | ///
13 | public partial class SecondaryWindow : Window
14 | {
15 | private const string Display2 = nameof(Display2);
16 | private readonly EvergineDisplayHelper displayHelper;
17 |
18 | public SecondaryWindow()
19 | {
20 | InitializeComponent();
21 | displayHelper = new EvergineDisplayHelper(WaveContainer);
22 | displayHelper.Load(Display2);
23 |
24 | this.RefreshDisplay();
25 | }
26 |
27 | protected override void OnClosed(EventArgs e)
28 | {
29 | base.OnClosed(e);
30 | this.displayHelper.Unload();
31 | }
32 |
33 | private void RefreshDisplay()
34 | {
35 | var application = ((App)Application.Current).EvergineApplication;
36 | var manager = application.Container.Resolve();
37 | var scene = manager.CurrentContext.FindScene();
38 | var camera = scene.Managers.EntityManager
39 | .FindComponentsOfType()
40 | .FirstOrDefault(camera => camera.DisplayTag == Display2);
41 | camera.DisplayTagDirty = true;
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WPF/SeparatedWindows.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
20 |
21 |
25 |
26 |
32 |
33 |
39 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WPF/SeparatedWindows.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using System.Windows;
3 | using Window = System.Windows.Window;
4 |
5 | namespace UIWindowSystemsDemo.WPF
6 | {
7 | ///
8 | /// Interaction logic for SeparatedWindows.xaml
9 | ///
10 | public partial class SeparatedWindows : Window
11 | {
12 | private readonly EvergineDisplayHelper displayHelper;
13 | private InteractionService interactionService;
14 |
15 | public SeparatedWindows()
16 | {
17 | InitializeComponent();
18 | displayHelper = new EvergineDisplayHelper(WaveContainer);
19 | displayHelper.Load("DefaultDisplay");
20 |
21 | RegisterInteractionService();
22 | }
23 |
24 | private void RegisterInteractionService()
25 | {
26 | var application = ((App)Application.Current).EvergineApplication;
27 | interactionService = new InteractionService();
28 | application.Container.RegisterInstance(interactionService);
29 | }
30 |
31 | private void ResetCameraClick(object sender, RoutedEventArgs e)
32 | {
33 | interactionService.ResetCamera();
34 | }
35 |
36 | private void DisplacementChanged(object sender, RoutedPropertyChangedEventArgs e)
37 | {
38 | interactionService.Displacement = (float)e.NewValue;
39 | }
40 |
41 | private void OpenSecondaryWindow_Click(object sender, RoutedEventArgs e)
42 | {
43 | if (!App.Current.Windows.OfType().Any())
44 | {
45 | var window = new SecondaryWindow();
46 | window.Show();
47 | }
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WPF/UIWindowSystemsDemo.WPF.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 | net8.0-windows
5 | true
6 |
7 | $(SolutionDir)Content
8 | $(SolutionDir)UIWindowSystemsDemo.weproj
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | $(DefaultXamlRuntime)
25 |
26 |
27 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WinUI (Package)/Images/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EvergineTeam/UIWindowSystemsDemo/f2d68c6daa0acf4def7593c3a7f75077fecd722b/UIWindowSystemsDemo.WinUI (Package)/Images/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WinUI (Package)/Images/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EvergineTeam/UIWindowSystemsDemo/f2d68c6daa0acf4def7593c3a7f75077fecd722b/UIWindowSystemsDemo.WinUI (Package)/Images/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WinUI (Package)/Images/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EvergineTeam/UIWindowSystemsDemo/f2d68c6daa0acf4def7593c3a7f75077fecd722b/UIWindowSystemsDemo.WinUI (Package)/Images/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WinUI (Package)/Images/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EvergineTeam/UIWindowSystemsDemo/f2d68c6daa0acf4def7593c3a7f75077fecd722b/UIWindowSystemsDemo.WinUI (Package)/Images/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WinUI (Package)/Images/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EvergineTeam/UIWindowSystemsDemo/f2d68c6daa0acf4def7593c3a7f75077fecd722b/UIWindowSystemsDemo.WinUI (Package)/Images/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WinUI (Package)/Images/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EvergineTeam/UIWindowSystemsDemo/f2d68c6daa0acf4def7593c3a7f75077fecd722b/UIWindowSystemsDemo.WinUI (Package)/Images/StoreLogo.png
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WinUI (Package)/Images/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EvergineTeam/UIWindowSystemsDemo/f2d68c6daa0acf4def7593c3a7f75077fecd722b/UIWindowSystemsDemo.WinUI (Package)/Images/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WinUI (Package)/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
13 |
14 |
15 | UIWindowSystemsDemo.WinUI (Package)
16 | dcaceres
17 | Images\StoreLogo.png
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WinUI (Package)/UIWindowSystemsDemo.WinUI (Package).wapproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 15.0
5 |
6 |
7 |
8 | Debug
9 | x64
10 |
11 |
12 | Release
13 | x64
14 |
15 |
16 |
17 | $(MSBuildExtensionsPath)\Microsoft\DesktopBridge\
18 | UIWindowSystemsDemo.WinUI\
19 |
20 |
21 |
22 | dab747ca-035f-4d7e-a922-af69ff72bcdf
23 | 10.0.22621.0
24 | 10.0.17763.0
25 | net8.0-windows$(TargetPlatformVersion);$(AssetTargetFallback)
26 | en-US
27 | false
28 | ..\UIWindowSystemsDemo.WinUI\UIWindowSystemsDemo.WinUI.csproj
29 |
30 |
31 |
32 | Designer
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | True
47 | Properties\PublishProfiles\win10-$(Platform).pubxml
48 |
49 |
50 |
51 |
52 | build
53 |
54 |
55 | build
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WinUI.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 12.00
2 | # Visual Studio Version 16
3 | VisualStudioVersion = 16.0.28721.148
4 | MinimumVisualStudioVersion = 10.0.40219.1
5 | Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "UIWindowSystemsDemo.WinUI (Package)", "UIWindowSystemsDemo.WinUI (Package)\UIWindowSystemsDemo.WinUI (Package).wapproj", "{DAB747CA-035F-4D7E-A922-AF69FF72BCDF}"
6 | EndProject
7 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UIWindowSystemsDemo", "UIWindowSystemsDemo\UIWindowSystemsDemo.csproj", "{49DD23FF-A131-432B-8B93-56C6E5B27227}"
8 | EndProject
9 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UIWindowSystemsDemo.WinUI", "UIWindowSystemsDemo.WinUI\UIWindowSystemsDemo.WinUI.csproj", "{76083ACC-4B69-4F1F-BB98-65005DB3B9C6}"
10 | EndProject
11 | Global
12 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
13 | Debug|x64 = Debug|x64
14 | Release|x64 = Release|x64
15 | EndGlobalSection
16 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
17 | {DAB747CA-035F-4D7E-A922-AF69FF72BCDF}.Debug|x64.ActiveCfg = Debug|x64
18 | {DAB747CA-035F-4D7E-A922-AF69FF72BCDF}.Debug|x64.Build.0 = Debug|x64
19 | {DAB747CA-035F-4D7E-A922-AF69FF72BCDF}.Debug|x64.Deploy.0 = Debug|x64
20 | {DAB747CA-035F-4D7E-A922-AF69FF72BCDF}.Release|x64.ActiveCfg = Release|x64
21 | {DAB747CA-035F-4D7E-A922-AF69FF72BCDF}.Release|x64.Build.0 = Release|x64
22 | {DAB747CA-035F-4D7E-A922-AF69FF72BCDF}.Release|x64.Deploy.0 = Release|x64
23 | {49DD23FF-A131-432B-8B93-56C6E5B27227}.Debug|x64.ActiveCfg = Debug|Any CPU
24 | {49DD23FF-A131-432B-8B93-56C6E5B27227}.Debug|x64.Build.0 = Debug|Any CPU
25 | {49DD23FF-A131-432B-8B93-56C6E5B27227}.Release|x64.ActiveCfg = Release|Any CPU
26 | {49DD23FF-A131-432B-8B93-56C6E5B27227}.Release|x64.Build.0 = Release|Any CPU
27 | {76083ACC-4B69-4F1F-BB98-65005DB3B9C6}.Debug|x64.ActiveCfg = Debug|x64
28 | {76083ACC-4B69-4F1F-BB98-65005DB3B9C6}.Debug|x64.Build.0 = Debug|x64
29 | {76083ACC-4B69-4F1F-BB98-65005DB3B9C6}.Release|x64.ActiveCfg = Release|x64
30 | {76083ACC-4B69-4F1F-BB98-65005DB3B9C6}.Release|x64.Build.0 = Release|x64
31 | EndGlobalSection
32 | GlobalSection(SolutionProperties) = preSolution
33 | HideSolutionNode = FALSE
34 | EndGlobalSection
35 | GlobalSection(ExtensibilityGlobals) = postSolution
36 | SolutionGuid = {FE4AF859-4541-45F2-9816-AC54DF8EC747}
37 | EndGlobalSection
38 | EndGlobal
39 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WinUI/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WinUI/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.UI.Xaml;
2 | using Microsoft.UI.Xaml.Controls;
3 | using Microsoft.UI.Xaml.Controls.Primitives;
4 | using Microsoft.UI.Xaml.Data;
5 | using Microsoft.UI.Xaml.Input;
6 | using Microsoft.UI.Xaml.Media;
7 | using Microsoft.UI.Xaml.Navigation;
8 | using Microsoft.UI.Xaml.Shapes;
9 | using System;
10 | using System.Collections.Generic;
11 | using System.IO;
12 | using System.Linq;
13 | using System.Runtime.InteropServices.WindowsRuntime;
14 | using Windows.ApplicationModel;
15 | using Windows.ApplicationModel.Activation;
16 | using Windows.Foundation;
17 | using Windows.Foundation.Collections;
18 |
19 | // To learn more about WinUI, the WinUI project structure,
20 | // and more about our project templates, see: http://aka.ms/winui-project-info.
21 |
22 | namespace UIWindowSystemsDemo.WinUI
23 | {
24 | ///
25 | /// Provides application-specific behavior to supplement the default Application class.
26 | ///
27 | public partial class App : Application
28 | {
29 | ///
30 | /// Initializes the singleton application object. This is the first line of authored code
31 | /// executed, and as such is the logical equivalent of main() or WinMain().
32 | ///
33 | public App()
34 | {
35 | this.InitializeComponent();
36 | }
37 |
38 | ///
39 | /// Invoked when the application is launched normally by the end user. Other entry points
40 | /// will be used such as when the application is launched to open a specific file.
41 | ///
42 | /// Details about the launch request and process.
43 | protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
44 | {
45 | m_window = new MainWindow();
46 | m_window.Activate();
47 | }
48 |
49 | private Window m_window;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WinUI/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
19 |
25 |
31 |
32 |
36 |
37 |
43 |
44 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WinUI/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.UI.Xaml;
2 | using Microsoft.UI.Xaml.Controls;
3 | using Microsoft.UI.Xaml.Controls.Primitives;
4 | using Microsoft.UI.Xaml.Input;
5 | using System.Diagnostics;
6 | using Evergine.Common.Graphics;
7 | using Evergine.DirectX11;
8 | using Evergine.Framework.Graphics;
9 | using Evergine.Framework.Services;
10 | using Evergine.WinUI;
11 |
12 | // To learn more about WinUI, the WinUI project structure,
13 | // and more about our project templates, see: http://aka.ms/winui-project-info.
14 |
15 | namespace UIWindowSystemsDemo.WinUI
16 | {
17 | ///
18 | /// An empty window that can be used on its own or navigated to within a Frame.
19 | ///
20 | public sealed partial class MainWindow : Microsoft.UI.Xaml.Window
21 | {
22 | private InteractionService interactionService;
23 |
24 | public MainWindow()
25 | {
26 | this.InitializeComponent();
27 | SwapChainPanel.Loaded += OnSwapChainPanelLoaded;
28 | }
29 |
30 | private void OnSwapChainPanelLoaded(object sender, RoutedEventArgs e)
31 | {
32 | // Create app
33 | MyApplication application = new MyApplication();
34 |
35 | interactionService = new InteractionService();
36 | application.Container.RegisterInstance(interactionService);
37 |
38 | GraphicsContext graphicsContext = new DX11GraphicsContext();
39 | application.Container.RegisterInstance(graphicsContext);
40 | graphicsContext.CreateDevice();
41 |
42 | // Create Services
43 | WinUIWindowsSystem windowsSystem = new WinUIWindowsSystem();
44 | application.Container.RegisterInstance(windowsSystem);
45 |
46 | var surface = (WinUISurface)windowsSystem.CreateSurface(SwapChainPanel);
47 | var surface2 = (WinUISurface)windowsSystem.CreateSurface(SwapChainPanel2);
48 |
49 | ConfigureGraphicsContext(application, surface, "DefaultDisplay");
50 | ConfigureGraphicsContext(application, surface2, "Display2");
51 |
52 | // Creates XAudio device
53 | var xaudio = new Evergine.XAudio2.XAudioDevice();
54 | application.Container.RegisterInstance(xaudio);
55 |
56 | Stopwatch clockTimer = Stopwatch.StartNew();
57 | windowsSystem.Run(
58 | () =>
59 | {
60 | application.Initialize();
61 | },
62 | () =>
63 | {
64 | var gameTime = clockTimer.Elapsed;
65 | clockTimer.Restart();
66 |
67 | application.UpdateFrame(gameTime);
68 | application.DrawFrame(gameTime);
69 | });
70 | }
71 |
72 | private static void ConfigureGraphicsContext(Evergine.Framework.Application application, WinUISurface surface, string displayName)
73 | {
74 | GraphicsContext graphicsContext = application.Container.Resolve();
75 |
76 | SwapChainDescription swapChainDescription = new SwapChainDescription()
77 | {
78 | SurfaceInfo = surface.SurfaceInfo,
79 | Width = surface.Width,
80 | Height = surface.Height,
81 | ColorTargetFormat = PixelFormat.R8G8B8A8_UNorm,
82 | ColorTargetFlags = TextureFlags.RenderTarget | TextureFlags.ShaderResource,
83 | DepthStencilTargetFormat = PixelFormat.D24_UNorm_S8_UInt,
84 | DepthStencilTargetFlags = TextureFlags.DepthStencil,
85 | SampleCount = TextureSampleCount.None,
86 | IsWindowed = true,
87 | RefreshRate = 60
88 | };
89 |
90 | var swapChain = graphicsContext.CreateSwapChain(swapChainDescription);
91 | swapChain.VerticalSync = true;
92 | surface.NativeSurface.SwapChain = swapChain;
93 |
94 | var graphicsPresenter = application.Container.Resolve();
95 | var firstDisplay = new Display(surface, swapChain);
96 | graphicsPresenter.AddDisplay(displayName, firstDisplay);
97 | }
98 |
99 | private void OnSwapChainPanelPointerPressed(object sender, PointerRoutedEventArgs e)
100 | {
101 | ((SwapChainPanel)sender).Focus(FocusState.Pointer);
102 | ((SwapChainPanel)sender).CapturePointer(e.Pointer);
103 | }
104 |
105 | private void OnSwapChainPanelPointerReleased(object sender, PointerRoutedEventArgs e)
106 | {
107 | ((SwapChainPanel)sender).ReleasePointerCaptures();
108 | }
109 |
110 | private void ResetCameraClick(object sender, RoutedEventArgs e)
111 | {
112 | interactionService.ResetCamera();
113 | }
114 |
115 | private void DisplacementChanged(object sender, RangeBaseValueChangedEventArgs e)
116 | {
117 | interactionService.Displacement = (float)e.NewValue;
118 | }
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WinUI/UIWindowSystemsDemo.WinUI.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 | net8.0-windows10.0.19041.0
5 | 10.0.17763.0
6 | UIWindowSystemsDemo.WinUI
7 | app.manifest
8 | x64
9 | win-x64
10 | true
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.WinUI/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
11 | true/PM
12 | PerMonitorV2, PerMonitor
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.Windows.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.28721.148
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UIWindowSystemsDemo.Windows", "UIWindowSystemsDemo.Windows\UIWindowSystemsDemo.Windows.csproj", "{67B341B9-4BC0-4659-A308-B7135C168FC3}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UIWindowSystemsDemo", "UIWindowSystemsDemo\UIWindowSystemsDemo.csproj", "{FDD04AAD-6290-47C5-9F72-099A289325BA}"
9 | EndProject
10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UIWindowSystemsDemo.Editor", "UIWindowSystemsDemo.Editor\UIWindowSystemsDemo.Editor.csproj", "{95780E7C-D9B2-46ED-8D18-4DF0A33A3D6F}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Release|Any CPU = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {67B341B9-4BC0-4659-A308-B7135C168FC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {67B341B9-4BC0-4659-A308-B7135C168FC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {67B341B9-4BC0-4659-A308-B7135C168FC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {67B341B9-4BC0-4659-A308-B7135C168FC3}.Release|Any CPU.Build.0 = Release|Any CPU
22 | {FDD04AAD-6290-47C5-9F72-099A289325BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {FDD04AAD-6290-47C5-9F72-099A289325BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {FDD04AAD-6290-47C5-9F72-099A289325BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {FDD04AAD-6290-47C5-9F72-099A289325BA}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {95780E7C-D9B2-46ED-8D18-4DF0A33A3D6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {95780E7C-D9B2-46ED-8D18-4DF0A33A3D6F}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {95780E7C-D9B2-46ED-8D18-4DF0A33A3D6F}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {95780E7C-D9B2-46ED-8D18-4DF0A33A3D6F}.Release|Any CPU.Build.0 = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | GlobalSection(ExtensibilityGlobals) = postSolution
35 | SolutionGuid = {7FB4780F-59F9-4357-9D0A-C41B393E8799}
36 | EndGlobalSection
37 | EndGlobal
38 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.Windows/CustomForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace UIWindowSystemsDemo.Windows
2 | {
3 | partial class CustomForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.panel1 = new System.Windows.Forms.Panel();
32 | this.label1 = new System.Windows.Forms.Label();
33 | this.trackBar1 = new System.Windows.Forms.TrackBar();
34 | this.button1 = new System.Windows.Forms.Button();
35 | this.evergineContainer = new System.Windows.Forms.Panel();
36 | this.panel1.SuspendLayout();
37 | ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
38 | this.SuspendLayout();
39 | //
40 | // panel1
41 | //
42 | this.panel1.Controls.Add(this.label1);
43 | this.panel1.Controls.Add(this.trackBar1);
44 | this.panel1.Controls.Add(this.button1);
45 | this.panel1.Dock = System.Windows.Forms.DockStyle.Right;
46 | this.panel1.Location = new System.Drawing.Point(610, 0);
47 | this.panel1.Name = "panel1";
48 | this.panel1.Size = new System.Drawing.Size(190, 450);
49 | this.panel1.TabIndex = 0;
50 | //
51 | // label1
52 | //
53 | this.label1.AutoSize = true;
54 | this.label1.Location = new System.Drawing.Point(20, 73);
55 | this.label1.Name = "label1";
56 | this.label1.Size = new System.Drawing.Size(103, 20);
57 | this.label1.TabIndex = 2;
58 | this.label1.Text = "Displacement:";
59 | //
60 | // trackBar1
61 | //
62 | this.trackBar1.Location = new System.Drawing.Point(20, 107);
63 | this.trackBar1.Name = "trackBar1";
64 | this.trackBar1.Size = new System.Drawing.Size(158, 56);
65 | this.trackBar1.TabIndex = 1;
66 | this.trackBar1.ValueChanged += new System.EventHandler(this.tbDisplacement_ValueChanged);
67 | //
68 | // button1
69 | //
70 | this.button1.Location = new System.Drawing.Point(20, 24);
71 | this.button1.Name = "button1";
72 | this.button1.Size = new System.Drawing.Size(158, 29);
73 | this.button1.TabIndex = 0;
74 | this.button1.Text = "Reset camera";
75 | this.button1.UseVisualStyleBackColor = true;
76 | this.button1.Click += new System.EventHandler(this.btnCameraReset_Click);
77 | //
78 | // evergineContainer
79 | //
80 | this.evergineContainer.Dock = System.Windows.Forms.DockStyle.Fill;
81 | this.evergineContainer.Location = new System.Drawing.Point(0, 0);
82 | this.evergineContainer.Name = "evergineContainer";
83 | this.evergineContainer.Size = new System.Drawing.Size(610, 450);
84 | this.evergineContainer.TabIndex = 1;
85 | //
86 | // Form1
87 | //
88 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
89 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
90 | this.ClientSize = new System.Drawing.Size(800, 450);
91 | this.Controls.Add(this.evergineContainer);
92 | this.Controls.Add(this.panel1);
93 | this.Name = "Form1";
94 | this.Text = "Form1";
95 | this.panel1.ResumeLayout(false);
96 | this.panel1.PerformLayout();
97 | ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
98 | this.ResumeLayout(false);
99 |
100 | }
101 |
102 | #endregion
103 |
104 | private System.Windows.Forms.Panel panel1;
105 | private System.Windows.Forms.Panel evergineContainer;
106 | private System.Windows.Forms.Label label1;
107 | private System.Windows.Forms.TrackBar trackBar1;
108 | private System.Windows.Forms.Button button1;
109 | }
110 | }
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.Windows/CustomForm.cs:
--------------------------------------------------------------------------------
1 | using Evergine.Forms;
2 | using System;
3 | using System.Windows.Forms;
4 | using Application = Evergine.Framework.Application;
5 |
6 | namespace UIWindowSystemsDemo.Windows
7 | {
8 | public partial class CustomForm : Form
9 | {
10 | private InteractionService interactionService;
11 |
12 | public CustomForm()
13 | {
14 | InitializeComponent();
15 |
16 | }
17 |
18 | public void Initialize(Application application)
19 | {
20 | interactionService = new InteractionService();
21 | application.Container.RegisterInstance(interactionService);
22 | }
23 |
24 | public void SetEvergineControl(EvergineControl control)
25 | {
26 | control.Dock = DockStyle.Fill;
27 | evergineContainer.Controls.Add(control);
28 | }
29 |
30 | private void btnCameraReset_Click(object sender, EventArgs e) =>
31 | interactionService?.ResetCamera();
32 |
33 | private void tbDisplacement_ValueChanged(object sender, EventArgs e)
34 | {
35 | if (sender is TrackBar trackBar)
36 | {
37 | interactionService.Displacement = trackBar.Value;
38 | }
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.Windows/CustomForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | text/microsoft-resx
50 |
51 |
52 | 2.0
53 |
54 |
55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
56 |
57 |
58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
59 |
60 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.Windows/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using Evergine.Common.Graphics;
4 | using Evergine.Forms;
5 | using Evergine.Framework;
6 | using Evergine.Framework.Graphics;
7 | using Evergine.Framework.Services;
8 |
9 | namespace UIWindowSystemsDemo.Windows
10 | {
11 | class Program
12 | {
13 | ///
14 | /// Depending on the value of this variable, you can see a different sample behavior:
15 | /// - True: Evergine renders in full window size.
16 | /// - False: Evergine renders in defined area within the window, and can be used together
17 | /// with other native UI elements.
18 | ///
19 | public static bool ShowSingleWindowSample = true;
20 |
21 | [STAThread]
22 | static void Main(string[] args)
23 | {
24 | // Create app
25 | var application = new MyApplication();
26 |
27 | // Create Services
28 | uint width = 1280;
29 | uint height = 720;
30 | var windowsSystem = new FormsWindowsSystem()
31 | {
32 | AutoRegisterWindow = ShowSingleWindowSample,
33 | };
34 | application.Container.RegisterInstance(windowsSystem);
35 |
36 | Surface surface;
37 |
38 | if (ShowSingleWindowSample)
39 | {
40 | surface = windowsSystem.CreateWindow("Evergine Forms sample", width, height);
41 | }
42 | else
43 | {
44 | var window = new CustomForm
45 | {
46 | Text = "Evergine Forms sample",
47 | Width = (int)width,
48 | Height = (int)height,
49 | };
50 | window.Initialize(application);
51 |
52 | // When rendered as user control, Evergine surface should be registered manually
53 | var formsSurface = windowsSystem.CreateSurface(0, 0) as FormsSurface;
54 | window.SetEvergineControl(formsSurface.NativeControl);
55 | windowsSystem.RegisterLoopThreadControl(formsSurface.NativeControl);
56 | window.Show();
57 |
58 | surface = formsSurface;
59 | }
60 |
61 | ConfigureGraphicsContext(application, surface);
62 |
63 | // Creates XAudio device
64 | var xaudio = new Evergine.XAudio2.XAudioDevice();
65 | application.Container.RegisterInstance(xaudio);
66 |
67 | Stopwatch clockTimer = Stopwatch.StartNew();
68 | windowsSystem.Run(
69 | () =>
70 | {
71 | application.Initialize();
72 | },
73 | () =>
74 | {
75 | var gameTime = clockTimer.Elapsed;
76 | clockTimer.Restart();
77 |
78 | application.UpdateFrame(gameTime);
79 | application.DrawFrame(gameTime);
80 | });
81 | }
82 |
83 | private static void ConfigureGraphicsContext(Application application, Surface surface)
84 | {
85 | GraphicsContext graphicsContext = new Evergine.DirectX11.DX11GraphicsContext();
86 | graphicsContext.CreateDevice();
87 | SwapChainDescription swapChainDescription = new SwapChainDescription()
88 | {
89 | SurfaceInfo = surface.SurfaceInfo,
90 | Width = surface.Width,
91 | Height = surface.Height,
92 | ColorTargetFormat = PixelFormat.R8G8B8A8_UNorm,
93 | ColorTargetFlags = TextureFlags.RenderTarget | TextureFlags.ShaderResource,
94 | DepthStencilTargetFormat = PixelFormat.D24_UNorm_S8_UInt,
95 | DepthStencilTargetFlags = TextureFlags.DepthStencil,
96 | SampleCount = TextureSampleCount.None,
97 | IsWindowed = true,
98 | RefreshRate = 0
99 | };
100 | var swapChain = graphicsContext.CreateSwapChain(swapChainDescription);
101 | swapChain.VerticalSync = true;
102 |
103 | var graphicsPresenter = application.Container.Resolve();
104 | var firstDisplay = new Display(surface, swapChain);
105 | graphicsPresenter.AddDisplay("DefaultDisplay", firstDisplay);
106 |
107 | application.Container.RegisterInstance(graphicsContext);
108 | }
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.Windows/UIWindowSystemsDemo.Windows.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 | net8.0-windows
5 | true
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo.weproj:
--------------------------------------------------------------------------------
1 | !Evergine.Common.ProjectModel,Evergine.Common
2 | Packages:
3 | - Id: Evergine.Core
4 | LocalPath: null
5 | Version: 2025.3.18.7
6 | Parameters:
7 | MaxSkinningWeights: 4
8 | SparseMorphTargets: false
9 | Profiles:
10 | - AdditionalEffectTechniqueCombinations: null
11 | AlphaCompressionFormat: BC3_UNorm
12 | CompileEffects: false
13 | GraphicsBackend: DirectX11
14 | LauncherType: Default
15 | Name: Windows
16 | NonAlphaCompressionFormat: BC3_UNorm
17 | Platform: Windows
18 | - AdditionalEffectTechniqueCombinations: null
19 | AlphaCompressionFormat: BC3_UNorm
20 | CompileEffects: false
21 | GraphicsBackend: DirectX11
22 | LauncherType: WPF
23 | Name: WPF
24 | NonAlphaCompressionFormat: BC3_UNorm
25 | Platform: Windows
26 | - AdditionalEffectTechniqueCombinations: null
27 | AlphaCompressionFormat: R8G8B8A8_UNorm
28 | CompileEffects: false
29 | GraphicsBackend: DirectX11
30 | LauncherType: SDL
31 | Name: SDL
32 | NonAlphaCompressionFormat: R8G8B8A8_UNorm
33 | Platform: Windows
34 | - AdditionalEffectTechniqueCombinations: SHADOW_SUPPORTED
35 | AlphaCompressionFormat: BC3_UNorm
36 | CompileEffects: false
37 | GraphicsBackend: DirectX11
38 | LauncherType: WinUI
39 | Name: WinUI
40 | NonAlphaCompressionFormat: BC3_UNorm
41 | Platform: Windows
42 | - AdditionalEffectTechniqueCombinations: SHADOW_SUPPORTED-SHADOWFILTER3,SHADOW_SUPPORTED-SHADOWFILTER3-POINT_LIGHT,SHADOW_SUPPORTED-SHADOWFILTER3-SPOT_LIGHT,SHADOW_SUPPORTED-SHADOWFILTER3-POINT_LIGHT-SPOT_LIGHT
43 | AlphaCompressionFormat: BC3_UNorm
44 | CompileEffects: false
45 | GraphicsBackend: DirectX11
46 | LauncherType: WinUI
47 | Name: '#MAUI#Windows'
48 | NonAlphaCompressionFormat: BC3_UNorm
49 | Platform: Windows
50 | - AdditionalEffectTechniqueCombinations: LOW_PROFILE-SHADOW_SUPPORTED-SHADOWFILTER3,LOW_PROFILE-SHADOW_SUPPORTED-SHADOWFILTER3-GAMMA_COLORSPACE,LOW_PROFILE-SHADOW_SUPPORTED-SHADOWFILTER3-POINT_LIGHT,LOW_PROFILE-SHADOW_SUPPORTED-SHADOWFILTER3-GAMMA_COLORSPACE-POINT_LIGHT,LOW_PROFILE-SHADOW_SUPPORTED-SHADOWFILTER3-SPOT_LIGHT,LOW_PROFILE-SHADOW_SUPPORTED-SHADOWFILTER3-GAMMA_COLORSPACE-SPOT_LIGHT,LOW_PROFILE-SHADOW_SUPPORTED-SHADOWFILTER3-POINT_LIGHT-SPOT_LIGHT,LOW_PROFILE-SHADOW_SUPPORTED-SHADOWFILTER3-GAMMA_COLORSPACE-POINT_LIGHT-SPOT_LIGHT
51 | AlphaCompressionFormat: R4G4B4A4
52 | CompileEffects: true
53 | GraphicsBackend: Vulkan
54 | LauncherType: Default
55 | Name: '#MAUI#Android'
56 | NonAlphaCompressionFormat: ETC1_RGB8
57 | Platform: Android
58 | - AdditionalEffectTechniqueCombinations: LOW_PROFILE-SHADOW_SUPPORTED-SHADOWFILTER3,LOW_PROFILE-SHADOW_SUPPORTED-SHADOWFILTER3-GAMMA_COLORSPACE,LOW_PROFILE-SHADOW_SUPPORTED-SHADOWFILTER3-POINT_LIGHT,LOW_PROFILE-SHADOW_SUPPORTED-SHADOWFILTER3-GAMMA_COLORSPACE-POINT_LIGHT,LOW_PROFILE-SHADOW_SUPPORTED-SHADOWFILTER3-SPOT_LIGHT,LOW_PROFILE-SHADOW_SUPPORTED-SHADOWFILTER3-GAMMA_COLORSPACE-SPOT_LIGHT,LOW_PROFILE-SHADOW_SUPPORTED-SHADOWFILTER3-POINT_LIGHT-SPOT_LIGHT,LOW_PROFILE-SHADOW_SUPPORTED-SHADOWFILTER3-GAMMA_COLORSPACE-POINT_LIGHT-SPOT_LIGHT
59 | AlphaCompressionFormat: R4G4B4A4
60 | CompileEffects: true
61 | GraphicsBackend: Metal
62 | LauncherType: Default
63 | Name: '#MAUI#iOS'
64 | NonAlphaCompressionFormat: ETC1_RGB8
65 | Platform: iOS
66 | ResourcesPath: Content
67 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo/DisplacementBehavior.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Evergine.Framework;
3 | using Evergine.Framework.Graphics;
4 | using Evergine.Mathematics;
5 |
6 | namespace UIWindowSystemsDemo
7 | {
8 | public class DisplacementBehavior : Behavior
9 | {
10 | [BindService(isRequired: false)]
11 | protected InteractionService service;
12 |
13 | [BindComponent]
14 | protected Transform3D transform;
15 |
16 | private float offsetValue;
17 | private Vector3 initialPosition;
18 |
19 | protected override void OnActivated()
20 | {
21 | base.OnActivated();
22 |
23 | offsetValue = service?.Displacement ?? 0;
24 | initialPosition = transform.LocalPosition;
25 | }
26 |
27 | protected override void Update(TimeSpan gameTime)
28 | {
29 | if (service != null && offsetValue != service.Displacement)
30 | {
31 | offsetValue = service.Displacement;
32 |
33 |
34 | transform.LocalPosition = initialPosition + new Vector3(0, 0, (offsetValue * 1.5f) / 10f);
35 | }
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo/InteractionService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Evergine.Framework.Services;
3 |
4 | namespace UIWindowSystemsDemo
5 | {
6 | public class InteractionService : Service
7 | {
8 | public event EventHandler CameraReset;
9 |
10 | public float Displacement { get; set; }
11 |
12 | public void ResetCamera()
13 | {
14 | this.CameraReset?.Invoke(this, EventArgs.Empty);
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo/MyApplication.cs:
--------------------------------------------------------------------------------
1 | using Evergine.Common.IO;
2 | using Evergine.Framework;
3 | using Evergine.Framework.Services;
4 | using Evergine.Framework.Threading;
5 |
6 | namespace UIWindowSystemsDemo
7 | {
8 | public partial class MyApplication : Application
9 | {
10 | public MyApplication()
11 | {
12 | this.Container.Register();
13 | this.Container.Register();
14 | this.Container.Register();
15 | this.Container.Register();
16 | this.Container.Register();
17 | this.Container.Register();
18 | this.Container.Register();
19 | this.Container.Register();
20 | this.Container.Register();
21 | }
22 |
23 | public override void Initialize()
24 | {
25 | base.Initialize();
26 |
27 | // Get ScreenContextManager
28 | var screenContextManager = this.Container.Resolve();
29 | var assetsService = this.Container.Resolve();
30 |
31 | // Navigate to scene
32 | var scene = assetsService.Load(EvergineContent.Scenes.MyScene_wescene);
33 | ScreenContext screenContext = new ScreenContext(scene);
34 | screenContextManager.To(screenContext);
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo/MyScene.cs:
--------------------------------------------------------------------------------
1 | using Evergine.Common.Graphics;
2 | using Evergine.Components.Graphics3D;
3 | using Evergine.Framework;
4 | using Evergine.Framework.Graphics;
5 | using Evergine.Framework.Services;
6 | using Evergine.Mathematics;
7 |
8 | namespace UIWindowSystemsDemo
9 | {
10 | public class MyScene : Scene
11 | {
12 | public override void RegisterManagers()
13 | {
14 | base.RegisterManagers();
15 | this.Managers.AddManager(new Evergine.Bullet.BulletPhysicManager3D());
16 | }
17 |
18 | protected override void CreateScene()
19 | {
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using Evergine.Common.Attributes;
2 |
3 | [assembly: EvergineAssembly(EvergineAssemblyUsage.UserProject)]
4 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo/ResetCameraComponent.cs:
--------------------------------------------------------------------------------
1 | using Evergine.Framework;
2 | using Evergine.Framework.Graphics;
3 | using Evergine.Mathematics;
4 |
5 | namespace UIWindowSystemsDemo
6 | {
7 | public class ResetCameraComponent : Component
8 | {
9 | [BindComponent(isExactType: false)]
10 | protected Camera camera;
11 |
12 | // The service will be null when the scene is executed from the Editor.
13 | [BindService(false)]
14 | protected InteractionService service;
15 |
16 | private Vector3 initialPosition;
17 | private Quaternion initialOrientation;
18 |
19 | protected override void OnActivated()
20 | {
21 | base.OnActivated();
22 |
23 | this.initialPosition = camera.Transform.Position;
24 | this.initialOrientation = camera.Transform.Orientation;
25 |
26 | if (service != null)
27 | {
28 | service.CameraReset += Service_CameraReset;
29 | }
30 | }
31 |
32 | protected override void OnDeactivated()
33 | {
34 | base.OnDeactivated();
35 |
36 | if (service != null)
37 | {
38 | service.CameraReset -= Service_CameraReset;
39 | }
40 | }
41 |
42 | private void Service_CameraReset(object sender, System.EventArgs e)
43 | {
44 | this.camera.Transform.Position = initialPosition;
45 | this.camera.Transform.Orientation = initialOrientation;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/UIWindowSystemsDemo/UIWindowSystemsDemo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net8.0
4 | True
5 | False
6 | True
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------