mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-10 00:39:09 +01:00
added an experimental kni web demo
This commit is contained in:
parent
ea8ec69dd6
commit
db144f7880
19 changed files with 2725 additions and 0 deletions
12
Demos.Web/App.razor
Normal file
12
Demos.Web/App.razor
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<Router AppAssembly="@typeof(App).Assembly">
|
||||||
|
<Found Context="routeData">
|
||||||
|
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||||
|
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
|
||||||
|
</Found>
|
||||||
|
<NotFound>
|
||||||
|
<PageTitle>Not found</PageTitle>
|
||||||
|
<LayoutView Layout="@typeof(MainLayout)">
|
||||||
|
<p role="alert">Sorry, there's nothing at this address.</p>
|
||||||
|
</LayoutView>
|
||||||
|
</NotFound>
|
||||||
|
</Router>
|
39
Demos.Web/Demos.Web.KNI.csproj
Normal file
39
Demos.Web/Demos.Web.KNI.csproj
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<AssemblyName>MLEM Web Demos</AssemblyName>
|
||||||
|
<RootNamespace>Demos.Web</RootNamespace>
|
||||||
|
<DefineConstants>$(DefineConstants);KNI</DefineConstants>
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
<KniPlatform>BlazorGL</KniPlatform>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Demos\Demos.KNI.csproj" />
|
||||||
|
<ProjectReference Include="..\MLEM.Startup\MLEM.Startup.KNI.csproj" />
|
||||||
|
<ProjectReference Include="..\MLEM.Ui\MLEM.Ui.KNI.csproj" />
|
||||||
|
<ProjectReference Include="..\MLEM\MLEM.KNI.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="nkast.Xna.Framework" Version="3.13.9001" />
|
||||||
|
<PackageReference Include="nkast.Xna.Framework.Content" Version="3.13.9001" />
|
||||||
|
<PackageReference Include="nkast.Xna.Framework.Graphics" Version="3.13.9001" />
|
||||||
|
<PackageReference Include="nkast.Xna.Framework.Audio" Version="3.13.9001" />
|
||||||
|
<PackageReference Include="nkast.Xna.Framework.Media" Version="3.13.9001" />
|
||||||
|
<PackageReference Include="nkast.Xna.Framework.Game" Version="3.13.9001" />
|
||||||
|
<PackageReference Include="nkast.Xna.Framework.Input" Version="3.13.9001" />
|
||||||
|
<PackageReference Include="nkast.Xna.Framework.Blazor" Version="3.13.9001" />
|
||||||
|
<PackageReference Include="nkast.Xna.Framework.Content.Pipeline.Builder" Version="3.13.9001" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.3" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.3" PrivateAssets="all" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<KniContentReference Include="..\Demos\Content\Content.mgcb" />
|
||||||
|
<Content Include="..\Demos\Content\*\**" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
7
Demos.Web/MainLayout.razor
Normal file
7
Demos.Web/MainLayout.razor
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
@inherits LayoutComponentBase
|
||||||
|
|
||||||
|
<div class="page">
|
||||||
|
<main>
|
||||||
|
@Body
|
||||||
|
</main>
|
||||||
|
</div>
|
98
Demos.Web/MainLayout.razor.css
Normal file
98
Demos.Web/MainLayout.razor.css
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
.page
|
||||||
|
{
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
||||||
|
{
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar
|
||||||
|
{
|
||||||
|
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-row
|
||||||
|
{
|
||||||
|
background-color: #f7f7f7;
|
||||||
|
border-bottom: 1px solid #d6d5d5;
|
||||||
|
justify-content: flex-end;
|
||||||
|
height: 3.5rem;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-row ::deep a, .top-row ::deep .btn-link
|
||||||
|
{
|
||||||
|
white-space: nowrap;
|
||||||
|
margin-left: 1.5rem;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover
|
||||||
|
{
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-row ::deep a:first-child
|
||||||
|
{
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 640.98px)
|
||||||
|
{
|
||||||
|
.top-row:not(.auth)
|
||||||
|
{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-row.auth
|
||||||
|
{
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-row ::deep a, .top-row ::deep .btn-link
|
||||||
|
{
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 641px)
|
||||||
|
{
|
||||||
|
.page
|
||||||
|
{
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar
|
||||||
|
{
|
||||||
|
width: 250px;
|
||||||
|
height: 100vh;
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-row
|
||||||
|
{
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-row.auth ::deep a:first-child
|
||||||
|
{
|
||||||
|
flex: 1;
|
||||||
|
text-align: right;
|
||||||
|
width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-row, article
|
||||||
|
{
|
||||||
|
padding-left: 2rem !important;
|
||||||
|
padding-right: 1.5rem !important;
|
||||||
|
}
|
||||||
|
}
|
19
Demos.Web/Pages/Index.razor
Normal file
19
Demos.Web/Pages/Index.razor
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
@page "/"
|
||||||
|
@page "/index.html"
|
||||||
|
@inject IJSRuntime JsRuntime
|
||||||
|
|
||||||
|
<PageTitle>MLEM Web Demos</PageTitle>
|
||||||
|
|
||||||
|
<div id="canvasHolder" style="
|
||||||
|
background: #000;
|
||||||
|
margin:0%;
|
||||||
|
position: fixed;
|
||||||
|
top: 0px;
|
||||||
|
right: 0px;
|
||||||
|
bottom: 0px;
|
||||||
|
left: 0px;
|
||||||
|
width:100vw;
|
||||||
|
height:100vh;
|
||||||
|
">
|
||||||
|
<canvas id="theCanvas" style="touch-action:none;"></canvas>
|
||||||
|
</div>
|
29
Demos.Web/Pages/Index.razor.cs
Normal file
29
Demos.Web/Pages/Index.razor.cs
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.JSInterop;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Input;
|
||||||
|
using MLEM.Misc;
|
||||||
|
|
||||||
|
namespace Demos.Web.Pages;
|
||||||
|
|
||||||
|
public partial class Index {
|
||||||
|
|
||||||
|
private Game game;
|
||||||
|
|
||||||
|
protected override async Task OnAfterRenderAsync(bool firstRender) {
|
||||||
|
await base.OnAfterRenderAsync(firstRender);
|
||||||
|
if (firstRender)
|
||||||
|
await this.JsRuntime.InvokeAsync<object>("initRenderJS", DotNetObjectReference.Create(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
[JSInvokable]
|
||||||
|
public void TickDotNet() {
|
||||||
|
if (this.game == null) {
|
||||||
|
MlemPlatform.Current = new MlemPlatform.DesktopGl<TextInputEventArgs>((w, c) => w.TextInput += c);
|
||||||
|
this.game = new GameImpl();
|
||||||
|
this.game.Run();
|
||||||
|
}
|
||||||
|
this.game.Tick();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
22
Demos.Web/Program.cs
Normal file
22
Demos.Web/Program.cs
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
using System;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Components.Web;
|
||||||
|
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
namespace Demos.Web;
|
||||||
|
|
||||||
|
internal static class Program {
|
||||||
|
|
||||||
|
private static async Task Main(string[] args) {
|
||||||
|
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||||
|
builder.RootComponents.Add<App>("#app");
|
||||||
|
builder.RootComponents.Add<HeadOutlet>("head::after");
|
||||||
|
builder.Services.AddScoped(_ => new HttpClient {
|
||||||
|
BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
|
||||||
|
});
|
||||||
|
await builder.Build().RunAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
30
Demos.Web/Properties/launchSettings.json
Normal file
30
Demos.Web/Properties/launchSettings.json
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"iisSettings": {
|
||||||
|
"windowsAuthentication": false,
|
||||||
|
"anonymousAuthentication": true,
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "http://localhost:56897",
|
||||||
|
"sslPort": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"profiles": {
|
||||||
|
"Demos.Web": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": true,
|
||||||
|
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
||||||
|
"applicationUrl": "http://localhost:5259",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"IIS Express": {
|
||||||
|
"commandName": "IISExpress",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
10
Demos.Web/_Imports.razor
Normal file
10
Demos.Web/_Imports.razor
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
@using System.Net.Http
|
||||||
|
@using System.Net.Http.Json
|
||||||
|
@using Microsoft.AspNetCore.Components.Forms
|
||||||
|
@using Microsoft.AspNetCore.Components.Routing
|
||||||
|
@using Microsoft.AspNetCore.Components.Web
|
||||||
|
@using Microsoft.AspNetCore.Components.Web.Virtualization
|
||||||
|
@using Microsoft.AspNetCore.Components.WebAssembly.Http
|
||||||
|
@using Microsoft.JSInterop
|
||||||
|
@using nkast.Wasm.Canvas
|
||||||
|
@using Demos.Web
|
2
Demos.Web/wwwroot/Content/.gitignore
vendored
Normal file
2
Demos.Web/wwwroot/Content/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
*
|
||||||
|
!.gitignore
|
94
Demos.Web/wwwroot/css/app.css
Normal file
94
Demos.Web/wwwroot/css/app.css
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
|
||||||
|
html, body
|
||||||
|
{
|
||||||
|
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1:focus
|
||||||
|
{
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a, .btn-link
|
||||||
|
{
|
||||||
|
color: #0077cc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary
|
||||||
|
{
|
||||||
|
color: #fff;
|
||||||
|
background-color: #1b6ec2;
|
||||||
|
border-color: #1861ac;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content
|
||||||
|
{
|
||||||
|
padding-top: 1.1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.valid.modified:not([type=checkbox])
|
||||||
|
{
|
||||||
|
outline: 1px solid #26b050;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invalid
|
||||||
|
{
|
||||||
|
outline: 1px solid red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.validation-message
|
||||||
|
{
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
#blazor-error-ui
|
||||||
|
{
|
||||||
|
background: lightyellow;
|
||||||
|
bottom: 0;
|
||||||
|
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
|
||||||
|
display: none;
|
||||||
|
left: 0;
|
||||||
|
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
|
||||||
|
position: fixed;
|
||||||
|
width: 100%;
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#blazor-error-ui .dismiss
|
||||||
|
{
|
||||||
|
cursor: pointer;
|
||||||
|
position: absolute;
|
||||||
|
right: 0.75rem;
|
||||||
|
top: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blazor-error-boundary
|
||||||
|
{
|
||||||
|
background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
|
||||||
|
padding: 1rem 1rem 1rem 3.7rem;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blazor-error-boundary::after
|
||||||
|
{
|
||||||
|
content: "An error has occurred."
|
||||||
|
}
|
||||||
|
|
||||||
|
#theCanvas
|
||||||
|
{
|
||||||
|
position: fixed;
|
||||||
|
top: 0px;
|
||||||
|
right: 0px;
|
||||||
|
bottom: 0px;
|
||||||
|
left: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#canvas
|
||||||
|
{
|
||||||
|
position: fixed;
|
||||||
|
top: 0px;
|
||||||
|
right: 0px;
|
||||||
|
bottom: 0px;
|
||||||
|
left: 0px;
|
||||||
|
}
|
7
Demos.Web/wwwroot/css/bootstrap/bootstrap.min.css
vendored
Normal file
7
Demos.Web/wwwroot/css/bootstrap/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
Demos.Web/wwwroot/css/bootstrap/bootstrap.min.css.map
Normal file
1
Demos.Web/wwwroot/css/bootstrap/bootstrap.min.css.map
Normal file
File diff suppressed because one or more lines are too long
BIN
Demos.Web/wwwroot/favicon.ico
Normal file
BIN
Demos.Web/wwwroot/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
111
Demos.Web/wwwroot/index.html
Normal file
111
Demos.Web/wwwroot/index.html
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||||
|
<title>MLEM Web Demos</title>
|
||||||
|
<base href="./" />
|
||||||
|
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
|
||||||
|
<link href="css/app.css" rel="stylesheet" />
|
||||||
|
<link href="Demos.Web.styles.css" rel="stylesheet" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="app">
|
||||||
|
<div id="loading" style="display: table-cell; margin: auto; width:100vw; height:100vh; vertical-align: middle; background: #ffcc10;">
|
||||||
|
<div style="display: block; margin: auto; width: 9em; color: white;font-family: 'Segoe UI', sans-serif;">
|
||||||
|
<div style="text-align: center; font-size: 0.85em;">Made with<br/><a href="https://github.com/kniEngine/kni"><img src="kni.png" border="0" alt="Kni"></a></div>
|
||||||
|
<div style="text-align: center; font-size: 1.8em;">loading <marquee style="width:0.9em; vertical-align: bottom;">. . . </marquee></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="blazor-error-ui">
|
||||||
|
An unhandled error has occurred.
|
||||||
|
<a href="" class="reload">Reload</a>
|
||||||
|
<a class="dismiss">?</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="_framework/blazor.webassembly.js" autostart="false"></script>
|
||||||
|
<script type="module">
|
||||||
|
import { BrotliDecode } from './js/decode.min.js';
|
||||||
|
// Set this to enable Brotli (.br) decompression on static webServers
|
||||||
|
// that don't support content compression and http://.
|
||||||
|
var enableBrotliDecompression = false;
|
||||||
|
Blazor.start({
|
||||||
|
loadBootResource: function (type, name, defaultUri, integrity)
|
||||||
|
{
|
||||||
|
if (enableBrotliDecompression === true && type !== 'dotnetjs' && location.hostname !== 'localhost')
|
||||||
|
{
|
||||||
|
return (async function()
|
||||||
|
{
|
||||||
|
const response = await fetch(defaultUri + '.br', { cache: 'no-cache' });
|
||||||
|
if (!response.ok)
|
||||||
|
throw new Error(response.statusText);
|
||||||
|
const originalResponseBuffer = await response.arrayBuffer();
|
||||||
|
const originalResponseArray = new Int8Array(originalResponseBuffer);
|
||||||
|
const contentType = (type === 'dotnetwasm')
|
||||||
|
? 'application/wasm'
|
||||||
|
: 'application/octet-stream';
|
||||||
|
const decompressedResponseArray = BrotliDecode(originalResponseArray);
|
||||||
|
return new Response(decompressedResponseArray,
|
||||||
|
{ headers: { 'content-type': contentType }
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script src="_content/nkast.Wasm.Dom/js/JSObject.8.0.1.js"></script>
|
||||||
|
<script src="_content/nkast.Wasm.Dom/js/Window.8.0.1.js"></script>
|
||||||
|
<script src="_content/nkast.Wasm.Dom/js/Document.8.0.1.js"></script>
|
||||||
|
<script src="_content/nkast.Wasm.Dom/js/Navigator.8.0.1.js"></script>
|
||||||
|
<script src="_content/nkast.Wasm.Dom/js/Gamepad.8.0.1.js"></script>
|
||||||
|
<script src="_content/nkast.Wasm.Dom/js/Media.8.0.1.js"></script>
|
||||||
|
<script src="_content/nkast.Wasm.XHR/js/XHR.8.0.1.js"></script>
|
||||||
|
<script src="_content/nkast.Wasm.Canvas/js/Canvas.8.0.1.js"></script>
|
||||||
|
<script src="_content/nkast.Wasm.Canvas/js/CanvasGLContext.8.0.1.js"></script>
|
||||||
|
<script src="_content/nkast.Wasm.Audio/js/Audio.8.0.1.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function tickJS()
|
||||||
|
{
|
||||||
|
window.theInstance.invokeMethod('TickDotNet');
|
||||||
|
window.requestAnimationFrame(tickJS);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.initRenderJS = (instance) =>
|
||||||
|
{
|
||||||
|
window.theInstance = instance;
|
||||||
|
|
||||||
|
// set initial canvas size
|
||||||
|
var canvas = document.getElementById('theCanvas');
|
||||||
|
var holder = document.getElementById('canvasHolder');
|
||||||
|
canvas.width = holder.clientWidth;
|
||||||
|
canvas.height = holder.clientHeight;
|
||||||
|
// disable context menu on right click
|
||||||
|
canvas.addEventListener("contextmenu", e => e.preventDefault());
|
||||||
|
|
||||||
|
// begin game loop
|
||||||
|
window.requestAnimationFrame(tickJS);
|
||||||
|
};
|
||||||
|
|
||||||
|
window.onkeydown = function(event)
|
||||||
|
{
|
||||||
|
// Prevent Arrows Keys and Spacebar scrolling the outer page
|
||||||
|
// when running inside an iframe. e.g: itch.io embedding.
|
||||||
|
if ([32, 37, 38, 39, 40].indexOf(event.keyCode) > -1)
|
||||||
|
event.preventDefault();
|
||||||
|
};
|
||||||
|
window.onmousewheel = function(event)
|
||||||
|
{
|
||||||
|
// Prevent Mousewheel scrolling the outer page
|
||||||
|
// when running inside an iframe. e.g: itch.io embedding.
|
||||||
|
event.preventDefault();
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
2237
Demos.Web/wwwroot/js/decode.js
Normal file
2237
Demos.Web/wwwroot/js/decode.js
Normal file
File diff suppressed because one or more lines are too long
1
Demos.Web/wwwroot/js/decode.min.js
vendored
Normal file
1
Demos.Web/wwwroot/js/decode.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
Demos.Web/wwwroot/kni.png
Normal file
BIN
Demos.Web/wwwroot/kni.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 423 B |
|
@ -16,6 +16,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.KNI", "Tests\Tests.KN
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MLEM.Extended.KNI", "MLEM.Extended\MLEM.Extended.KNI.csproj", "{A5B22930-DF4B-4A62-93ED-A6549F7B666B}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MLEM.Extended.KNI", "MLEM.Extended\MLEM.Extended.KNI.csproj", "{A5B22930-DF4B-4A62-93ED-A6549F7B666B}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demos.Web.KNI", "Demos.Web\Demos.Web.KNI.csproj", "{F2C126BD-CB8A-4BE9-AD7A-4809D9308023}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -74,5 +76,9 @@ Global
|
||||||
{1A736385-E931-40A9-BBE0-A9286AB2F6B2}.Debug|Any CPU.Build.0 = Debug|x64
|
{1A736385-E931-40A9-BBE0-A9286AB2F6B2}.Debug|Any CPU.Build.0 = Debug|x64
|
||||||
{1A736385-E931-40A9-BBE0-A9286AB2F6B2}.Release|Any CPU.ActiveCfg = Release|x64
|
{1A736385-E931-40A9-BBE0-A9286AB2F6B2}.Release|Any CPU.ActiveCfg = Release|x64
|
||||||
{1A736385-E931-40A9-BBE0-A9286AB2F6B2}.Release|Any CPU.Build.0 = Release|x64
|
{1A736385-E931-40A9-BBE0-A9286AB2F6B2}.Release|Any CPU.Build.0 = Release|x64
|
||||||
|
{F2C126BD-CB8A-4BE9-AD7A-4809D9308023}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{F2C126BD-CB8A-4BE9-AD7A-4809D9308023}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{F2C126BD-CB8A-4BE9-AD7A-4809D9308023}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{F2C126BD-CB8A-4BE9-AD7A-4809D9308023}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
Loading…
Reference in a new issue