任天堂DS编程入门
Introduction to Nintendo DS Programming

原始链接: https://www.patater.com/files/projects/manual/manual.html

项目中的图像转换利用与后台实现相似的流程。“Grit规则文件”被创建以指示“grit”工具如何转换图像,从而生成`.o`文件和头文件。这些文件与原始图像文件一起存储在`gfx>`文件夹中。 转换支持非平铺和平铺图形模式。提供的示例演示了图像数据如何表示为一系列十六进制值 (`u16 data[]`)。平铺模式重复这些数据以填充所需空间,从而有效地创建图案。示例展示了颜色值的渐变,演示了如何通过十六进制表示实现不同的色调,以及如何平铺这些值以创建更大的图形。

## Nintendo DS Programming: A Look Back & Current Resources A Hacker News discussion centers around an introduction to Nintendo DS programming ([patater.com](https://www.patater.com/)). While the original resource is somewhat dated, the conversation highlights the enduring appeal of DS homebrew development. Several users point to more current resources, including updated versions of the guide ([https://www.patater.com/manual-git/](https://www.patater.com/manual-git/)), open-source DS cart options like the LNH-Team cart ([https://www.lnh-team.org/](https://www.lnh-team.org/)), and alternative SDKs like BlocksDS ([https://blocksds.skylyrac.net/](https://blocksds.skylyrac.net/)). The discussion also touches on the relative ease of programming for the DS compared to other consoles, with some arguing the GBA is simpler due to its less complex hardware. The 3DS is also mentioned as a potentially easier platform for modern developers, with better tooling and a more standard development environment. Resources like [gbatek.txt](https://problemkaputt.de/gbatek.txt) are highlighted as comprehensive documentation. Ultimately, the thread showcases a vibrant community still passionate about exploring the possibilities of retro game console development.
相关文章

原文

The conversion process is very similar to that for backgrounds. We simple make grit rule files that tell grit how we want our images converted, and it generates a .o and a header file for us. The grit rule files and image files go into the same place as background images, the gfx> folder.

Figure 6.1.  The upper text shows information as it would be on a non-tiled background. The lower text shows the same data, tiled, for use in tiled graphic modes.

const u16 data[] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0F0F, 0x0F0F, 0x0F0F, 0x0F0F, 0x0F0F, 0x0F0F, 0x0F0F, 0x0F0F,
0x2020, 0x2020, 0x2020, 0x2020, 0x2020, 0x2020, 0x2020, 0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x0000, 0x0000, 0x0000, 0x0000, 0x0F0F, 0x0F0F, 0x0F0F, 0x0F0F,
0x2020, 0x2020, 0x2020, 0x2020, 0x2F2F, 0x2F2F, 0x2F2F, 0x2F2F,
0x4040, 0x4040, 0x4040, 0x4040, 0x4F4F, 0x4F4F, 0x4F4F, 0x4F4F,
0x6060, 0x6060, 0x6060, 0x6060, 0x6F6F, 0x6F6F, 0x6F6F, 0x6F6F,
0x8080, 0x8080, 0x8080, 0x8080, 0x8F8F, 0x8F8F, 0x8F8F, 0x8F8F,
0xA0A0, 0xA0A0, 0xA0A0, 0xA0A0, 0xAFAF, 0xAFAF, 0xAFAF, 0xAFAF,
0xC0C0, 0xC0C0, 0xC0C0, 0xC0C0, 0xCFCF, 0xCFCF, 0xCFCF, 0xCFCF,
0xE0E0, 0xE0E0, 0xE0E0, 0xE0E0, 0xEFEF, 0xEFEF, 0xEFEF, 0xEFEF,
0x8080, 0x8080, 0x8080, 0x8080, 0x8F8F, 0x8F8F, 0x8F8F, 0x8F8F,
0xA0A0, 0xA0A0, 0xA0A0, 0xA0A0, 0xAFAF, 0xAFAF, 0xAFAF, 0xAFAF,
0xC0C0, 0xC0C0, 0xC0C0, 0xC0C0, 0xCFCF, 0xCFCF, 0xCFCF, 0xCFCF,
0xE0E0, 0xE0E0, 0xE0E0, 0xE0E0, 0xEFEF, 0xEFEF, 0xEFEF, 0xEFEF};
                
联系我们 contact @ memedata.com