Commit Graph

139 Commits

Author SHA1 Message Date
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
Antonio Niño Díaz
0672158d1e examples: Remove unused includes 2023-05-21 21:17:28 +01:00
Antonio Niño Díaz
18bb211e32 examples: Add missing makefile 2023-05-21 21:17:06 +01:00
Antonio Niño Díaz
892acee5fb examples: Translate WiFi example messages to English 2023-05-21 21:15:43 +01:00
Antonio Niño Díaz
d923bbec50 examples: Translate asset and variable names to English 2023-05-21 21:11:40 +01:00
Antonio Niño Díaz
498a0a2464 examples: Cleanup and translate the remaining examples to English 2023-05-21 20:31:06 +01:00
Antonio Niño Díaz
4d4cb6ab8e examples: Cleanup and translate more examples to English 2023-05-21 02:25:53 +01:00
Antonio Niño Díaz
af329f901a examples: Fix potential tearing
The image needs to be switched during the vertical blanking period so
that no tearing is shown during the switch.
2023-05-21 00:56:06 +01:00
Antonio Niño Díaz
11b2717515 examples: Cleanup and translate more examples to English 2023-05-21 00:49:40 +01:00
Antonio Niño Díaz
c6d6883caf examples: Cleanup and translate more examples to English 2023-05-20 18:42:39 +01:00
Antonio Niño Díaz
eb91123a9a examples: Fix alpha configuration of 3dsprites/alpha
The backdrop needs to be added to the destination layers. If not,
transparent pixels in the backgrounds won't have correct alpha blending.
2023-05-20 12:44:56 +01:00
Antonio Niño Díaz
25511c82dd examples: Cleanup and translate 3dprites/alpha to English 2023-05-20 12:44:11 +01:00
Antonio Niño Díaz
a097eb3762 examples: Update background scroll before copying frames
Copying a new frame to VRAM takes much longer than updating the scroll,
so it makes sense to update the scroll first as that is guaranteed to
always be fast.
2023-05-20 12:25:14 +01:00
Antonio Niño Díaz
6c221ffea1 examples: Cleanup and translate 3dprites/setlayer to English 2023-05-20 12:24:02 +01:00
Antonio Niño Díaz
b20bb1ca2c examples: Cleanup and translate more examples to English 2023-05-20 02:43:19 +01:00
Antonio Niño Díaz
fa21c62ac4 examples: Cleanup and translate more examples to English 2023-05-19 02:17:59 +01:00