sdl2: fix newlines

sdl2: use correct include for SDL header
sdl2: use sdl-config in makefile
sdl2: move sdl2 sample to root, as it's not only about graphics
This commit is contained in:
Cpasjuste 2018-11-14 13:51:22 +01:00 committed by Dave Murphy
parent 9e7e3b1311
commit d79575ac12
2 changed files with 4 additions and 6 deletions

View File

@ -46,14 +46,15 @@ ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE
CFLAGS := -g -Wall -O2 -ffunction-sections \ CFLAGS := -g -Wall -O2 -ffunction-sections \
$(ARCH) $(DEFINES) $(ARCH) $(DEFINES)
CFLAGS += $(INCLUDE) -D__SWITCH__ CFLAGS += $(INCLUDE) `$(DEVKITPRO)/portlibs/switch/bin/sdl2-config --cflags`
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS := -g $(ARCH) ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
LIBS := -lSDL2 -lglad -lEGL -lglapi -ldrm_nouveau -lnx LIBS := `$(DEVKITPRO)/portlibs/switch/bin/sdl2-config --libs`
#-lSDL2 -lglad -lEGL -lglapi -ldrm_nouveau -lnx
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing # list of directories containing libraries, this must be the top level containing

View File

@ -2,7 +2,7 @@
#include <stdio.h> #include <stdio.h>
#include <switch.h> #include <switch.h>
#include "SDL2/SDL.h" #include <SDL.h>
static SDL_DisplayMode modes[5]; static SDL_DisplayMode modes[5];
@ -112,11 +112,8 @@ int main(int argc, char *argv[])
} }
while (!done) { while (!done) {
while (SDL_PollEvent(&event)) { while (SDL_PollEvent(&event)) {
switch (event.type) { switch (event.type) {
case SDL_JOYAXISMOTION: case SDL_JOYAXISMOTION:
SDL_Log("Joystick %d axis %d value: %d\n", SDL_Log("Joystick %d axis %d value: %d\n",
event.jaxis.which, event.jaxis.which,