mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-11-01 16:05:42 +00:00
Mumuse skia
This commit is contained in:
parent
1e8109abf0
commit
981cae2440
9 changed files with 113 additions and 0 deletions
|
|
@ -68,6 +68,9 @@
|
|||
<PackageReference Include="SkiaSharp.Svg">
|
||||
<Version>1.60.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="SkiaSharp.Views">
|
||||
<Version>1.68.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="SkiaSharp.Views.Forms">
|
||||
<Version>1.68.0</Version>
|
||||
</PackageReference>
|
||||
|
|
|
|||
|
|
@ -135,6 +135,18 @@
|
|||
<Reference Include="Rg.Plugins.Popup, Version=1.1.5.188, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Rg.Plugins.Popup.1.1.5.188\lib\netstandard1.0\Rg.Plugins.Popup.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SkiaSharp, Version=1.68.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\SkiaSharp.1.68.0\lib\net45\SkiaSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SkiaSharp.Views.Desktop, Version=1.68.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\SkiaSharp.Views.1.68.0\lib\net45\SkiaSharp.Views.Desktop.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SkiaSharp.Views.Gtk, Version=1.68.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\SkiaSharp.Views.1.68.0\lib\net45\SkiaSharp.Views.Gtk.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SkiaSharp.Views.WPF, Version=1.68.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\SkiaSharp.Views.1.68.0\lib\net45\SkiaSharp.Views.WPF.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SQLite-net, Version=1.6.258.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\sqlite-net-pcl.1.6.258-beta\lib\netstandard1.1\SQLite-net.dll</HintPath>
|
||||
</Reference>
|
||||
|
|
@ -305,9 +317,11 @@
|
|||
<Error Condition="!Exists('..\..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.13\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.13\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.4.0.0.346134-pre9\build\Xamarin.Forms.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.4.0.0.346134-pre9\build\Xamarin.Forms.props'))" />
|
||||
<Error Condition="!Exists('..\..\packages\Xamarin.Forms.4.0.0.346134-pre9\build\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.4.0.0.346134-pre9\build\Xamarin.Forms.targets'))" />
|
||||
<Error Condition="!Exists('..\..\packages\SkiaSharp.1.68.0\build\net45\SkiaSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\SkiaSharp.1.68.0\build\net45\SkiaSharp.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.13\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets" Condition="Exists('..\..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.13\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets')" />
|
||||
<Import Project="..\..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.13\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets" Condition="Exists('..\..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.13\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets')" />
|
||||
<Import Project="..\..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.13\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets" Condition="Exists('..\..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.13\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets')" />
|
||||
<Import Project="..\..\packages\Xamarin.Forms.4.0.0.346134-pre9\build\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.4.0.0.346134-pre9\build\Xamarin.Forms.targets')" />
|
||||
<Import Project="..\..\packages\SkiaSharp.1.68.0\build\net45\SkiaSharp.targets" Condition="Exists('..\..\packages\SkiaSharp.1.68.0\build\net45\SkiaSharp.targets')" />
|
||||
</Project>
|
||||
|
|
@ -82,6 +82,10 @@
|
|||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.1.0" newVersion="4.2.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="OpenTK" publicKeyToken="bad199fe84eb3df4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
|
|
@ -24,6 +24,8 @@
|
|||
<package id="OpenTK" version="3.0.1" targetFramework="net471" />
|
||||
<package id="Remotion.Linq" version="2.2.0" targetFramework="net471" />
|
||||
<package id="Rg.Plugins.Popup" version="1.1.5.188" targetFramework="net471" />
|
||||
<package id="SkiaSharp" version="1.68.0" targetFramework="net471" />
|
||||
<package id="SkiaSharp.Views" version="1.68.0" targetFramework="net471" />
|
||||
<package id="sqlite-net-pcl" version="1.6.258-beta" targetFramework="net471" />
|
||||
<package id="SQLitePCLRaw.bundle_green" version="1.1.13" targetFramework="net471" />
|
||||
<package id="SQLitePCLRaw.core" version="1.1.13" targetFramework="net471" />
|
||||
|
|
|
|||
|
|
@ -136,6 +136,9 @@
|
|||
<PackageReference Include="SkiaSharp.Svg">
|
||||
<Version>1.60.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="SkiaSharp.Views">
|
||||
<Version>1.68.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="SkiaSharp.Views.Forms">
|
||||
<Version>1.68.0</Version>
|
||||
</PackageReference>
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@
|
|||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="3.0.0-preview3.19153.1" />
|
||||
<PackageReference Include="Rg.Plugins.Popup" Version="1.1.5.188" />
|
||||
<PackageReference Include="SkiaSharp.Svg" Version="1.60.0" />
|
||||
<PackageReference Include="SkiaSharp.Views" Version="1.68.0" />
|
||||
<PackageReference Include="SkiaSharp.Views.Forms" Version="1.68.0" />
|
||||
<PackageReference Include="sqlite-net-pcl" Version="1.6.258-beta" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.5.1" />
|
||||
|
|
@ -131,6 +132,9 @@
|
|||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resource.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Views\DicesPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Views\Library\BookmarksPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
|
|
|
|||
|
|
@ -103,11 +103,25 @@ namespace AideDeJeu.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
private Command _DicesCommand = null;
|
||||
public Command DicesCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return _DicesCommand ?? (_DicesCommand = new Command(async () => await GotoDicesPageAsync()));
|
||||
}
|
||||
}
|
||||
|
||||
public async Task GotoPlayerCharacterEditorPageAsync()
|
||||
{
|
||||
await Navigation.PushAsync(new Views.PlayerCharacter.PlayerCharacterEditorPage(), true);
|
||||
}
|
||||
|
||||
public async Task GotoDicesPageAsync()
|
||||
{
|
||||
await Navigation.PushAsync(new Views.DicesPage(), true);
|
||||
}
|
||||
|
||||
private Command _DeepSearchCommand = null;
|
||||
public Command DeepSearchCommand
|
||||
{
|
||||
|
|
|
|||
17
AideDeJeu/AideDeJeu/Views/DicesPage.xaml
Normal file
17
AideDeJeu/AideDeJeu/Views/DicesPage.xaml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:skviews="clr-namespace:SkiaSharp.Views.Forms;assembly=SkiaSharp.Views.Forms"
|
||||
x:Class="AideDeJeu.Views.DicesPage">
|
||||
<ContentPage.Content>
|
||||
<StackLayout>
|
||||
<Label Text="Welcome to Xamarin.Forms!"
|
||||
VerticalOptions="CenterAndExpand"
|
||||
HorizontalOptions="CenterAndExpand" />
|
||||
|
||||
<skviews:SKCanvasView PaintSurface="SKCanvasView_PaintSurface">
|
||||
|
||||
</skviews:SKCanvasView>
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
52
AideDeJeu/AideDeJeu/Views/DicesPage.xaml.cs
Normal file
52
AideDeJeu/AideDeJeu/Views/DicesPage.xaml.cs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
using AideDeJeu.ViewModels;
|
||||
using SkiaSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
namespace AideDeJeu.Views
|
||||
{
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
public partial class DicesPage : ContentPage
|
||||
{
|
||||
public DicesPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void SKCanvasView_PaintSurface(object sender, SkiaSharp.Views.Forms.SKPaintSurfaceEventArgs args)
|
||||
{
|
||||
var diceRoller = new DiceRollerViewModel();
|
||||
var diceRolls = diceRoller.DicesValues(6, 3);
|
||||
foreach (var diceRoll in diceRolls)
|
||||
{
|
||||
Debug.WriteLine($"{diceRoll.Key} => {diceRoll.Value / 3}");
|
||||
}
|
||||
|
||||
|
||||
SKImageInfo info = args.Info;
|
||||
SKSurface surface = args.Surface;
|
||||
SKCanvas canvas = surface.Canvas;
|
||||
SKPaint strokePaint = new SKPaint() { Color = new SKColor(255,0,0,128) };
|
||||
canvas.Clear();
|
||||
|
||||
// Draw path with cubic Bezier curve
|
||||
using (SKPath path = new SKPath())
|
||||
{
|
||||
path.MoveTo(0, 0);
|
||||
foreach (var diceRoll in diceRolls)
|
||||
{
|
||||
|
||||
path.LineTo(diceRoll.Key * 20, diceRoll.Value * 20);
|
||||
}
|
||||
canvas.DrawPath(path, strokePaint);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue