NFlib: Difference between revisions

From GameBrew
No edit summary
No edit summary
 
(23 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Infobox homebrew
{{Infobox DS Homebrews
| title       = NFlib  
|title=NFlib
| image       = [[File:Nightfoxslibds.png]]
|image=Nflib4.png
| type       = PC utility
|description=An alternative to PAlib.
| version     = 8 Oct 2020
|author=KnightFox (NightFox)
| licence    = Mixed
|lastupdated=2023/11/16
| author      = KnightFox (NightFox)
|type=Development Libraries
| website     = https://nightfoxandco.com/?page_id=52
|version=1.1.1
| download    = https://github.com/knightfox75/nds_nflib
|license=Mixed
| source      = https://github.com/knightfox75/nds_nflib
|download=https://dlhb.gamebrew.org/dshomebrew/nflib.7z
}}  
|website=https://nightfoxandco.com/?page_id=52
|source=https://github.com/knightfox75/nds_nflib
|donation=https://www.buymeacoffee.com/knightfox75
}}
NightFox’s Lib (NFlib) is a library written in C that is  developed to facilitate programming for the DS. Based on Libnds of devkitArm, our library contains functions witch make the use of backgrounds, sprites, collision maps, etc much easier.


NightFox’s Lib is a library written in C that is developed to facilitate programming for the DS. Based on Libnds of devkitArm, our library contains functions witch make the use of backgrounds, sprites, collision maps, etc much easier.
==Features==
* 256 color tilemaps:
** You can load them from FAT or NitroFS, and you may load up to 32 in RAM.
** The size must be a multiple of 256 pixels.
** Extended palettes are supported (up to 16 palettes of 256 colors per bg).
** VRAM is setup so that you can use 96 KB for tiles and 32 KB for maps per screen.
** "Infinite maps" are supported, using the technique "bank swap", which keeps the map in RAM all the time and copies to VRAM only the part that is being shown. The only limitation is the tileset size, which must not be over 96 KB for all 4 layers.
** Scroll is supported, and parts of the map are loaded to VRAM as they are needed.
** It is possible to show or hide backgrounds, unload them from RAM, modify tiles in the map at runtime, change the palette, etc.
* 256 color sprites:
** You may load up to 256 objects (128 per screen) and 64 palettes.
** You can hide sprites, rotate them, change their size, flip them, etc.
** Animated sprites are supported, with no frame limit. You can choose if the frames are stored in VRAM or only the image being shown in that moment.
** It is possible to modify the palettes at runtime to create visual effects.
* Text engine:
** Based on tiled backgrounds.
** It supports 8x8 and 8x16 pixel fonts.
** 256 color font are supported.
** You can use fonts already colored or you can define their colors at runtime.
** You can rotate them by 90 degrees and scroll them.
** You need to load a font per background layer that will use it.
* Sound:
** Basic support to load RAW audio files from FAT or NitroFS.
** It uses libnds to play them.
** You can load up to 32 sounds to RAM.
* Collision maps:
** The library supports collision maps that can be edited at runtime.
** Up to 32 mapx can be loaded at the same time in RAM.
* 8 and 16 bit backgrounds:
** Useful to display images with a higher detail that tiled maps.
** There are functions to load them and edit them.
** You may load up to 16 images in total.
** There is backbuffer support.
* Media:
** The library supports loading 8, 16, and 24 bit BMP files.
* 3D sprites:
** They use the 3D engine of the console to display up to 256 sprites.
** The maximum size is 1024x1024.
** You may rotate them, scale them, and define up to 62 transparency configurations.
* WiFi:
** Basic WiFi support.
** Functions for basic UDP communications.
* Examples:
** Lots of examples are available to see how to use the library.
* Documentation:
** Available in PDF format in English and Spanish.
* License:
** The library is licensed under the MIT license.
** The assets in this repository are licensed under the CC-BY-4.0 license.
** The examples are licensed under the CC0 license.


'''Note from developer:'''
==User guide==
=== Setup instructions for devkitPro ===
Clone this repository. Create a symbolic link to it inside the devkitPro folder in your system. For example, in Linux, create a symlink so that <code>/opt/devkitpro/nflib</code> points to the folder with NFlib:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto">


