Closed jonyluke closed 5 years ago
I would be fine either way.
Also another comment: This example should probably use romfs, and a small royalty free mp3 inside romfs; to make it work out of the box.
SDL2 examples should use sdl2-config. See https://github.com/switchbrew/switch-examples/blob/master/graphics/sdl2/sdl2-simple/Makefile#L55 & https://github.com/switchbrew/switch-examples/blob/master/graphics/sdl2/sdl2-simple/Makefile#L62
Also: I think if we're going to add more sdl2 examples then we should probably move them all to an sdl2 folder rather than sub folders in other categories. Thoughts @fincs & @yellows8 ?
I've tried that, but compilation fails
"compilation fails" What errors?
A few lines of make
linking sdl2-audio.elf
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.3.0/../../../../aarch64-none-elf/bin/ld.exe: main.o: in function `main':
C:/Users/jony8/projects/sdl2-audio/source/main.c:26: undefined reference to `Mix_Init'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.3.0/../../../../aarch64-none-elf/bin/ld.exe: C:/Users/jony8/projects/sdl2-audio/source/main.c:30: undefined reference to `Mix_OpenAudio'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.3.0/../../../../aarch64-none-elf/bin/ld.exe: C:/Users/jony8/projects/sdl2-audio/source/main.c:33: undefined reference to `Mix_LoadMUS'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.3.0/../../../../aarch64-none-elf/bin/ld.exe: C:/Users/jony8/projects/sdl2-audio/source/main.c:49: undefined reference to `Mix_PlayMusic'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.3.0/../../../../aarch64-none-elf/bin/ld.exe: C:/Users/jony8/projects/sdl2-audio/source/main.c:56: undefined reference to `Mix_FreeMusic'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [/opt/devkitpro/libnx/switch_rules:80: /home/jony8/projects/sdl2-audio/sdl2-audio.elf] Error 1
make: *** [Makefile:165: build] Error 2
Now it works
Added romfs and a sound Sound is from https://freesound.org/people/jens.enk/sounds/434610/
SDL2 examples should use sdl2-config. See https://github.com/switchbrew/switch-examples/blob/master/graphics/sdl2/sdl2-simple/Makefile#L55 & https://github.com/switchbrew/switch-examples/blob/master/graphics/sdl2/sdl2-simple/Makefile#L62
Also: I think if we're going to add more sdl2 examples then we should probably move them all to an sdl2 folder rather than sub folders in other categories. Thoughts @fincs & @yellows8 ?