/sdl-hello-world

Draw "hello world" on the screen of the Nintendo Switch

Primary LanguageC

This program draws "Hello world!" on the Nintendo Switch using a bitmap font.

The main code is in hello.c.

To see another simple SDL2 program with graphics and input, see spacenx, or for a more complicated one appstorenx

Compiling

For Switch (libtransistor)

  1. You will need llvm for your computer. You can probably get this through your package manger (eg. brew install llvm, see here for more info)

  2. Setup and install libtransistor by downloading it from the releases page. It is recommended to copy it to /opt/libtransistor.

  3. Export the following environment variable to where you unpacked libtransistor. You may want to put this line in your bash profile:

export LIBTRANSISTOR_HOME=/opt/libtransistor
  1. Clone, setup, and compile sdl-libtransistor:
git clone https://github.com/reswitched/sdl-libtransistor.git
cd sdl-libtransistor
make -f switch.mk
  1. Install pyelftools and lz4via pip
pip3 install pyelftools lz4
  1. Clone this repo and run make:
git clone https://github.com/vgmoose/sdl-hello-world.git
cd sdl-hello-world
make

A file hello.nro should be sitting in your current directory.

For Switch (libnx)

  1. Setup and install dkp-pacman

  2. Install devkitA64 needed Switch dependencies via dkp-pacman:

sudo dkp-pacman -S devkitA64 libnx switch-tools switch-sdl2
  1. Clone this repo and run make:
git clone https://github.com/vgmoose/sdl-hello-world.git
cd sdl-hello-world
make -f Makefile.libnx

A file hello.nro should be sitting in the build folder.

For PC

This program can also be compiled for the computer. There's no Makefile target, but with SDL2 installed:

gcc -lSDL2 *.c -o hello
./hello

Running

You can run this program on most Switches that were released prior to June 2018 regardless of firmware. For detailed instructions, see this post.

You should put the hello.nro file in sd:/switch/hello.nro and then run hbmenu in order to run this app.

If you need additional resources or help, you can feel free to stop by the Homebrew App Store discord server, make an issue on this repo, or contact me directly.