39 lines
848 B
C#
39 lines
848 B
C#
using System;
|
|
using Microsoft.JSInterop;
|
|
using Microsoft.Xna.Framework;
|
|
using static WindowsPhoneSpeedyBlupi.EnvClasses;
|
|
|
|
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)
|
|
{
|
|
Env.init(Impl.KNI, Platform.Web);
|
|
_game = new Game1();
|
|
_game.Run();
|
|
}
|
|
|
|
// run gameloop
|
|
_game.Tick();
|
|
}
|
|
|
|
}
|
|
}
|