The library has not been updated for an extended period of time, it does not work as-is in the [https://devkitpro.org/ latest versions of libNDS]. A recompile of the library using the latest version of libNDS solves the problem. In the library's own compressed file there is a directory to perform this recompilation.
<pre>ln -sT /path/to/nds_nflib /opt/devkitpro/nflib</pre>


==Features==
If this doesn't work, copy the folder of NFlib to the devkitPro folder and rename it to <code>nflib</code>.
* Support for 256 color Tiled Backgrounds.
Go to the <code>nflib</code> folder and type this on the terminal:
* Support for 256 color Sprites.
 
* Text Engine.
<pre>make</pre>
* Sound.
 
* Collision maps.
That's it! Go to the folder of any of the examples and try to build it with:
* 8 and 16 bits backgrounds.
 
* Media.
<pre>make</pre>
* 3D Sprites.
 
* WIFI.
=== Setup instructions for BlocksDS ===
* Examples.
Clone this repository. If you have followed the tutorial of [https://github.com/blocksds/sdk BlocksDS], you should have the compiler in your <code>PATH</code>. All you have to do is go to the folder of the repository and run:</p>
* Documentation.
 
<pre>make -f Makefile.blocksds install</pre>


==User guide==
That's it! Go to the folder of any of the examples and try to build it with:</p>
Inside the folder there is a folder LIB NF_LIB within folders icon, Makefile, Source and WiFi. In the root of your project (where the default makefile) ICON.BMP copy files and Makefile that may need (they are in separate folders).


Then copy the entire contents of the source folder in your source folder. To use the library only have to include # include "nf_lib.h" in code and # include "nf_wifi.h" if want to use wifi.
<pre>make -f Makefile.blocksds</pre>


You will find a complete documentation in PDF, with a complete description of all functions.
==Changelog==
'''1.1.1'''
*Support files with the default extensions generated by grit instead of the old custom extensions of NFlib (img, pal, map instead of fnt, dat and cmp).
'''1.1'''
* Translate examples comments in library to English.
* Cleanup examples and library files.
* Improve deletion code of 3D sprites
* Update BlocksDS makefiles.
* A few minor fixes.
'''1.00'''
* Add original assets and conversion scripts to all examples.
* Start using semver for the version number of the library.
* Big cleanup of the library headers.
* Switch documentation to Doxygen.
* Move WiFi functions to the main library.
* Added support for BlocksDS.


==External links==
==External links==
Line 41: Line 112:
* GitHub - https://github.com/knightfox75/nds_nflib
* GitHub - https://github.com/knightfox75/nds_nflib


<br>
[[Category:DS homebrew applications]]
[[Category:DS homebrew applications]]
[[Category:PC utilities for DS]]
[[Category:PC utilities for DS]]
[[Category:Support the author]]

Latest revision as of 03:19, 28 January 2024

NFlib
Nflib4.png
General
AuthorKnightFox (NightFox)
TypeDevelopment Libraries
Version1.1.1
LicenseMixed
Last Updated2023/11/16
Links
Download
Website
Source
Support Author

NightFox’s Lib (NFlib) is a library written in C that is developed to facilitate programming for the DS. Based on Libnds of devkitArm, our library contains functions witch make the use of backgrounds, sprites, collision maps, etc much easier.

Features

  • 256 color tilemaps:
    • You can load them from FAT or NitroFS, and you may load up to 32 in RAM.
    • The size must be a multiple of 256 pixels.
    • Extended palettes are supported (up to 16 palettes of 256 colors per bg).
    • VRAM is setup so that you can use 96 KB for tiles and 32 KB for maps per screen.
    • "Infinite maps" are supported, using the technique "bank swap", which keeps the map in RAM all the time and copies to VRAM only the part that is being shown. The only limitation is the tileset size, which must not be over 96 KB for all 4 layers.
    • Scroll is supported, and parts of the map are loaded to VRAM as they are needed.
    • It is possible to show or hide backgrounds, unload them from RAM, modify tiles in the map at runtime, change the palette, etc.
  • 256 color sprites:
    • You may load up to 256 objects (128 per screen) and 64 palettes.
    • You can hide sprites, rotate them, change their size, flip them, etc.
    • Animated sprites are supported, with no frame limit. You can choose if the frames are stored in VRAM or only the image being shown in that moment.
    • It is possible to modify the palettes at runtime to create visual effects.
  • Text engine:
    • Based on tiled backgrounds.
    • It supports 8x8 and 8x16 pixel fonts.
    • 256 color font are supported.
    • You can use fonts already colored or you can define their colors at runtime.
    • You can rotate them by 90 degrees and scroll them.
    • You need to load a font per background layer that will use it.
  • Sound:
    • Basic support to load RAW audio files from FAT or NitroFS.
    • It uses libnds to play them.
    • You can load up to 32 sounds to RAM.
  • Collision maps:
    • The library supports collision maps that can be edited at runtime.
    • Up to 32 mapx can be loaded at the same time in RAM.
  • 8 and 16 bit backgrounds:
    • Useful to display images with a higher detail that tiled maps.
    • There are functions to load them and edit them.
    • You may load up to 16 images in total.
    • There is backbuffer support.
  • Media:
    • The library supports loading 8, 16, and 24 bit BMP files.
  • 3D sprites:
    • They use the 3D engine of the console to display up to 256 sprites.
    • The maximum size is 1024x1024.
    • You may rotate them, scale them, and define up to 62 transparency configurations.
  • WiFi:
    • Basic WiFi support.
    • Functions for basic UDP communications.
  • Examples:
    • Lots of examples are available to see how to use the library.
  • Documentation:
    • Available in PDF format in English and Spanish.
  • License:
    • The library is licensed under the MIT license.
    • The assets in this repository are licensed under the CC-BY-4.0 license.
    • The examples are licensed under the CC0 license.

User guide

Setup instructions for devkitPro

Clone this repository. Create a symbolic link to it inside the devkitPro folder in your system. For example, in Linux, create a symlink so that /opt/devkitpro/nflib points to the folder with NFlib:

ln -sT /path/to/nds_nflib /opt/devkitpro/nflib

If this doesn't work, copy the folder of NFlib to the devkitPro folder and rename it to nflib. Go to the nflib folder and type this on the terminal:

make

That's it! Go to the folder of any of the examples and try to build it with:

make

Setup instructions for BlocksDS

Clone this repository. If you have followed the tutorial of BlocksDS, you should have the compiler in your PATH. All you have to do is go to the folder of the repository and run:

make -f Makefile.blocksds install
That's it! Go to the folder of any of the examples and try to build it with:

make -f Makefile.blocksds

Changelog

1.1.1

  • Support files with the default extensions generated by grit instead of the old custom extensions of NFlib (img, pal, map instead of fnt, dat and cmp).

1.1

  • Translate examples comments in library to English.
  • Cleanup examples and library files.
  • Improve deletion code of 3D sprites
  • Update BlocksDS makefiles.
  • A few minor fixes.

1.00

  • Add original assets and conversion scripts to all examples.
  • Start using semver for the version number of the library.
  • Big cleanup of the library headers.
  • Switch documentation to Doxygen.
  • Move WiFi functions to the main library.
  • Added support for BlocksDS.

External links

Advertising: