Skip to content
darioccPublic

About

.NET support for manipulating PixTudio, Bennu and Div native formats (Fpg, Map, Fnt and Pal)

Resources

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

 

History

492 Commits

Folders and files

Repository files navigation

FenixLib

.NET License

FenixLib brings .Net support for opening, creating and operating with native graphic, graphic collections, bitmap fonts and palette formats of PixTudio, BennuGD, Div GO and DIV game programming languages and frameworks.

Supported pixel formats are 1bpp aligned packed, 8bpp indexed, 16bpp RGB565 and 32bpp ARGB, i.e. all native graphic file formats.

The following snippet shows how easy is to open a Fpg file, print the codes and description of every map, change the description of map with code 10 and save the changes in a new file.

using FenixLib;
using FenixLib.IO;

// Load a Fpg file
var spriteAssortment = NativeFile.LoadFpg ( "foo.fpg" );

// Print out the code and description of every sprite in the Fpg
foreach ( var sprite in spriteAssortment )
{
  System.Console.WriteLine ( sprite.Id.ToString() + " - " + sprite.Description );
}

// Change the description of Sprite with code 10
spriteAssortment[10].Description = "Bar";

spriteAssortment.SaveToFpg ( "foo-changed.fpg" );

Another example, see how easy you can create a Fnt font file from scratch:

using FenixLib;
using FenixLib.IO;

var font = new BitmapFont ( GraphicFormat.Format32bppArgb, FontEncoding.ISO85591 );

// Create a 10x10 transparent graphic
var glyphGraphic = new Graphic( GraphicFormat.Format32bppArgb, 10, 10, new byte[10 * 10 * 4] );

// Create the glyph and assign it to the letter 'å'
// å is a character that exists in the ISO8559-1 code page.
font['å'] = new Glyph ( glyphGraphic );

// Save the font to a Fnt file (only 'å' will contain a bitmap)
font.SaveToFnt ( "foo.fnt" );

For additional examples and documentation visit the wiki.

Using the library

Add a reference to your .NET project by using the nuget package or building it from the project file. If using dotnet CLI:

dotnet add package FenixLib --version 2.0.0

Check the Core Types section in the wiki to learn about the FenixLib core types of the FenixLib library that are used to manipulate the different types of assets.

Most likely you'll want to load or save those assets from the filesystem. The NativeFile type of the FenixLib.IO namespace is a convenient facade to do exactly that.

You may also check the example projects.

To use FenixLib in Unity, copy FenixLib.dll and System.Text.Encoding.CodePages.dll into Assets/Plugins. Set the plugin API Compatibility Level to .NET Standard 2.1.

Building

FenixLib targets .NET Standard 2.1, the latest API surface supported by Unity 6 (up to 6.7 LTS). It also runs on .NET 5+ and .NET 10. Tests and examples use .NET 10.

Go ahead and make a clone of this repository:

git clone https://github.com/dacucar/fenixlib.git

Then build the FenixLib class-library:

dotnet build fenixlib/FenixLib

There exists some additional projects in the fenixlib folder:

  • FenixLibTests: Tests for the FenixLib assembly.
  • Examples/FenixLibAndGtk.csproj: An example of how to use FenixLib together with Gtk-sharp.

Running unit and integration tests

Test project depend on NUnit 3 and Moq.

Use dotnet test to run the tests:

dotnet test fenixlib/FenixLibTests

Contributing

Pull requests, issues and suggestions are welcomed. If you plan to do a large work it might be a good idea to open an issue and tell a bit about what you intend to use.

License

Copyright 2016 Darío Cutillas Carrillo

FenixLib is distributed under the very permissive Apache License, Version 2.0

You are free to use FenixLib in both commercial and non commercial and open or close source applications as long as you follow the terms of the License.

About

.NET support for manipulating PixTudio, Bennu and Div native formats (Fpg, Map, Fnt and Pal)

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages