mobile-eggbert-kni-web/Pages/Index.razor.cs
2024-12-26 14:47:36 +01:00

37 lines
771 B
C#

using System;
using Microsoft.JSInterop;
using Microsoft.Xna.Framework;
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)
{
_game = new WindowsPhoneSpeedyBlupiGame();
_game.Run();
}
// run gameloop
_game.Tick();
}
}
}