Commit Graph

154 Commits

Author SHA1 Message Date
Antonio Niño Díaz
d892d6cc8a library: Fix '\n' in NF_WriteText16()
Also, slightly rework the code of NF_WriteText() to match the code sytle
of the rest of the library.
2024-07-06 12:44:24 +01:00
Antonio Niño Díaz
70fe30ef29 library: Fix typo 2024-06-22 11:27:25 +01:00
Antonio Niño Díaz
418791f8f2 library: Update extensions of custom maps and fonts
It's better to use the natural extensions of grit rather than the modified
extensions of NFLib. Update the documentation to reflect that.

Also, remove references to bat scripts.
2024-06-20 01:22:50 +01:00
Antonio Niño Díaz
e2a8e1ad4d examples: Remove duplicated assets conversion script 2024-06-20 01:22:50 +01:00
BG2CNT
c5c64a5cc1
library: fix up "\n" bug in NF_WriteText 2024-06-17 22:56:46 +02:00
BG2CNT
92007d25f8
library: Fix version number 2024-06-17 16:33:22 +01:00
Antonio Niño Díaz
e7ec60cf47 docs: Update changelog 2024-06-08 12:50:52 +01:00
Antonio Niño Díaz
e6567ee10f library: Improve error checking when loading files 2024-06-03 02:20:28 +01:00
Antonio Niño Díaz
71700aab03 examples: Fix tilechange example
Using a different version of grit has changed slightly the output. The code
needs to be updated to use the new tile indices.
2024-06-03 02:00:22 +01:00
Antonio Niño Díaz
72010704c4 examples: Update scripts to use grit from BlocksDS
This version of grit lets the user export binary file without ".bin"
after ".img", ".pal" or ".map", so the conversion scripts can be simplified
a lot.

All the converted files have been regenerated.
2024-06-03 01:08:07 +01:00
Antonio Niño Díaz
194561993a build: docs: example: Set BlocksDS as primary toolchain
The main reason is that BlocksDS doesn't have any bug with NitroFS, and
NitroFS is strictly required to use NFlib. With devkitPro, melonDS won't be
able to run any program made with NFlib due to a bug with NitroFS.
2024-06-03 00:27:39 +01:00
Antonio Niño Díaz
3b106b9f36 docs: Add note about ArchitectDS to the readme 2024-06-01 02:03:16 +01:00
Antonio Niño Díaz
537748791e docs: Update changelog 2024-03-30 11:52:23 +00:00
Antonio Niño Díaz
e9f12e4aee templates: examples: Fix linker invocation for C++
Using g++ to link object files automatically links the STD of C++. It looks
like this library is linked outside of the start/end-group commands with
the other libraries, which causes undefined reference errors when linking
C++ projects that use standard library functions that interface with the
OS, like `fopen()`.

Thanks to @lifehackerhansol for the report and testing the fix.
2024-03-26 18:57:01 +00:00
Antonio Niño Díaz
fb3168e87f docs: Turn changelog into a rst file 2024-01-28 02:50:48 +00:00
Antonio Niño Díaz
30bdb320c8 docs: library: Update version to 1.1.1 2024-01-28 02:45:31 +00:00
Antonio Niño Díaz
06557f1773 library: Support colmaps with extensions .map and .img
Currently it is needed to rename the extension of the collision maps
from .img and .map to .dat and .cmp for NFlib to find the files. This
patch makes it also try to load the original extensions so that the
renaming isn't required.
2023-12-24 03:05:46 +01:00
Antonio Niño Díaz
ba8ba3c3b3 library: Add helper to detect if a file exists 2023-12-24 03:05:33 +01:00
Antonio Niño Díaz
331eee9737 library: Support fonts with extension .img
Currently it is needed to rename the extension of the font to .fnt from
.img for NFlib to find the files. This patch makes it also try to load a
.img file so that the renaming isn't required.
2023-12-24 02:48:44 +01:00
Antonio Niño Díaz
edc0326f1a docs: library: Update changelog and version number to 1.1.0 2023-11-16 02:51:07 +00:00
Antonio Niño Díaz
5c0ae4ad1e build: Fix name of filesystem variables 2023-11-11 14:31:25 +00:00
Antonio Niño Díaz
e5e72057e0 build: Update BlocksDS makefiles 2023-11-11 14:00:13 +00:00
Antonio Niño Díaz
05610e6f8b library: Add missing include 2023-07-15 11:28:54 +01:00
Antonio Niño Díaz
02321a1864 library: Delete 3D sprites when overwriten
When a 3D sprite is created on top of a previously created 3D sprite, it
is needed to delete the previous one. If not, the sprite count will be
incorrect.

