From d79575ac125f3300af32cb669a37539d7d4a7dc1 Mon Sep 17 00:00:00 2001 From: Cpasjuste Date: Wed, 14 Nov 2018 13:51:22 +0100 Subject: [PATCH] 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 --- {graphics/sdl2 => sdl2}/Makefile | 5 +++-- {graphics/sdl2 => sdl2}/source/main.cpp | 5 +---- 2 files changed, 4 insertions(+), 6 deletions(-) rename {graphics/sdl2 => sdl2}/Makefile (97%) rename {graphics/sdl2 => sdl2}/source/main.cpp (99%) diff --git a/graphics/sdl2/Makefile b/sdl2/Makefile similarity index 97% rename from graphics/sdl2/Makefile rename to sdl2/Makefile index 1e347eb..bfc8fd2 100644 --- a/graphics/sdl2/Makefile +++ b/sdl2/Makefile @@ -46,14 +46,15 @@ ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE CFLAGS := -g -Wall -O2 -ffunction-sections \ $(ARCH) $(DEFINES) -CFLAGS += $(INCLUDE) -D__SWITCH__ +CFLAGS += $(INCLUDE) `$(DEVKITPRO)/portlibs/switch/bin/sdl2-config --cflags` CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions ASFLAGS := -g $(ARCH) 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 diff --git a/graphics/sdl2/source/main.cpp b/sdl2/source/main.cpp similarity index 99% rename from graphics/sdl2/source/main.cpp rename to sdl2/source/main.cpp index a603d16..b590ec7 100644 --- a/graphics/sdl2/source/main.cpp +++ b/sdl2/source/main.cpp @@ -2,7 +2,7 @@ #include #include -#include "SDL2/SDL.h" +#include static SDL_DisplayMode modes[5]; @@ -112,11 +112,8 @@ int main(int argc, char *argv[]) } while (!done) { - while (SDL_PollEvent(&event)) { - switch (event.type) { - case SDL_JOYAXISMOTION: SDL_Log("Joystick %d axis %d value: %d\n", event.jaxis.which,