mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-10-30 15:06:06 +00:00
SkiaSharp + font
This commit is contained in:
parent
b981bdd4bc
commit
a80d7b26cf
3 changed files with 20 additions and 2 deletions
|
|
@ -22,6 +22,7 @@
|
||||||
<None Remove="OGL.txt" />
|
<None Remove="OGL.txt" />
|
||||||
<None Remove="Pdf\178_hd_01_feuille_de_perso_v1.pdf" />
|
<None Remove="Pdf\178_hd_01_feuille_de_perso_v1.pdf" />
|
||||||
<None Remove="Pdf\AlverataIrregularPEMedium.ttf" />
|
<None Remove="Pdf\AlverataIrregularPEMedium.ttf" />
|
||||||
|
<None Remove="Pdf\BLKCHCRY.TTF" />
|
||||||
<None Remove="Pdf\feuille_de_personnage_editable.pdf" />
|
<None Remove="Pdf\feuille_de_personnage_editable.pdf" />
|
||||||
<None Remove="Pdf\LinLibertine_aBL.ttf" />
|
<None Remove="Pdf\LinLibertine_aBL.ttf" />
|
||||||
<None Remove="Pdf\LinLibertine_aBS.ttf" />
|
<None Remove="Pdf\LinLibertine_aBS.ttf" />
|
||||||
|
|
@ -47,6 +48,7 @@
|
||||||
<EmbeddedResource Include="OGL.txt" />
|
<EmbeddedResource Include="OGL.txt" />
|
||||||
<EmbeddedResource Include="Pdf\178_hd_01_feuille_de_perso_v1.pdf" />
|
<EmbeddedResource Include="Pdf\178_hd_01_feuille_de_perso_v1.pdf" />
|
||||||
<EmbeddedResource Include="Pdf\AlverataIrregularPEMedium.ttf" />
|
<EmbeddedResource Include="Pdf\AlverataIrregularPEMedium.ttf" />
|
||||||
|
<EmbeddedResource Include="Pdf\BLKCHCRY.TTF" />
|
||||||
<EmbeddedResource Include="Pdf\feuille_de_personnage_editable.pdf" />
|
<EmbeddedResource Include="Pdf\feuille_de_personnage_editable.pdf" />
|
||||||
<EmbeddedResource Include="Pdf\LinLibertine_aBL.ttf" />
|
<EmbeddedResource Include="Pdf\LinLibertine_aBL.ttf" />
|
||||||
<EmbeddedResource Include="Pdf\LinLibertine_aBS.ttf" />
|
<EmbeddedResource Include="Pdf\LinLibertine_aBS.ttf" />
|
||||||
|
|
|
||||||
BIN
AideDeJeu/AideDeJeu/Pdf/BLKCHCRY.TTF
Normal file
BIN
AideDeJeu/AideDeJeu/Pdf/BLKCHCRY.TTF
Normal file
Binary file not shown.
|
|
@ -41,12 +41,23 @@ namespace AideDeJeu.Views
|
||||||
float sumx = diceRolls.Sum(kv => kv.Value);
|
float sumx = diceRolls.Sum(kv => kv.Value);
|
||||||
float sizey = info.Height / (maxy - miny + 1);
|
float sizey = info.Height / (maxy - miny + 1);
|
||||||
|
|
||||||
|
SKTypeface typeface = null;
|
||||||
|
var inFont = AideDeJeu.Tools.Helpers.GetResourceStream("AideDeJeu.Pdf.LinLibertine_R.ttf");
|
||||||
|
typeface = SKTypeface.FromStream(inFont);
|
||||||
|
|
||||||
SKPaint strokePaint = new SKPaint()
|
SKPaint strokePaint = new SKPaint()
|
||||||
{
|
{
|
||||||
Color = new SKColor(0x9B, 0x1C, 0x47),
|
Color = new SKColor(0x9B, 0x1C, 0x47),
|
||||||
Style = SKPaintStyle.Stroke,
|
Style = SKPaintStyle.Stroke,
|
||||||
StrokeWidth = 1,
|
StrokeWidth = 1,
|
||||||
TextSize = sizey * 0.8f,
|
};
|
||||||
|
SKPaint strokeFont = new SKPaint()
|
||||||
|
{
|
||||||
|
Color = new SKColor(0x9B, 0x1C, 0x47),
|
||||||
|
Style = SKPaintStyle.Stroke,
|
||||||
|
StrokeWidth = 1,
|
||||||
|
TextSize = sizey * 0.6f,
|
||||||
|
Typeface = typeface
|
||||||
};
|
};
|
||||||
canvas.Clear();
|
canvas.Clear();
|
||||||
foreach (var diceRoll in diceRolls)
|
foreach (var diceRoll in diceRolls)
|
||||||
|
|
@ -54,8 +65,13 @@ namespace AideDeJeu.Views
|
||||||
float x = diceRoll.Value;
|
float x = diceRoll.Value;
|
||||||
float y = diceRoll.Key;
|
float y = diceRoll.Key;
|
||||||
canvas.DrawRect(new SKRect(0, ((y - miny) * sizey), x * info.Width / maxx, ((y - miny) * sizey) + sizey - 5), strokePaint);
|
canvas.DrawRect(new SKRect(0, ((y - miny) * sizey), x * info.Width / maxx, ((y - miny) * sizey) + sizey - 5), strokePaint);
|
||||||
canvas.DrawText($"{y} => {x / sumx * 100:0.00}%", 10, ((y - miny) * sizey) + sizey * 0.8f, strokePaint);
|
|
||||||
|
canvas.DrawText($"{y} => {x / sumx * 100:0.00}%", 10, ((y - miny) * sizey) + sizey * 0.6f, strokeFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typeface.Dispose();
|
||||||
|
strokeFont.Dispose();
|
||||||
|
strokePaint.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue