mirror of
https://github.com/ZuneDev/Xune.git
synced 2026-07-27 13:13:10 -07:00
Modified UIX libs to allow use from UWP
This commit is contained in:
@@ -3,6 +3,12 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
|
||||
@@ -13,5 +19,9 @@
|
||||
<ItemGroup>
|
||||
<UpToDateCheckInput Include="..\..\Xune.Uno.Shared\**\*.xaml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\UIX.RenderApi.Skia\UIX.RenderApi.Skia.csproj" />
|
||||
<ProjectReference Include="..\..\..\UIX.Skia\UIX.Skia.csproj" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\..\Xune.Uno.Shared\Xune.Uno.Shared.projitems" Label="Shared" />
|
||||
</Project>
|
||||
@@ -1,11 +1,15 @@
|
||||
using SkiaSharp;
|
||||
using SkiaSharp.Views.UWP;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.Core;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
@@ -23,16 +27,40 @@ namespace Xune.Uno
|
||||
/// </summary>
|
||||
public sealed partial class MainPage : Page
|
||||
{
|
||||
readonly Random rand = new Random();
|
||||
DispatcherTimer timer = new DispatcherTimer();
|
||||
|
||||
public MainPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
Task.Run(Microsoft.Iris.Application.Initialize);
|
||||
|
||||
Canvas.PaintSurface += Canvas_PaintSurface;
|
||||
timer.Interval = new TimeSpan(17000);
|
||||
timer.Tick += Timer_Tick;
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
private void Canvas_PaintSurface(object sender, SkiaSharp.Views.UWP.SKPaintSurfaceEventArgs e)
|
||||
private void Timer_Tick(object sender, object e)
|
||||
{
|
||||
e.Surface.Canvas.DrawColor(SKColors.Red);
|
||||
Canvas.Invalidate();
|
||||
}
|
||||
|
||||
ulong t = 0;
|
||||
private void Canvas_PaintSurface(object sender, SKPaintSurfaceEventArgs e)
|
||||
{
|
||||
if (t == ulong.MaxValue)
|
||||
t = 0;
|
||||
byte r = (byte)rand.Next(0, byte.MaxValue);
|
||||
byte g = (byte)rand.Next(0, byte.MaxValue);
|
||||
byte b = (byte)rand.Next(0, byte.MaxValue);
|
||||
e.Surface.Canvas.DrawColor(new SKColor(100, 50, (byte)(t % byte.MaxValue)));
|
||||
t++;
|
||||
}
|
||||
|
||||
//private unsafe void nothing()
|
||||
//{
|
||||
// void*** ptr = (void***)GCHandle.Alloc(new void*[1], GCHandleType.Pinned).AddrOfPinnedObject();
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user