Template for CPP3DS

arc13 f7b74f445e Removed MP3 to avoid dependency problems 7 years ago
external 26c70d4b61 Initial commit 7 years ago
res 26c70d4b61 Initial commit 7 years ago
src f7b74f445e Removed MP3 to avoid dependency problems 7 years ago
test 26c70d4b61 Initial commit 7 years ago
.gitignore 26c70d4b61 Initial commit 7 years ago
.gitmodules 26c70d4b61 Initial commit 7 years ago
CMakeLists.txt f7b74f445e Removed MP3 to avoid dependency problems 7 years ago
README.md a989cf33b8 Fixed typos 7 years ago

README.md

cpp3ds-template-v2

An updated and more complete template to get started with cpp3ds. Don't forget to check the cpp3ds's documentation.

How to build

You will need at first the cpp3ds library, whose location must be defined in the environment variable CPP3DS.

To build from source on a Linux/UNIX-based system, run the following commands:

mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_EMULATOR=ON -DBUILD_TESTS=ON ..
make -j4

-DCMAKE_BUILD_TYPE can be set to either "Release" or "Debug" (without the quotes):

Release is the mode chosen when you are about to release/update your app, the debugging console on the bottom screen and the FPS counter on the top screen will not be drawn in this mode.

Debug is the mode chosen when you are developing your application, this mode will allow you to see the debugging console and the FPS counter, useful to debug your application.

Compiled files

3DS: The files [project-name].3dsx and [project-name].cia are usable by the 3DS to test your application on the real hardware.

Computer: The file [project-name]-emu is usable to test your application without the needs of install the app on the 3DS.

Note: The emulator can't run libctru's functions.

How to use

You can start to dev your app in the States/DefaultState.cpp file, some examples are in this file.

Random help

  • You can use libctru functions in your cpp3ds project, but you need to put your libctru functions between ##ifndef EMULATION and ##endif. Example:
#include <cpp3ds/Graphics/Sprite.hpp>
##ifndef EMULATION
// 3ds.h must ALWAYS be included between ifndef EMULATION too
#include <3ds.h>
##endif

RandomClass::RandomClass()
{
    // Random things
    cpp3ds::Sprite randomSprite;
    randomSprite.setPosition(5.f, 5.f);
    
    cpp3ds::Uint8 systemLanguage = 0;
##ifndef EMULATION
    // Here, the code will NOT be compiled for the emulator
    // Calling the libctru's function CFGU_GetSystemLanguage
    CFGU_GetSystemLanguage(&systemLanguage);
##endif

    // Other things
}
  • In the CMakeLists.txt file, you will want to modify some values:

L7: project("project-name") - Enter your project name here without space or special characters

L9: APP_TITLE - The title of your app that will appear on the HOME Menu and on other places

L10: APP_DESCRIPTION - The description of your app that will appear on the HOME Menu and on other places

L11: APP_AUTHOR - The author(s) of your app that will appear on the HOME Menu and on other places

L15: APP_VERSION - The version of your app, each update of your app have to see this number incremented, checkout my converter for Linux

L18: APP_UNIQUE_ID - The product ID of your app, must be an hexadecimal value

  • You can find your app's icon, banner, banner sound and .rsf in the res/app directory
  • You can put the assets of your app in the res/romfs directory
  • The res/sdmc directory is generated by the emulator to emulate the SD card
  • The generated binaries are in the bin/ directory, when make -j4 is executed, and the compilation is successful, this should include: A [project-name].3dsx and a [project-name].cia file for the 3DS, a [project-name]-emu (the emulator) and a [project-name]-tests file for the computer, and a [project-name].bnr, [project-name].elf and [project-name].smdh file.

Credits