This doesn't happen with other subsystems of the library.
2023-06-05 23:51:40 +01:00
Antonio Niño Díaz
0e185267fa library: Improve handling of 3D sprite textures
All state is set when the textures are created, there is no need to
clear it when the textures are deleted.
2023-06-05 23:47:15 +01:00
Antonio Niño Díaz
0ab104caa0 examples: Improve 3D sprite deletion example 2023-06-05 23:45:43 +01:00
Antonio Niño Díaz
6be1dfa154 examples: Add example of deleting 3D sprites 2023-06-05 22:21:05 +01:00
Antonio Niño Díaz
90287a7133 library: Simplify struct handling of 3D sprites
Only initialize the structure when a new sprite is created. The "inuse"
field of the struct is enough to disable it completely, and the state
is set to the default values when it is created again.
2023-06-05 21:27:13 +01:00
Antonio Niño Díaz
5c31f779c8 library: Small style fixes 2023-06-05 21:12:18 +01:00
Antonio Niño Díaz
e3fbe8dbec examples: Turn some bitshifts into multiplications for clarity 2023-06-05 20:01:20 +01:00
Antonio Niño Díaz
33e9ba783e library: Remove unused collision map fields
They don't have a palette.
2023-05-30 22:51:53 +01:00
Antonio Niño Díaz
aef2292857 library: Share most code that loads file from the filesystem
Instead of repeating the same code whenever a file needs to be loaded,
move it to a function.
2023-05-30 22:50:22 +01:00
Antonio Niño Díaz
ce24bbc52e library: Small cleanup 2023-05-30 22:48:47 +01:00
Antonio Niño Díaz
e15a8402b5 library: Cleanup memory allocation
Only call calloc() if the buffer actually needs to be zeroed. For
buffers that are going to be filled right away, malloc() is faster.
2023-05-30 01:47:45 +01:00
Antonio Niño Díaz
039eda9343 library: Replace some shifts by multiplications and divisions 2023-05-30 01:37:01 +01:00
Antonio Niño Díaz
470c39d031 library: Add copyright notice 2023-05-29 23:25:36 +01:00
Antonio Niño Díaz
021a5a0048 library: Cleanup and translate the remaining source files 2023-05-29 23:15:53 +01:00
Antonio Niño Díaz
18fc4a63ba library: Cleanup and translate more source files 2023-05-28 02:09:25 +01:00
Antonio Niño Díaz
0329934b90 library: Cleanup and translate some source files 2023-05-26 00:54:32 +01:00
Antonio Niño Díaz
0428b7a1ea library: Translate file headers 2023-05-25 22:11:19 +01:00
Antonio Niño Díaz
5280f3fe64 library: Cleanup affine background source files 2023-05-25 21:56:27 +01:00
Antonio Niño Díaz
89c6c00f9a docs: Fix note in readme 2023-05-25 02:00:51 +01:00
Antonio Niño Díaz
6fc5d73d80 library: Cleanup and translate some source files 2023-05-25 02:00:31 +01:00
Antonio Niño Díaz
2f13ecd7b8 library: Cleanup and translate 256 color sprite module 2023-05-24 02:53:36 +01:00
Antonio Niño Díaz
e1506cc74f library: Cleanup of types
Types like u8 and u16 aren't always a good idea. For example:

    void function(u8 x, u8 y)
    {
        u32 value = (x << 16) | y;
    }

The left shift of x will overflow because x is 8 bits wide. It is better
to make both arguments 32 bit wide.

It may also cause the compiler to introduce bit masking operations at
the caller side because the caller doesn't know how the function
behaves internally.

In order to prevent this kind of issues, it's better to use 32 bit
variables unless there is a very good reason to use smaller types (like
in structs, to save RAM).
2023-05-24 02:53:36 +01:00
Antonio Niño Díaz
f9d6b71a40 library: Translate and cleanup more source files 2023-05-23 02:16:53 +01:00
Antonio Niño Díaz
5150862e16 library: Translate and cleanup more source files 2023-05-22 01:02:17 +01:00
Antonio Niño Díaz
08798c9260 docs: Clarify installation instructions on Windows 2023-05-21 23:08:48 +01:00
Antonio Niño Díaz
dc67afb8c9 library: Translate and cleanup some source files 2023-05-21 22:29:57 +01:00
Antonio Niño Díaz
c3d6122d95 library: Mark NF_Error as noreturn 2023-05-21 22:23:21 +01:00