2024-12-26 14:47:36 +01:00
|
|
|
using System;
|
|
|
|
using Microsoft.JSInterop;
|
|
|
|
using Microsoft.Xna.Framework;
|
2025-01-14 15:38:01 +01:00
|
|
|
using static WindowsPhoneSpeedyBlupi.EnvClasses;
|
2024-12-26 14:47:36 +01:00
|
|
|
|
|
|
|
namespace WindowsPhoneSpeedyBlupi.Pages
|
|
|
|
{
|
|
|
|
public partial class Index
|
|
|
|
{
|
|
|
|
Game _game;
|
|
|
|
|
|
|
|
protected override void OnAfterRender(bool firstRender)
|
|
|
|
{
|
|
|
|
base.OnAfterRender(firstRender);
|
|
|
|
|
|
|
|
if (firstRender)
|
|
|
|
{
|
|
|
|
JsRuntime.InvokeAsync<object>("initRenderJS", DotNetObjectReference.Create(this));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
[JSInvokable]
|
|
|
|
public void TickDotNet()
|
|
|
|
{
|
|
|
|
// init game
|
|
|
|
if (_game == null)
|
|
|
|
{
|
2025-01-14 15:38:01 +01:00
|
|
|
Env.init(Impl.KNI, Platform.Web);
|
2024-12-26 16:24:31 +01:00
|
|
|
_game = new Game1();
|
2024-12-26 14:47:36 +01:00
|
|
|
_game.Run();
|
|
|
|
}
|
|
|
|
|
|
|
|
// run gameloop
|
|
|
|
_game.Tick();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|