Skip to content

Commit

Permalink
Templates for beta2
Browse files Browse the repository at this point in the history
  • Loading branch information
Thraka committed Oct 11, 2023
1 parent 824f3b6 commit f1e6c1e
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 8 deletions.
2 changes: 1 addition & 1 deletion templates/SadConsole.Templates.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<PackageType>Template</PackageType>
<PackageVersion>10.0.5</PackageVersion>
<PackageVersion>10.0.8</PackageVersion>
<PackageId>SadConsole.Templates</PackageId>
<Title>SadConsole Game Templates</Title>
<Authors>Thraka</Authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{
"modifiers": [
{
"copyOnly": [ "DemoRotated.MonoGame.cs", "DemoRotated.SFML.cs" ]
"copyOnly": [ "*.MonoGame.cs", "*.SFML.cs" ]
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SadConsole.FontEditing;

namespace SadConsole.Examples;
internal class DemoFontManipulation
{
/*
public void test()
{
// Some surface that's 1x1 and you've composed and done at least one render pass on it
// You must use the original font size as you'll be using it pixel-by-pixel
SadConsole.ScreenSurface surfaceObject = new(1, 1, MyCustomFont);
// You want transparent background for the rendering
surfaceObject.Surface.DefaultBackground = Color.Transparent;
surfaceObject.Surface.Clear();
// Base cell, you always want transparent background
surfaceObject.SetGlyph(0, 0, 22, Color.Yellow, Color.Transparent, Mirror.None, SomeDecorators...);
// Render the surface, and you want to force a render no matter what. These flags are probably overkill
// but I don't know how you'll be working with your objects...
surfaceObject.ForceRendererRefresh = true;
surfaceObject.Render(TimeSpan.Zero);
// Find a font you want to expand with a new glyph
SadFont font = YourFontToExpand;
// This is the last glyph index in the font currently, Cols * Rows
int lastGlyphIndex = font.TotalGlyphs;
// Add a new row of glyphs to the font, so first index will be what font.TotalGlyphs was
font.Edit_AddRows(1);
// Get the pixel data from the custom glyph after your surface was rendered. This is where it was rendered to.
Color[] pixels = ((SadConsole.Renderers.ScreenSurfaceRenderer)surfaceObject.Renderer).Output.GetPixels();
Color[]? cachedPixelsUnused = null;
// Add the custom glyph to the first glyph of the new row
font.Edit_SetGlyph_Pixel(lastGlyphIndex, pixels, true, ref cachedPixelsUnused!);
}
*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@

<!-- SadConsole related NuGet packages. -->
<ItemGroup Condition=" '$(UseProjectReferences)' != 'true' ">
<PackageReference Condition=" '$(GameHost)' == 'monogame' " Include="SadConsole.Host.MonoGame" Version="10.0.0-beta1-debug" />
<PackageReference Condition=" '$(GameHost)' == 'sfml' " Include="SadConsole.Host.SFML" Version="10.0.0-beta1-debug" />
<PackageReference Include="SadConsole.Extended" Version="10.0.0-beta1-debug" />
<PackageReference Include="SadConsole" Version="10.0.0-beta1-debug" />
<PackageReference Condition=" '$(GameHost)' == 'monogame' " Include="SadConsole.Host.MonoGame" Version="10.0.0-beta2-debug" />
<PackageReference Condition=" '$(GameHost)' == 'sfml' " Include="SadConsole.Host.SFML" Version="10.0.0-beta2-debug" />
<PackageReference Include="SadConsole.Extended" Version="10.0.0-beta2-debug" />
<PackageReference Include="SadConsole" Version="10.0.0-beta2-debug" />
</ItemGroup>

<!-- MonoGame host requires you to choose which library you want to use. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<ItemGroup>
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.1.303" />
<PackageReference Include="SadConsole.Host.MonoGame" Version="10.0.0" />
<PackageReference Include="SadConsole.Host.MonoGame" Version="10.0.0-beta2-debug" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="SadConsole.Host.SFML" Version="10.0.0" />
<PackageReference Include="SadConsole.Host.SFML" Version="10.0.0-beta2-debug" />
</ItemGroup>

</Project>

0 comments on commit f1e6c1e

Please sign in to comment.